Skip to content

<Mcp />

<Mcp /> grants one Model Context Protocol server to its nearest containing <Agent />. Select exactly one form: a provider-native server name or a transport descriptor returned by defineMcpServer().

import { Agent, AmlRuntime, defineMcpServer, Mcp } from "@aml-jsx/sdk"
import { DeterministicAgentProvider } from "@aml-jsx/sdk/testing"
const documentation = defineMcpServer({
name: "documentation",
transport: {
type: "streamable-http",
url: "https://mcp.example.com/docs",
},
})
const runtime = new AmlRuntime({ agentProvider: new DeterministicAgentProvider() })
await runtime.evaluate(
<Agent>
<Mcp use={documentation} />
Find the relevant API contract.
</Agent>
)

The deterministic provider verifies AML’s descriptor composition without opening the example URL. A live MCP check requires a provider that supports the selected transport and a reachable server; use the provider guides and cookbook below for that path.

For a provider-native server configured outside AML, use <Mcp name="server-name" /> instead.

FormRequired propMeaning
Namedname: stringAsk the Agent provider for a provider-native server with that normalized name.
Configureduse: AmlMcpServerAttach the exact stdio or Streamable HTTP descriptor returned by defineMcpServer().

<Mcp /> accepts no children. Names must be unique inside one <Agent /> and may be restricted by AmlRuntime({ allowedMcpServers }).

  • AML captures and validates the descriptor; the selected Agent provider owns connection and session lifecycle.
  • A stdio server runs where that provider launches it. Do not assume this is the AML host or the active Sandbox without checking the provider guide.
  • Streamable HTTP headers are privileged deployment configuration. Avoid persisting secrets in workflow source, traces, or Workspace files.
  • Provider MCP support differs. Check Codex, GitHub Copilot, OpenCode, or Pi before choosing a form.

See the defineMcpServer() reference, Connect an MCP server, and Tool or MCP? for complete examples and trade-offs.