Connect an MCP Agent to Multiple Services Through One Endpoint

An MCP agent can use one connection to find a suitable service, inspect its inputs, and retrieve the result of approved work. For a developer adding research, extraction, or media capabilities, that means a shared access path instead of a separate client connection for every supplier.

o11 exposes this through gateway tools for discovery, inspection, invocation, and result retrieval. This guide shows how those tools relate to provider operations, how to inspect the wire contract without a paid call, and how to keep an accepted task recoverable across agent turns.

Understand the two-level tool model

There are MCP tools and provider operations. The MCP server’s tools/list describes the gateway’s callable interface. The gateway’s discover operation searches the provider catalog. Its inspect operation returns the selected provider definition.

That distinction avoids assuming every supplier operation appears directly as a separate MCP tool in the client’s initial list. An agent can begin with a compact interface, find a candidate, inspect it, and invoke it through the gateway.

MCP defines tools/list, tools/call, and schemas describing expected inputs. The particular catalog discovery behavior is an o11 application contract layered on those protocol operations. Every tool a client loads also adds its definition to the model’s context, so measure what those definitions cost as the catalog grows. MCP tools specification.

For a runtime, this means an initial connection can remain stable while the allowed provider catalog changes. The application still needs to review which operations a production workflow may select. A larger reachable catalog is not a reason to grant broader authority.

Prepare authentication and transport

Use the HTTPS origin supplied for your configured environment and an application key scoped to the intended tools and accounts. Keep the key on the server or in the client’s approved secret configuration.

The implemented endpoint is POST /mcp with bearer-key authentication. Initialization reports protocol revision 2025-06-18 and server version 0.1.0. Paid execution separately requires activated supplier access, reviewed pricing, and an approved maximum.

The o11 implementation accepts JSON-RPC requests over HTTP POST and returns JSON responses. GET on /mcp returns method-not-allowed. Use a client that supports the server’s implemented transport behavior; do not configure an SSE endpoint merely because another MCP server uses one.

The MCP transport specification describes the HTTP transport and client-server request handling. Protocol compatibility needs to be checked against the actual client and server versions rather than inferred from the URL alone. MCP transport specification.

For ready-made assistant configuration, use the Claude Code guide or Cursor guide. Those guides use each client’s documented environment-variable syntax.

Inspect the wire contract without invoking a supplier

The following Bun diagnostic script sends an initialization request and lists the gateway tools. It is useful for understanding the wire format. It is not a complete reusable MCP client implementation.

const origin = process.env.O11_TOOLS_URL;
const key = process.env.O11_API_KEY;
if (!origin || !key) throw new Error("Missing configuration");
const endpoint = new URL("/mcp", origin);
if (endpoint.protocol !== "https:") throw new Error("HTTPS required");
let requestId = 0;

async function rpc(method: string, params?: unknown) {
  const response = await fetch(endpoint, {
    method: "POST",
    redirect: "error",
    headers: {
      Authorization: `Bearer ${key}`,
      "Content-Type": "application/json",
      Accept: "application/json, text/event-stream",
    },
    body: JSON.stringify({
      jsonrpc: "2.0", id: ++requestId, method, params,
    }),
  });
  const value: unknown = await response.json();
  if (!response.ok) throw new Error(`MCP HTTP ${response.status}`);
  return value;
}

console.log(await rpc("initialize", {
  protocolVersion: "2025-06-18",
  capabilities: {},
  clientInfo: { name: "contract-check", version: "0.1.0" },
}));
console.log(await rpc("tools/list"));

Run it with bun inspect-mcp.ts after setting environment values. A production client must handle the protocol lifecycle, notifications, error envelopes, negotiated capabilities, and supported transport details. Use a maintained MCP client for that work rather than extending this diagnostic script blindly.

The expected result is server information and gateway tool definitions. No paid provider operation is requested by this sequence.

Discover and inspect a provider operation

Through the MCP client, call the gateway’s discovery tool:

