MCP Server
The Code_ MCP (Model Context Protocol) server lets AI agents — Claude, ChatGPT, custom agents — manage your finances via tool use. Agents can query spend, create projects, freeze cards, and check alerts, all through a standardized protocol.
Overview
The MCP server exposes 10 tools and 2 resources over stdio transport. It's designed for the PRD's vision of agents as first-class financial actors.
| Tool | Description |
|---|---|
| list_projects | List all projects with status and budget |
| create_project | Create a project with auto-generated virtual card |
| get_project_pnl | Profit & loss for a specific project |
| get_spend | Spend breakdown by category and provider |
| get_balance | Account balance and credit info |
| list_cards | All virtual cards with status and spend |
| freeze_card | Freeze a card to block transactions |
| unfreeze_card | Unfreeze a card |
| get_rewards | Code Credits balance and tier breakdown |
| get_alerts | Spend alerts and anomalies |
Setup with Claude Code
The MCP server is already configured in the project's .mcp.json. If you're working in the Code_ repo, the tools are available automatically.
To add it to a different project:
claude mcp add --scope project codecard -- node /path/to/code_-cli/dist/mcp-server.jsSetup with Claude Desktop
Add to your claude_desktop_config.json:
{
"mcpServers": {
"codecard": {
"command": "node",
"args": ["/path/to/code_-cli/dist/mcp-server.js"]
}
}
}Setup via CLI
Start the MCP server directly from the Code_ CLI:
codecard mcpThis starts the stdio transport, ready for any MCP-compatible client to connect.
Tool Reference
list_projects
No parameters. Returns all projects with name, status, and monthly budget.
Projects (4):
ai-tutor-app (active) — $5,000.00/mo
vibe-cli (active) — $2,000.00/mo
client-dashco (active) — $8,000.00/mo
experiment-rag (active) — $1,000.00/mocreate_project
| Parameter | Type | Required | Description |
|---|---|---|---|
| name | string | Yes | Project name (kebab-case) |
| budget | number | No | Monthly budget in dollars (default: 2000) |
Tool: create_project
Args: { "name": "my-agent-app", "budget": 5000 }
✓ Project "my-agent-app" created
✓ Card •••• 8421 assigned
✓ Budget: $5,000.00/moget_project_pnl
| Parameter | Type | Required |
|---|---|---|
| project | string | Yes — project name |
Returns spend, revenue, net, margin, and top providers for the named project.
get_spend
| Parameter | Type | Required |
|---|---|---|
| project | string | No — filter by project name |
Returns total spend, breakdown by category (AI APIs, Cloud, Dev Tools, Other), and breakdown by provider. Without a project filter, shows all spend across all projects.
get_balance
No parameters. Returns available balance, pending charges, credit limit, and credit utilization.
list_cards
No parameters. Returns all virtual cards with last4, associated project, status, and spend vs. limit.
freeze_card / unfreeze_card
| Parameter | Type | Required |
|---|---|---|
| card_id | string | Yes — e.g. card_001 |
Freeze blocks all transactions. Unfreeze re-enables them. Use freeze when an agent detects a cost anomaly.
get_rewards
No parameters. Returns Code Credits balance (available, pending, lifetime), reward tier rates, and earnings per category.
get_alerts
No parameters. Returns all alert events with severity, title, message, project, and acknowledgment status.
Resources
The MCP server also exposes two resources for bulk data access:
| URI | Description | Format |
|---|---|---|
| codecard://projects | All projects as structured data | application/json |
| codecard://cards | All virtual cards as structured data | application/json |
Agent Usage Patterns
Cost monitoring agent
An agent that periodically checks spend and alerts on anomalies:
Check my Code_ spend. If any project's daily spend is more than
3x the average, freeze that project's card and tell me about it.Project setup agent
An agent that creates infrastructure alongside financial tracking:
I'm starting a new project called "recipe-ai" with a $2000/mo budget.
Create the Code_ project, then set up a Vercel project and Supabase
database for it.Financial reporting agent
An agent that generates weekly financial summaries:
Generate a weekly financial report for all my Code_ projects.
Include P&L for each project, total rewards earned, and flag
any projects that are losing money.