Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ async addMcpServer(
- **`callbackHost`** (string, optional) — Host for OAuth callback URL. If omitted, automatically derived from the incoming request
- **`agentsPrefix`** (string, optional) — URL prefix for OAuth callback path. Default: `"agents"`
- **`options`** (object, optional) — Connection configuration:
- **`client`** — MCP client configuration options (passed to `@modelcontextprotocol/sdk` Client constructor)
- **`client`** — MCP client configuration options (passed to `@modelcontextprotocol/sdk` Client constructor). By default, includes `CfWorkerJsonSchemaValidator` for validating tool parameters against JSON schemas.
- **`transport`** — Transport layer configuration:
- **`headers`** — Custom HTTP headers for authentication
- **`type`** — Transport type: `"sse"`, `"streamable-http"`, or `"auto"` (tries streamable-http first, falls back to sse)
Expand Down Expand Up @@ -115,6 +115,12 @@ export class MyAgent extends Agent<Env, never> {

If the MCP server requires OAuth authentication, `authUrl` will be returned for user authentication. Connections persist across requests and the Agent will automatically reconnect if the connection is lost.

:::note[Default JSON Schema Validation]

All MCP client connections automatically include JSON schema validation using `CfWorkerJsonSchemaValidator`. This ensures that tool parameters are validated against their schemas before execution, improving reliability and catching errors early. You can override this default by providing custom client options.

:::

**Related:**

- [OAuth handling guide](/agents/guides/oauth-mcp-client)
Expand Down
Loading