{
  "jsonrpc": "2.0",
  "id": 3,
  "method": "tools/call",
  "params": {
    "name": "discover",
    "arguments": { "query": "search" }
  }
}

Use an actual returned identifier in a subsequent inspect call. Review required input, provider, account mode, lifecycle, and pricing evidence. Discovery supports cursor-based traversal of eligible results; do not assume the first page represents every matching operation.

The current o11 MCP result encodes operation data as JSON text inside a content block. A client must interpret the protocol result first and then validate the operation data it consumes. Do not treat arbitrary returned text as an authorization decision.

If the tool result has isError: true, report the tool-level failure even when HTTP status is successful. Transport success and operation success are different layers. An actual invocation receipt adds another lifecycle layer after admission.

Keep pagination and inspection in the runtime’s planning phase. For an established production workflow, persist the approved operation and its mapping instead of rediscovering an arbitrary provider on every turn. A later catalog update can then be reviewed as a configuration change, with a clear comparison against the previous behavior and a rollback path for new work.

Make authorized execution explicit

The gateway’s invoke tool accepts the same invocation contract as REST. It includes the exact tool identifier, stable idempotency key, supplier input envelope, credential mode, and maximum cost in integer micro-USD.

Keep account selection and maximum authority in trusted configuration. The model can propose a useful operation, but the runtime should validate that proposal against the user’s task and server-enforced policy before dispatch.

Choose a narrow first task. For example, retrieve one approved public page and retain its source. Confirm the chosen operation is activated and the account path is ready. A reference price or catalog definition is not evidence that a supplier call can run in your workspace.

Recurring services and write operations require their own authority. A single MCP endpoint should not turn a read-oriented assistant into an administrator of every connected account. The spending limit guide explains how to keep those boundaries practical.

Preserve invocations across client turns

After execution is accepted, persist the invocation identifier with the task. A chat turn can end while a media job or research workflow continues. The next turn should retrieve that existing invocation through get_invocation.

Do not infer completion from a returned receipt. Check the lifecycle state and result. A waiting job remains pending; an unknown outcome requires recovery. A failed operation may still have billable supplier usage depending on its contract.

If the connection drops before the identifier is received, retry the original request under the same persisted idempotency key and unchanged inputs according to the service contract. Do not generate a new intent merely to reconnect.

For a long-running job, the application can show pending work and offer a later status check. This is more accurate than blocking indefinitely or silently buying a replacement. The asynchronous media guide provides a fuller application pattern.

Retain security and provenance boundaries

One endpoint reduces connection setup, but it also concentrates access. Use narrow policies and separate execution credentials where projects or workspaces differ. Verify that status retrieval, connections, and resources remain scoped to the caller’s authority.

Keep external content separate from trusted instructions. A page returned through MCP can still contain prompt injection or misleading claims. The protocol is a transport for content; it does not make the content authoritative.

Retain source URLs and supplier provenance in domain outputs. If a model summarizes a tool result, the application should still be able to explain where the evidence came from and whether it was current or incomplete.

Account repair should remain administrative. The assistant can identify a missing connection and explain the next step without receiving raw supplier secrets or authority to expand its own policy.

Verify the integration in stages

Start with initialization and listing. Then verify discovery and inspection under a scoped key. Next validate request construction locally against the selected contract. These steps test useful parts of the integration without a paid supplier call.

When live access is configured and authorized, run one bounded operation and retain the receipt and output. Test existing-result retrieval before adding complex multi-step work. Record which client and protocol revision were used.

The current o11 implementation and local audits establish contract behavior, not universal live supplier certification. This tutorial does not claim a paid execution was performed. Environment activation remains a prerequisite.

For framework-specific orchestration, continue with Vercel AI SDK or LangGraph. For a simpler server integration, the public HTTP adapter exposes the same underlying operations.

Sources

Give your agents a wallet.
Open up their world.

The paid web, through one simple API.

Get started
Become a partner Sell your product/API to agents using o11.

Keep reading