Connect an agent
Let agents such as Claude Code, Codex and Cursor read your usage and deployments from MFlare over MCP.
MFlare runs a local MCP server on your Mac. Once an agent is connected, it can ask how much of each quota is left, when it resets, and how a Worker’s latest builds and deployments went, instead of guessing the limits of your Cloudflare plan.
Requires Pro
The MCP server is a Pro feature. On Free, the controls on the MCP settings page are turned off.
What is MCP?
MCP (Model Context Protocol) is an open protocol that lets AI assistants call tools and read data from outside sources. MFlare’s MCP server hands an agent the same usage, quotas and build history you see in the menu bar, as structured data it can reason about.
Turn on the MCP server
- Open MFlare’s Settings › MCP.
- Turn on MCP Server. Its status changes to Running. The first time, MFlare creates a token.
- The port is
47823by default. If it’s taken, pick another from 1024 to 65535; turn the MCP server off first to change it.
Every client below needs the same two things:
- URL:
http://127.0.0.1:47823/mcp(or your port, if you changed it) - Header:
Authorization: Bearer <token>, with the token from Copy next to Token
In the examples, replace <token> with your token, and 47823 with your port if you changed it.
Tools
Every tool is read-only and answers from what MFlare already has, so calling one doesn’t send extra requests to Cloudflare (except get_build_log). When account_id is left out, a tool reads the account MFlare currently shows.
| Tool | Parameters | What it’s for |
|---|---|---|
list_accounts | — | The Cloudflare accounts MFlare monitors, with each one’s Workers plan |
get_usage | account_id (or "all"), service, metric | Usage of one or every account in the current billing period: used, quota, what’s left and when it resets |
get_usage_alerts | — | Usage near or past its quota in every account, warning from 80%, most severe first |
list_workers | account_id | The Workers of an account, each with its latest build or deployment |
list_deployments | worker, account_id | A Worker’s latest deployments and builds, newest first, at most 10 |
get_build_log | worker, build_id, level, cursor, account_id | The Build Log of a build, e.g. to find why it failed; level keeps only errors or warnings |
A few things the server also tells the agent, so its answers stay accurate:
- On the Free Workers plan a quota is a hard limit. On Workers Paid it’s an included allowance, and usage beyond it is billed, so
get_usageadds the overage price and an estimated cost. - MFlare doesn’t read the Workers plan from Cloudflare; you set it in MFlare. If you haven’t, the agent is told the quotas assume Free.
- Billing periods reset at 00:00 UTC, and every time is in UTC. Usage is refreshed about every 5 minutes.
get_build_logreads a long or still-running log in pages: the agent calls it again with the returnedcursorto read on.
Configuration
MFlare’s MCP server uses the Streamable HTTP transport and only listens on your Mac, so it works with clients that run on your Mac, not with cloud-hosted ones such as ChatGPT connectors.
Keep the token out of your repository
Some clients read a config file from your project folder. Put MFlare in the client’s global config instead, or keep that file out of Git, so the token isn’t committed.
Claude Code
Under Agents in Settings › MCP, click Claude Code and MFlare copies the command that connects it, with your port and token already filled in. Paste it into Terminal and run it once:
claude mcp add --scope user --transport http MFlare http://127.0.0.1:47823/mcp --header "Authorization: Bearer <token>"--scope user makes MFlare available in every project. Run claude mcp list to check it’s connected.
Codex
Under Agents, click Codex and run the copied command in Terminal. It removes any MFlare added before and writes the token into Codex’s config.toml, so running a fresh copy updates it.
To set it up by hand, add this to ~/.codex/config.toml:
[mcp_servers.MFlare]
url = "http://127.0.0.1:47823/mcp"
[mcp_servers.MFlare.http_headers]
Authorization = "Bearer <token>"Claude Desktop
Claude Desktop’s config file starts local servers only, so connect it through mcp-remote, which needs Node.js.
- Open Claude Desktop and go to Settings › Developer.
- Click Edit Config, and open
claude_desktop_config.json. - Add MFlare:
{
"mcpServers": {
"MFlare": {
"command": "npx",
"args": [
"mcp-remote",
"http://127.0.0.1:47823/mcp",
"--header",
"Authorization:${MFLARE_AUTH}"
],
"env": {
"MFLARE_AUTH": "Bearer <token>"
}
}
}
}- Restart Claude Desktop.
The header goes through env because Claude Desktop doesn’t pass spaces inside args reliably.
Cursor
- Open Cursor and go to Settings › Tools & MCP.
- Click New MCP Server, which opens
~/.cursor/mcp.json, and add MFlare:
{
"mcpServers": {
"MFlare": {
"url": "http://127.0.0.1:47823/mcp",
"headers": {
"Authorization": "Bearer <token>"
}
}
}
}Visual Studio Code
You need the GitHub Copilot Chat extension.
- Open the Command Palette (Cmd + Shift + P) and run MCP: Open User Configuration.
- Add MFlare. VS Code asks for the token the first time it starts the server and keeps it in its secret storage:
{
"inputs": [
{
"type": "promptString",
"id": "mflare-token",
"description": "MFlare MCP token",
"password": true
}
],
"servers": {
"MFlare": {
"type": "http",
"url": "http://127.0.0.1:47823/mcp",
"headers": {
"Authorization": "Bearer ${input:mflare-token}"
}
}
}
}Windsurf
- Open Windsurf Settings › Cascade.
- Click Manage MCPs, then View raw config.
- Add MFlare:
{
"mcpServers": {
"MFlare": {
"serverUrl": "http://127.0.0.1:47823/mcp",
"headers": {
"Authorization": "Bearer <token>"
}
}
}
}Gemini CLI
Add MFlare to mcpServers in ~/.gemini/settings.json, then restart Gemini CLI:
{
"mcpServers": {
"MFlare": {
"httpUrl": "http://127.0.0.1:47823/mcp",
"headers": {
"Authorization": "Bearer <token>"
}
}
}
}GitHub Copilot CLI
Add MFlare to ~/.copilot/mcp-config.json, or run /mcp add in Copilot CLI and fill in the same values:
{
"mcpServers": {
"MFlare": {
"type": "http",
"url": "http://127.0.0.1:47823/mcp",
"headers": {
"Authorization": "Bearer <token>"
},
"tools": ["*"]
}
}
}Run /mcp show to check it’s available.
OpenCode
Add MFlare to ~/.config/opencode/opencode.json:
{
"$schema": "https://opencode.ai/config.json",
"mcp": {
"MFlare": {
"type": "remote",
"url": "http://127.0.0.1:47823/mcp",
"headers": {
"Authorization": "Bearer <token>"
},
"enabled": true
}
}
}Zed
Open Zed’s settings file (Cmd + ,) and add MFlare under context_servers:
{
"context_servers": {
"MFlare": {
"url": "http://127.0.0.1:47823/mcp",
"headers": {
"Authorization": "Bearer <token>"
}
}
}
}Usage examples
Once connected, try asking:
- “How’s my Cloudflare usage looking?”
- “Is anything close to its quota?”
- “How many KV writes do I have left today, and when does it reset?”
- “I’m about to bulk-write to KV. Do I have enough writes left today?”
- “What would I pay for this month’s overage on Workers Paid?”
- “Which of my Workers deployed most recently?”
- “Why did api-gateway’s last build fail?”
- “Show me only the errors from api-gateway’s latest build log.”
Tip
On a long build log, ask the agent for just the errors or warnings. It passes level to get_build_log and reads far fewer lines.
Troubleshooting
- The agent can’t connect. Check that MCP Server is on and shows Running, and that the port in your config matches the one in MFlare. MFlare has to be running too.
- Requests are refused as unauthorized. The token was regenerated, or MFlare went back to Free and forgot it. Copy the token or the connect command again and update your config.
- The quotas look wrong. Check the Workers plan you set for the account in MFlare. MFlare doesn’t read it from Cloudflare, so an account with no plan set is treated as Free.
Security
- The MCP server only listens on
127.0.0.1, so nothing outside your Mac can reach it. It also turns away requests from web pages that aren’t on this Mac. - Every request needs the token. The connect commands and config files include it too, so keep them to yourself.
- If the token may have leaked, click Regenerate… next to Token. The old token stops working right away, and connected agents need the new token or a fresh copy of the command.
- Going back to Free turns the MCP server off and forgets its token. After reactivating Pro, turn it on again and copy the command again.