MCP server
Connect any MCP client to infrai — Claude Desktop, Cursor, Cline, Windsurf and more. Every infrai capability becomes an MCP tool your AI agent can call, with one key, one wallet and one bill. Run it locally over stdio, or connect to the hosted streamable-HTTP endpoint.
What it is
The infrai MCP (Model Context Protocol) server is a thin translation layer in front of the same gateway the REST API exposes — not a second implementation. Auth, wallet pre-check, idempotency, smart routing and billing run exactly as for a REST call.
Tools are derived 1:1 from the discovery manifest: every public capability becomes a tool, and each capability's request schema becomes the tool's inputSchema verbatim. New capabilities appear as tools automatically — nothing to hand-maintain.
Local (stdio): npx @infrai/mcp-server
The simplest path for desktop AI tools: run the published npm package over stdio. Add this to your client's MCP config (for example Claude Desktop's claude_desktop_config.json) and restart the client:
{
"mcpServers": {
"infrai": {
"command": "npx",
"args": ["-y", "@infrai/mcp-server"],
"env": { "INFRAI_API_KEY": "ifr_..." }
}
}
}Works with any stdio-capable MCP client, including:
- Claude Desktop
- Cursor
- Cline
- Windsurf
- Smithery
Remote (streamable-HTTP)
Clients that support remote MCP can connect straight to the hosted endpoint at https://api.infrai.cc/mcp — no local install. Forward your infrai key as a Bearer token:
{
"mcpServers": {
"infrai": {
"url": "https://api.infrai.cc/mcp",
"headers": { "Authorization": "Bearer ifr_..." }
}
}
}The endpoint answers each JSON-RPC POST with a single application/json response. A bare GET returns 405 (the server initiates no server→client stream).
Authentication
Every call authenticates with your infrai project key (ifr_...), forwarded as Authorization: Bearer. The server never logs or persists it. Get a key by signing in at the console with Google/GitHub (+ $2 free credit; email sign-in starts at $0). When the wallet runs out, calls return the standard 402 INSUFFICIENT_CREDIT.
Calling tools (JSON-RPC)
The server speaks MCP over JSON-RPC 2.0. List the available tools, then call one by name with arguments matching its inputSchema — the same field names the REST API and discovery manifest publish.
List tools
curl https://api.infrai.cc/mcp \
-H "Authorization: Bearer $INFRAI_API_KEY" \
-H "Content-Type: application/json" \
-d '{"jsonrpc": "2.0", "id": 1, "method": "tools/list"}'Call a tool
curl https://api.infrai.cc/mcp \
-H "Authorization: Bearer $INFRAI_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"id": 2,
"method": "tools/call",
"params": {
"name": "email.send",
"arguments": {"to": "you@example.com", "subject": "Hi", "text": "Hello from MCP"}
}
}'Every tool's schema and the live tool set come from the discovery manifest — browse the capability reference or fetch GET /v1/discovery to see every tool, its parameters and its errors.