Skip to main content
Forge exposes two distinct MCP surfaces: Both surfaces use Streamable HTTP. Forge MCP currently negotiates MCP protocol version 2025-06-18.

Forge MCP

Discovery

Add this remote server URL to a Streamable HTTP client:
An unauthenticated request receives a WWW-Authenticate challenge with the protected-resource metadata URL. The canonical metadata document is:
It declares the MCP resource, authorization server, supported scopes, and header-based bearer authentication. OAuth clients should discover these values rather than hard-code the authorization server.

Authentication

Interactive clients use OAuth 2.1 for the MCP resource audience. The resulting grant preserves the user identity, organization, role, scopes, and client identity. REST API access tokens use a different audience and are rejected. Non-interactive clients that support custom authorization headers can use a Forge service-account bearer token with mcp:connect and the scopes required by the selected tools.

Protocol methods

Other methods return JSON-RPC -32601. The initialize, ping, and tool responses include MCP-Session-Id. Send that header on subsequent requests. A revoked session cannot be silently recreated with the same identifier.

Tool selection

Forge defaults to the metadata and default-read toolsets. A client can request an explicit comma-separated selection before session creation:
The session retains that selection. Toolsets select a surface; they do not grant authorization. tools/list still removes any tool whose capability is denied by role, scope, read-only mode, or destructive-tool policy. See Tool Reference for tool names, response envelopes, and authorization metadata.

Connect an approved server

You can connect a Streamable HTTP client directly with the hosted endpoint shown on the Registry server:
Add that URL to the MCP client. Interactive clients should follow Forge OAuth discovery and open Forge sign-in automatically. If the upstream also uses per-user OAuth, Forge asks the user to connect that provider account as a separate step. A server configured with No upstream authentication still uses Forge sign-in at the hosted endpoint; it simply sends no credential from Forge to the upstream server. For unattended clients, enable service/API tokens on the Registry server and use an MCP-audience service token. Do not substitute a REST API token. If the client reports that its redirect URI is not allowed, copy the exact redirect_uri from the authorization error. An administrator can add it under Registry > server > Settings > Client callback policy. Organizations with no callback rules accept valid callbacks by default; once any rule exists, an Allow rule must match and Block rules take precedence. Forge CLI installs an approved registry server into Claude Code or Codex, creates a gateway credential for that client installation, and records the installation in the active Forge profile:
For Codex:
Pass --config PATH when the client configuration is not in its default location. The CLI modifies only the selected server entry and preserves unrelated client configuration. On supported systems, its gateway token is stored in the operating-system keychain rather than in the client configuration. forge mcp run SERVER starts a local stdio bridge for clients that cannot connect to the remote Streamable HTTP endpoint.

Two authentication boundaries

A registry definition determines whether the upstream server uses an organization credential, a per-user credential, or OAuth. Gateway and upstream credentials are separate: the first authenticates the client to Forge; the second authenticates Forge to the upstream server. Rotating or revoking a gateway token does not change the upstream server credential. Disconnecting upstream OAuth does not make a revoked gateway token valid again. Discover and register an OAuth-capable upstream:
The registration command supports --redirect-uri, --no-discovery, and --no-persist for providers whose registration lifecycle requires explicit control.

Manage gateway tokens

Use a separate gateway token for each client installation. This keeps access independently attributable and lets you rotate or revoke one client without interrupting the others.

Issue and store

forge mcp install handles token issuance and secure local storage automatically. To create a token for another supported client workflow:
The plaintext secret is returned only when the token is issued. Forge stores only its hash, so copy the secret into the intended client’s secure credential store before closing the output. Token lists and later API responses contain only non-secret metadata. Gateway tokens expire after 90 days by default. You can select a lifetime from 1 to 365 days when issuing or rotating one.

Inspect, rotate, and revoke

List a server’s tokens to review their IDs, client names, status, expiry, and last-used time:
Rotate a token before it expires or whenever its local copy may have been exposed:
Rotation revokes the previous token immediately and returns the replacement secret once. Update the client credential before its next connection. Revoke a token that is no longer needed:
Revocation takes effect at the Forge gateway and does not reveal or modify the upstream credential.

Uninstall

Remove a Registry server from a local client with:
Uninstall removes only that server’s local client configuration and revokes the gateway token associated with that installation. It does not remove the Registry item or revoke a separately managed upstream OAuth grant or organization credential. For direct automation, the same list, issue, rotate, and revoke operations are available through the Forge REST API.

Authorization

Forge reevaluates every tools/list and tools/call. A tool is callable only when all applicable gates pass:
  1. MCP is enabled for the organization.
  2. The actor has the mcp.connect capability and mcp:connect scope.
  3. The session selected the tool’s toolset.
  4. The capability supports MCP and the actor has its required permission and scopes.
  5. Organization read-only and destructive-tool settings allow the capability.
  6. The call arguments satisfy the advertised JSON Schema.
  7. Guarded mutations contain the required reason, idempotency key, dry-run, and confirmation inputs.
Arguments cannot target an organization other than the authenticated actor’s organization.

Results and errors

Successful tools/call results contain both MCP text content and a structured result:
When an underlying Forge API operation returns a non-2xx result, MCP returns a tool result with isError: true and a bounded Forge error payload. It does not convert that domain error into a JSON-RPC transport error. Tool output is bounded. Large responses indicate truncation or expose pagination fields; continue with the returned cursor or offset rather than assuming the first result is exhaustive.

Correlation

Applications using both the Forge LLM Gateway and MCP Gateway can bind a tools/call request to the LLM tool call that caused it: Forge accepts the binding only when the parent event exists in the same organization and is a tool event. Invalid correlation is ignored; it never grants access, changes a policy decision, or reaches the upstream MCP server.

Sessions

Tool Reference

Review Forge MCP tools and their runtime metadata.

Commands

Review MCP registry and session commands.

MCP Gateway

Understand policy and response controls for upstream MCP traffic.

MCP Requests

Review the MCP request and approval model.