chatgpt-quota-mcp
MCP server that exposes a single tool to retrieve ChatGPT/Codex quota via the signed-in Codex CLI, reporting rate-limit windows and usage percentages.
README
ChatGPT Quota MCP
A single local MCP tool that lets ChatGPT read your current ChatGPT/Codex quota through your already signed-in Codex CLI.
ChatGPT
|
Secure MCP Tunnel
|
get_chatgpt_quota (local MCP)
|
codex app-server --stdio
|
account/rateLimits/read
What it returns
The server exposes one no-argument tool:
get_chatgpt_quota()
Example result:
{
"source": "codex_app_server",
"windows": [
{
"name": "primary",
"used_percent": 25.0,
"remaining_percent": 75.0,
"window_minutes": 300,
"resets_at": 1786543200
}
],
"rate_limit_reached_type": null,
"individual_limit": null,
"spend_control_reached": null,
"reset_credits": null
}
The tool does not assume that primary means 5-hour or secondary means weekly. It reports the window duration Codex actually returns.
Prerequisites
- Python 3.11+
uv- Codex CLI available as
codex - Codex CLI already signed in to the ChatGPT account whose quota you want to read
Verify the last two with:
command -v codex
codex
Install
git clone https://github.com/komaksym/chatgpt-quota-mcp.git
cd chatgpt-quota-mcp
uv sync --extra dev
Test the quota locally first
This bypasses MCP and proves that the Codex quota read works on your machine:
uv run python -c 'from chatgpt_quota_mcp.service import get_chatgpt_quota; import json; print(json.dumps(get_chatgpt_quota(), indent=2))'
If that prints your quota, the Codex side is working.
Connect it to ChatGPT
OpenAI Secure MCP Tunnel can launch a local stdio MCP command, so this project does not need an HTTP server or public port.
- In OpenAI Platform tunnel settings, create a tunnel associated with the ChatGPT workspace you will use and obtain a
tunnel_idplus runtime API key. - Install the current
tunnel-clientfrom OpenAI's tunnel settings/download instructions. - Configure the tunnel to launch this project's MCP executable:
export CONTROL_PLANE_API_KEY="sk-..."
TUNNEL_ID="tunnel_..."
MCP_COMMAND="$(pwd)/.venv/bin/chatgpt-quota-mcp"
tunnel-client init \
--sample sample_mcp_stdio_local \
--profile chatgpt-quota \
--tunnel-id "$TUNNEL_ID" \
--mcp-command "$MCP_COMMAND"
tunnel-client doctor --profile chatgpt-quota --explain
tunnel-client run --profile chatgpt-quota
Do not commit the runtime API key.
- In ChatGPT, enable Settings -> Security and login -> Developer mode.
- Open ChatGPT Plugins, press +, choose Tunnel under Connection, and select or paste your
tunnel_id. - Confirm that ChatGPT discovers exactly one tool:
get_chatgpt_quota.
Then ask:
How much Codex quota do I have left?
Development
uv sync --extra dev
uv run ruff check .
uv run ruff format --check .
uv run mypy src
uv run pytest
uv build
The test suite includes a real MCP stdio round trip backed by a fake Codex executable, so CI exercises the full local protocol chain without using a real account.
Why this shape
The Codex App Server has a stable account/rateLimits/read method. Using that structured interface is smaller and less brittle than scraping ChatGPT UI text or calling undocumented ChatGPT backend endpoints.
References
Recommended Servers
playwright-mcp
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
Magic Component Platform (MCP)
An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.
Audiense Insights MCP Server
Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
graphlit-mcp-server
The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.
Kagi MCP Server
An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.
E2B
Using MCP to run code via e2b.
Neon Database
MCP server for interacting with Neon Management API and databases
Exa Search
A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.