MCP
Give an MCP client your tasks and presets as tools, billed exactly as a direct call.
OP Inference serves the Model Context Protocol at
https://api.opinference.com/v1/mcp. An MCP client pointed there with your API key sees your
tasks and your presets as tools, and each tool call is served by the same route
you would call directly.
Connect a client
The endpoint is stateless HTTP: one JSON-RPC request per POST, with no session and no event
stream. Authenticate every request with your key as a bearer token, as on every other route.
{
"mcpServers": {
"opinference": {
"type": "http",
"url": "https://api.opinference.com/v1/mcp",
"headers": { "Authorization": "Bearer ${OP_API_KEY}" }
}
}
}Protocol versions 2026-07-28, 2025-11-25 and 2025-06-18 are supported. A client on an older
revision starts with initialize, which answers the version it asked for when supported and
2025-11-25 otherwise; a 2026-07-28 client uses server/discover.
A request that carries an Origin header is refused with 403, so a browser page cannot call the
endpoint with a key it has obtained. Call it from a server, a desktop client or an agent runtime.
Tools
| Tool | What it calls | Arguments |
|---|---|---|
task.<name> | POST /v1/tasks/<name>, the task's latest version | The task's input object. inputSchema and outputSchema are the task's schemas |
preset.<slug> | POST /v1/chat/completions with model @preset/<slug> | prompt, the user message; and variables, when the preset declares any |
tools/list shows only the tasks your key may call, the same list as GET /v1/tasks, and only
your own tenant's presets. A task tool's result carries the checked output as
structuredContent and as text; a preset tool's result is the assistant's text.
A call the route refuses or fails, such as a budget refusal or an output_invalid answer, comes
back as a tool result with isError: true and text of the form <code>: <message>, so the model
calling the tool can read why. An unknown tool name or arguments that are not an object are a
JSON-RPC error -32602, and nothing is run.
Billing
Listing tools, ping, initialize and server/discover are free. A tool call is admitted,
routed, billed and retained exactly as the direct call would be: your key's policy, budget, rate
limit and retention class all apply, and the usage record names the task or preset as it would for
the direct route. A task call that is repaired bills two generations, as described in
Tasks.
An agent can call tools quickly. Your key's budget and rate limit are what bound its spend, so give an agent a key with a budget you are prepared for it to use.
Tool results are untrusted input
A tool result is model output, and it may carry text that reads as instructions, especially when the tool's input came from a third party. Your agent receives it with your key's authority. Treat it as data, as you would any other response from this API.