Custodia MCP is a remote Model Context Protocol (MCP) server. It lets AI clients — such as Cursor, Claude Code, and other MCP-compatible tools — call Custodia on your behalf: expenses, people, budgets, spend permissions, receipts, and more. Actions run as the signed-in user, within that user’s permissions.
This guide covers client setup for sandbox.
On this page
- Overview
- Environments
- What You Need
- Cursor Setup
- Claude Code Setup
- Available Tools
- Verify the Host (Optional)
- Troubleshooting
- Security Notes
- Related Articles
Overview
Custodia MCP exposes a curated set of Custodia tools to AI assistants. After you connect and sign in, you can ask questions in natural language — for example, “What did I spend last month?” or “List my budgets.” The assistant calls MCP tools when relevant; you only see tools allowed for your user and your organization’s AI configuration.
Transport: Streamable HTTP at POST and GET /mcp. Unauthenticated requests return 401 with a WWW-Authenticate header pointing at OAuth protected-resource metadata.
Environments
| Environment | MCP URL | Sign-in / OAuth issuer |
|---|---|---|
| Sandbox | https://mcp.sandbox.custodia-tech.com/mcp |
https://sandbox.custodia-tech.com |
Contact Custodia for staging and production URLs when those hosts are enabled for your tenant.
What You Need
- A Custodia user on the target environment (for example, sandbox).
- An OAuth client ID for MCP — email support@custodia.ai to request one. Use this value as
CLIENT_ID(Cursor) orclientId(Claude Code) in the setup steps below.
The client ID is not a secret — it identifies your MCP app registration and selects which tool catalogue (agent type) is available. What you can actually call is further limited by the signed-in user’s permissions. MCP IDE clients use public PKCE and do not have a client secret.
Cursor Setup
Step 1: Configure ~/.cursor/mcp.json
Use the provisioned client ID and scope. Cursor discovers the authorization server from the MCP host:
{
"mcpServers": {
"custodia-sandbox": {
"url": "https://mcp.sandbox.custodia-tech.com/mcp",
"auth": {
"CLIENT_ID": "YOUR_OAUTH_CLIENT_ID",
"scopes": ["mcp:execute"]
}
}
}
}
Optional: store the client ID in an environment variable if your Cursor build supports ${env:...}:
"CLIENT_ID": "${env:CUSTODIA_MCP_OAUTH_CLIENT_ID}"
Do not add a CLIENT_SECRET — MCP IDE clients are public PKCE clients.
Step 2: Connect and Sign In
- Open Cursor Settings → Tools & MCP.
- Find
custodia-sandbox(or the name you chose). - Click Connect or Needs authentication.
- Complete browser sign-in on the Custodia sandbox host.
- Confirm the server shows as connected and tools are listed.
If Connect does nothing, click the Needs authentication label, or check Output → MCP for the authorize URL and open it manually.
Step 3: Use It
In Agent chat, ask Custodia-backed questions naturally. Examples:
- “What did I spend last month?”
- “Find Sarah’s user id, then list her expenses for July.”
- “List my budgets.”
Tools are filtered by your user permissions and the agent type bound to the OAuth client (typically cursor-mcp).
Claude Code Setup
Step 1: Add the Server
CLI (recommended):
claude mcp add --transport http custodia-sandbox \
https://mcp.sandbox.custodia-tech.com/mcp \
--client-id YOUR_OAUTH_CLIENT_ID
If your registration requires a fixed callback port:
claude mcp add --transport http custodia-sandbox \
https://mcp.sandbox.custodia-tech.com/mcp \
--client-id YOUR_OAUTH_CLIENT_ID \
--callback-port 8787
Ensure that exact redirect URI (http://localhost:8787/callback) is on the OAuth client’s redirectUris.
Or JSON in project .mcp.json or user config:
{
"mcpServers": {
"custodia-sandbox": {
"type": "http",
"url": "https://mcp.sandbox.custodia-tech.com/mcp",
"oauth": {
"clientId": "YOUR_OAUTH_CLIENT_ID",
"callbackPort": 8787,
"scopes": "mcp:execute"
}
}
}
}
Important:
-
typeis required (httpor aliasstreamable-http). Aurlwithouttypeis treated as a broken stdio server. - No client secret for public clients.
- If discovery against the authorization server is flaky, Claude Code v2.1.64+ supports
oauth.authServerMetadataUrlpointing athttps://sandbox.custodia-tech.com/.well-known/oauth-authorization-server.
Step 2: Authenticate
In a Claude Code session, run:
/mcp
Select custodia-sandbox and complete the browser login. Tokens are stored by Claude Code and refreshed automatically.
Step 3: Use It
Same natural-language prompts as Cursor. Claude calls MCP tools when relevant.
Available Tools
MCP exposes a curated catalogue — not every Custodia API. The client ID determines the broad tool list for your agent type; your user permissions reduce that list to what you can actually use in a session. Admins configure agent scopes in Custodia AI Config.
| Category | Examples |
|---|---|
| Expenses |
expenses_query, expenses_get_decline_reason, expenses_list_types
|
| People |
users_search, users_get, users_get_teammates, users_get_managers
|
| Budgets |
budgets_list, budgets_get, budget_reclaim_preview, budget_reclaim_execute
|
| Spend |
spend_permissions_list, spend_permission_request, … |
| Receipts / OOP |
oop_submit, receipts_get_ocr, oop_get_receipt_policy, … |
| Organization |
subsidiaries_list, cost_centers_list_mine, … |
| Files | files_upload |
Verify the Host (Optional)
These checks confirm the MCP endpoint and OAuth metadata are reachable.
Initialize request (expect 401):
curl -sS -D - -o /dev/null -X POST \
"https://mcp.sandbox.custodia-tech.com/mcp" \
-H "Content-Type: application/json" \
-H "Accept: application/json, text/event-stream" \
-d '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2025-06-18","capabilities":{},"clientInfo":{"name":"curl","version":"0"}}}'
Expect 401 and a WWW-Authenticate header referencing /.well-known/oauth-protected-resource.
Protected resource metadata:
curl -sS "https://mcp.sandbox.custodia-tech.com/.well-known/oauth-protected-resource"
Authorization server metadata:
curl -sS "https://sandbox.custodia-tech.com/.well-known/oauth-authorization-server"
Troubleshooting
| Symptom | Likely Cause | What to Try |
|---|---|---|
| No login / Connect UI in Cursor | Missing or invalid auth.CLIENT_ID; MCP entry not loaded |
Confirm mcp.json JSON; reload window; use the static client ID from Custodia |
| Connect does nothing | Cursor OAuth UI quirk | Click Needs authentication; check Output → MCP for the authorize URL |
401 after login |
Wrong environment, expired token, missing mcp:execute
|
Re-authenticate; confirm sandbox user and client scope |
redirect_uri mismatch |
Callback not on the OAuth client | Email support@custodia.ai — we can update the OAuth client for your callback |
| Tools missing | Client ID sets the agent tool catalogue; user permissions and feature scopes determine what appears for you | Confirm your user has the needed feature permissions; email support@custodia.ai if the client ID may be wrong for your use case |
| Claude skips the server |
url without "type": "http"
|
Add type to the server config |
Security Notes
- The client ID is not a secret — it only selects which tool catalogue is available for that MCP registration. Access is enforced by the signed-in user’s permissions and short-lived OAuth tokens.
- MCP IDE clients use public PKCE with agentic-delegate tokens — short-lived delegate JWTs, not long-lived secrets.
- MCP acts on behalf of the signed-in user within Custodia ACLs — treat a connected IDE like a privileged session.
- If a laptop is lost or you suspect an active MCP session is compromised, revoke access from Custodia Connected Apps or disconnect the server in your IDE and sign in again.
Related Articles
Questions or need staging/production URLs? Contact support@custodia.ai.