Skip to content
Draft
Show file tree
Hide file tree
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
3 changes: 3 additions & 0 deletions public/__redirects
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,9 @@
/agents/api-reference/sdk/ /agents/api-reference/ 301
/agents/guides/build-mcp-server/ /agents/guides/remote-mcp-server/ 301
/agents/capabilities/mcp-server/ /agents/model-context-protocol/ 301
/agents/model-context-protocol/mcp-agent-api/ /agents/api-reference/mcp-agent-api/ 301
/agents/model-context-protocol/mcp-client-api/ /agents/api-reference/mcp-client-api/ 301
/agents/model-context-protocol/mcp-handler-api/ /agents/api-reference/mcp-handler-api/ 301

# ai
/ai/ /use-cases/ai/ 301
Expand Down
2 changes: 1 addition & 1 deletion src/content/docs/agents/api-reference/agents-api.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -627,7 +627,7 @@ When your Agent connects to MCP servers, it can dynamically discover and use too

:::note

For complete MCP client API documentation, including OAuth configuration and advanced usage, refer to the [Agent — MCP Client API](/agents/model-context-protocol/mcp-client-api/).
For complete MCP client API documentation, including OAuth configuration and advanced usage, refer to the [Agent — MCP Client API](/agents/api-reference/mcp-client-api/).

:::

Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
---
pcx_content_type: concept
title: McpAgent — API Reference
pcx_content_type: reference
title: McpAgent
tags:
- MCP
sidebar:
order: 6
order: 12
---

import { Render, TypeScriptExample } from "~/components";

