MCP Server
Connect any Model Context Protocol client to Api.Airforce — use our models, images, the model list and your balance as MCP tools, billed to your account.
What is MCP?
The Model Context Protocol (MCP) lets AI agent clients — like Claude Desktop, Cursor or any MCP-capable app — call external services as tools. Api.Airforce runs a remote MCP server so these clients can use our models directly.
Endpoint & transport
The server speaks JSON-RPC 2.0 over Streamable HTTP at a single endpoint, protocol version 2025-06-18. Streaming responses are returned when you send the header Accept: text/event-stream.
POST https://api.airforce/mcpAuthentication
Send your Api.Airforce API key — or an OAuth 2.0 bearer token — in the Authorization header. Unauthenticated requests return 401 with a WWW-Authenticate challenge pointing to our OAuth metadata, so compliant clients can start the OAuth flow automatically.
For OAuth tokens the relevant scopes are profile (for get_balance), chat (for chat_completion) and images (for generate_image).
Connecting a client
Most clients accept a remote MCP server URL plus a bearer token. A typical configuration looks like this:
{
"mcpServers": {
"api-airforce": {
"url": "https://api.airforce/mcp",
"headers": { "Authorization": "Bearer YOUR_API_KEY" }
}
}
}You can verify the connection manually with a JSON-RPC initialize call:
curl -X POST https://api.airforce/mcp \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2025-06-18","capabilities":{},"clientInfo":{"name":"my-app","version":"1.0.0"}}}'Available tools
Call tools/list to discover them at runtime. Four tools are available:
list_modelsList the available models with pricing and capability flags.
get_balanceReturn your pay-as-you-go balance (in US cents) and current plan. Requires the profile scope for OAuth tokens.
chat_completionRun an OpenAI-compatible chat completion. Billed to your account exactly like POST /v1/chat/completions.
generate_imageGenerate an image. Billed to your account exactly like POST /v1/images/generations.
curl -X POST https://api.airforce/mcp \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"jsonrpc":"2.0","id":2,"method":"tools/list"}'Billing
chat_completion and generate_image are billed to your account at the same rates as the REST API — there is no separate MCP pricing. list_models and get_balance are free.
Discovery
A machine-readable server card is published for automatic discovery:
https://api.airforce/.well-known/mcp/server-card.json