--- title: "MCP" description: "Configure MCP servers for agent sessions." sidebarTitle: "MCP" icon: "plug" --- MCP (Model Context Protocol) servers extend agents with tools and external context. ## Configuring MCP servers The HTTP config endpoints let you store/retrieve MCP server configs by directory + name. ```ts // Create MCP config await sdk.setMcpConfig( { directory: "/workspace", mcpName: "github", }, { type: "remote", url: "https://example.com/mcp", }, ); // Create a session using the configured MCP servers const session = await sdk.createSession({ agent: "claude", cwd: "/workspace", }); await session.prompt([ { type: "text", text: "Use available MCP servers to help with this task." }, ]); // List MCP configs const config = await sdk.getMcpConfig({ directory: "/workspace", mcpName: "github", }); console.log(config.type); // Delete MCP config await sdk.deleteMcpConfig({ directory: "/workspace", mcpName: "github", }); ``` ## Config fields ### Local server | Field | Description | |---|---| | `type` | `local` | | `command` | executable path | | `args` | array of CLI args | | `env` | environment variable map | | `cwd` | working directory | | `enabled` | enable/disable server | | `timeoutMs` | timeout override | ### Remote server | Field | Description | |---|---| | `type` | `remote` | | `url` | MCP server URL | | `transport` | `http` or `sse` | | `headers` | static headers map | | `bearerTokenEnvVar` | env var name to inject in auth header | | `envHeaders` | header name to env var map | | `oauth` | optional OAuth config object | | `enabled` | enable/disable server | | `timeoutMs` | timeout override | ## Custom MCP servers To bundle and upload your own MCP server into the sandbox, see [Custom Tools](/custom-tools).