When you build MCP Servers on Cloudflare, you extend the [`McpAgent` class](https://github.com/cloudflare/agents/blob/5881c5d23a7f4580600029f69307cfc94743e6b8/packages/agents/src/mcp.ts), from the Agents SDK, like this:
When you build [MCP servers](/agents/model-context-protocol/) on Cloudflare, you extend the [`McpAgent` class](https://github.com/cloudflare/agents/blob/5881c5d23a7f4580600029f69307cfc94743e6b8/packages/agents/src/mcp.ts), from the Agents SDK, like this:

<TypeScriptExample>

Expand Down Expand Up @@ -55,7 +55,7 @@ Hibernation is enabled by default and requires no additional configuration.

#### Authentication & Authorization

The McpAgent class provides seamless integration with the [OAuth Provider Library](https://github.com/cloudflare/workers-oauth-provider) for [authentication and authorization](/agents/model-context-protocol/authorization/).
The McpAgent class provides seamless integration with the [OAuth Provider Library](https://github.com/cloudflare/workers-oauth-provider) for [authentication and authorization](/agents/model-context-protocol/authorization/).

When a user authenticates to your MCP server, their identity information and tokens are made available through the `props` parameter, allowing you to:

Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
---
title: McpClient — API reference
pcx_content_type: concept
title: McpClient
pcx_content_type: reference
tags:
- MCP
sidebar:
order: 7
order: 11
---

import { Render, TypeScriptExample } from "~/components";

Your Agent can connect to external [Model Context Protocol (MCP)](https://modelcontextprotocol.io) servers to access tools, resources, and prompts. The `Agent` class provides three methods to manage MCP connections:
Your Agent can connect to external [Model Context Protocol (MCP)](/agents/model-context-protocol/) servers to access tools, resources, and prompts. The `Agent` class provides three methods to manage MCP connections:

<TypeScriptExample>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
---
pcx_content_type: concept
title: createMcpHandler — API Reference
pcx_content_type: reference
title: createMcpHandler
tags:
- MCP
sidebar:
order: 8
order: 13
---

import { Render, TypeScriptExample } from "~/components";

The `createMcpHandler` function creates a fetch handler to serve your MCP server. You can use it as an alternative to the [`McpAgent`](/agents/model-context-protocol/mcp-agent-api) class when you don't need the deprecated SSE transport.
The `createMcpHandler` function creates a fetch handler to serve your [MCP server](/agents/model-context-protocol/). You can use it as an alternative to the [`McpAgent`](/agents/api-reference/mcp-agent-api) class when you don't need the deprecated SSE transport.

It uses an implementation of the MCP Transport interface, `WorkerTransport`, built on top of web standards, which conforms to the [streamable-http](https://modelcontextprotocol.io/specification/draft/basic/transports/#streamable-http) transport specification.

Expand Down Expand Up @@ -86,7 +86,7 @@ const handler = createMcpHandler(server, {

#### authContext

An authentication context object that will be available to MCP tools via [`getMcpAuthContext()`](/agents/model-context-protocol/mcp-handler-api#authentication-context).
An authentication context object that will be available to MCP tools via [`getMcpAuthContext()`](/agents/api-reference/mcp-handler-api#authentication-context).

When using the [`OAuthProvider`](/agents/model-context-protocol/authorization/) from `@cloudflare/workers-oauth-provider`, the authentication context is automatically populated with information from the OAuth flow. You typically don't need to set this manually.

Expand Down Expand Up @@ -494,4 +494,4 @@ server.tool("riskyOperation", "An operation that might fail", {}, async () => {
- [Building MCP Servers](/agents/guides/remote-mcp-server/) — Learn how to build and deploy MCP servers on Cloudflare
- [MCP Tools](/agents/model-context-protocol/tools/) — Add tools to your MCP server
- [MCP Authorization](/agents/model-context-protocol/authorization/) — Authenticate users with OAuth
- [McpAgent API Reference](/agents/model-context-protocol/mcp-agent-api/) — Build stateful MCP servers with the McpAgent class
- [McpAgent API Reference](/agents/api-reference/mcp-agent-api/) — Build stateful MCP servers with the McpAgent class
2 changes: 1 addition & 1 deletion src/content/docs/agents/concepts/agent-class.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,7 @@ Schedules are stored in the `cf_agents_schedules` SQL table. Cron schedules auto

### `this.mcp` and friends

`Agent` includes a multi-server MCP client. This enables your Agent to interact with external services that expose MCP interfaces. The MCP client is properly documented in [MCP client API](/agents/model-context-protocol/mcp-client-api/).
`Agent` includes a multi-server MCP client. This enables your Agent to interact with external services that expose MCP interfaces. The MCP client is properly documented in [MCP client API](/agents/api-reference/mcp-client-api/).

```ts
class MyAgent extends Agent {
Expand Down
2 changes: 1 addition & 1 deletion src/content/docs/agents/guides/connect-mcp-client.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -221,4 +221,4 @@ Connections persist in the Agent's [SQL storage](/agents/api-reference/store-and
## Next steps

- [Handle OAuth flows](/agents/guides/oauth-mcp-client) — Configure OAuth callbacks and error handling
- [McpClient — API reference](/agents/model-context-protocol/mcp-client-api/) — Complete API documentation
- [MCP Client API reference](/agents/api-reference/mcp-client-api/)
2 changes: 1 addition & 1 deletion src/content/docs/agents/guides/human-in-the-loop.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@
inputSchema: z.object({ location: z.string() }),
execute: async ({ location }) => {
console.log(`Getting local time for ${location}`);
await new Promise((res) => setTimeout(res, 2000));

Check warning on line 131 in src/content/docs/agents/guides/human-in-the-loop.mdx

View workflow job for this annotation

GitHub Actions / Semgrep

semgrep.style-guide-potential-date-year

Potential year found. Documentation should strive to represent universal truth, not something time-bound. (add [skip style guide checks] to commit message to skip)
return "10am";
}
});
Expand All @@ -139,7 +139,7 @@
inputSchema: z.object({ location: z.string() }),
execute: async ({ location }) => {
console.log(`Getting local news for ${location}`);
await new Promise((res) => setTimeout(res, 2000));

Check warning on line 142 in src/content/docs/agents/guides/human-in-the-loop.mdx

View workflow job for this annotation

GitHub Actions / Semgrep

semgrep.style-guide-potential-date-year

Potential year found. Documentation should strive to represent universal truth, not something time-bound. (add [skip style guide checks] to commit message to skip)
return `${location} kittens found drinking tea this last weekend`;
}
});
Expand Down Expand Up @@ -657,7 +657,7 @@

- Add [email notifications](/email-routing/email-workers/send-email-workers/) for pending approvals
- Implement approval timeouts with [Schedules](/agents/api-reference/schedule-tasks)
- Connect your Agent to an [MCP server](/agents/model-context-protocol/mcp-client-api/)
- Connect your Agent to an [MCP server](/agents/api-reference/mcp-client-api/)
- Add [analytics](/analytics/analytics-engine/) to track approval patterns
- Implement multi-user approval workflows

Expand Down
2 changes: 1 addition & 1 deletion src/content/docs/agents/guides/oauth-mcp-client.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -379,4 +379,4 @@ export default {
## Related

- [Connect to an MCP server](/agents/guides/connect-mcp-client) — Get started (no OAuth)
- [MCP Client API reference](/agents/model-context-protocol/mcp-client-api/)
- [MCP Client API reference](/agents/api-reference/mcp-client-api/)
Loading