Managed Deep Agents is in beta on LangSmith Cloud and Bring Your Own Cloud (BYOC). Use Managed Deep Agents CLI and SDK v0.10 or later for BYOC.
tools/mcp.py:
Add MCP servers
Use an MCP server when tools already live on a remote MCP server and you want MDA to load them without importing them into the agent definition.1
Declare the servers
Use The module must export a module-level
define_mcp to declare one or more remote servers:tools/mcp.py
mcp. A project has one MCP declaration, so declare every server in it.Managed Deep Agents supports Streamable HTTP ("http") and legacy SSE ("sse") transports. Stdio MCP servers are not supported. Expose a stdio server over HTTP or implement its operation as an authored tool instead.For connection options, see Manage connections.2
Select tools (Optional)
By default, Managed Deep Agents exposes every tool from each server. To expose only selected tools, set an allowlist inside that server’s configuration:To expose every tool except selected tools, replace
include_tools with exclude_tools.You can use both options together. The denylist applies after the allowlist, and the same tool cannot appear in both lists.Selection uses raw MCP tool names before Managed Deep Agents prefixes them. Tool names are prefixed with the server name by default to avoid collisions. For example, the search_docs_by_lang_chain tool from the langchainDocs server is exposed as langchainDocs_search_docs_by_lang_chain.3
Pass credentials (Optional)
If an MCP server requires credentials, declare a connection on the server config and create that connection in the workspace.
- MCP OAuth: For servers that advertise OAuth and support automatic client registration, create with
mda connections create <slug>(inferred from the MCP declaration) ormda connections create <slug> --mcp <url>. You do not supply a client ID or secret. - Opaque secret or general OAuth: For a static API key, or for a BYOT OAuth app you register yourself, create an opaque secret or general OAuth connection, then set the server’s
connectionoption toconnections.get(...).
auth instead of a connection. See Use Tool Gateway tools.Use Tool Gateway tools
Tool Gateway serves the tools and connected accounts your LangSmith workspace manages. Declare a Tool Gateway kit or server with"auth": "langsmith", and the agent calls its tools with the credentials of the person running the agent, or of the agent in an agent-owned schedule, with no connection to create.
Using Tool Gateway with Managed Deep Agents requires
managed-deepagents version 0.10.5 or later, in both the Python and TypeScript packages.tools/mcp.py
Configure MCP servers
Each server supports the following core options:
The MCP definition also accepts these options:
Deployment
mda dev and mda deploy discover the MCP declaration under tools/ and include it in the managed configuration. The declaration is not synced to Context Hub.
When to use MCP connectors
For more information, see Project structure.
Connect these docs to your agent of choice via MCP for real-time answers.

