This page covers MCP configuration for the Agent SDK. To add MCP servers to the Claude Code CLI so they load in every project, see MCP installation scopes.
Quickstart
This example connects to the Claude Code documentation MCP server using HTTP transport and usesallowedTools with a wildcard to permit all tools from the server.
Add an MCP server
You can configure MCP servers in code when callingquery(), or in a .mcp.json file loaded via settingSources.
In code
Pass MCP servers directly in themcpServers option: