MCP Server
The Mafdet AI MCP server brings read-only account tools into MCP clients like Claude Code, Claude Desktop, Cursor, Codex CLI, and OpenCode. It does not run model inference — you keep calling models through each tool's normal OpenAI-compatible endpoint. This server only adds account visibility and docs search.
Tools
| Tool | Needs a key | What it does |
|---|---|---|
list_models | no | List models with provider, access tier, API surface, and pricing |
search_docs | no | Search these docs (titles, URLs, summaries) |
get_balance | yes | Wallet balance, bonus, frozen, available |
get_usage_summary | yes | Requests, tokens, and charge over the last N days (1–90) |
get_subscription | yes | Current plan, status, period, and Playground credit |
All tools are read-only — no key management, recharge, refund, or any write.
Setup
Set MAFDET_API_KEY to a key with the account:read scope (create one in
API Keys — check "Allow the local MCP server to read
this account"). The key is optional: list_models and search_docs work
without it.
Claude Code
claude mcp add mafdet --env MAFDET_API_KEY=sk-mafdet-live-... -- npx -y @mafdet/mcp
Claude Desktop / Cursor / other MCP clients
{
"mcpServers": {
"mafdet": {
"command": "npx",
"args": ["-y", "@mafdet/mcp"],
"env": { "MAFDET_API_KEY": "sk-mafdet-live-..." }
}
}
}
Codex CLI (~/.codex/config.toml)
[mcp_servers.mafdet]
command = "npx"
args = ["-y", "@mafdet/mcp"]
env = { MAFDET_API_KEY = "sk-mafdet-live-..." }
Security
- Provide the key through your client's env/secret config, not on a shared command line. It is sent only to Mafdet AI over HTTPS, only for the account tools.
- Pin a major version (
@mafdet/mcp@0) in automated setups. - Requires Node.js 20+.