Agent
MCP
MCP (Model Context Protocol) servers extend agents with tools and external context.
Configuring MCP servers
Section titled “Configuring MCP servers”The HTTP config endpoints let you store/retrieve MCP server configs by directory + name.
// Create MCP configawait sdk.setMcpConfig( { directory: "/workspace", mcpName: "github", }, { type: "remote", url: "https://example.com/mcp", },);
// Create a session using the configured MCP serversconst 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 configsconst config = await sdk.getMcpConfig({ directory: "/workspace", mcpName: "github",});
console.log(config.type);
// Delete MCP configawait sdk.deleteMcpConfig({ directory: "/workspace", mcpName: "github",});Config fields
Section titled “Config fields”Local server
Section titled “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
Section titled “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
Section titled “Custom MCP servers”To bundle and upload your own MCP server into the sandbox, see Custom Tools.