MCP

Querying live Kern docs through a Model Context Protocol server.

The MCP agent is twenty lines of code that answers questions about Kern using the official docs MCP server. The docs site exposes an MCP endpoint, the agent connects to it, and the answers stay current without a local knowledge base, embeddings, or an ingest pipeline.

1from kern.agent import Agent
2from kern.tools.mcp import MCPTools
3
4mcp_agent = Agent(
5 id="mcp",
6 name="MCP",
7 model=MODEL,
8 db=agent_db,
9 tools=[MCPTools(url="https://kern.ndx.rocks/mcp")],
10 instructions=INSTRUCTIONS,
11 add_history_to_context=True,
12)

That's the whole agent. MCPTools(url=...) wraps the MCP server's tools so the agent can call search_docs, read_page, etc. as if they were native tools.

What MCP gives you

Model Context Protocol is a standard for exposing tools, resources, and prompts to agents. Any MCP server (stdio, SSE, or streamable-HTTP transport) can be wrapped with MCPTools:

1# Hosted server (HTTP)
2MCPTools(url="https://mcp.github.com/mcp")
3
4# Local subprocess (stdio)
5MCPTools(command="uvx", args=["mcp-server-time"])
6
7# With auth
8MCPTools(url="https://mcp.linear.app", headers={"Authorization": "Bearer ..."})

Tool discovery happens at connect time. The agent's instructions get a list of available tools and their schemas. The agent calls them like any other tool.

When to use MCP vs writing a tool

SituationPick
The service already has an MCP server (Linear, GitHub, Notion, etc.)MCP
You want tool discovery to update without redeployingMCP
You're integrating with internal systemsWrite a tool, simpler
You need fine-grained control over arguments / response shapeWrite a tool

For most third-party services, MCP wins. A @tool function is more direct for first-party data like your database or internal APIs.

See it in action

1@MCP what changed in kern 2.6?
2@MCP how do I add memory to an agent?
3@MCP what providers does Kern support natively?

Each query triggers an MCP search_docs call against kern.ndx.rocks/mcp. The agent reads the matching pages, synthesizes an answer, cites the source.

MCP as a context provider in Scout

The MCP agent uses MCP as a tool. Scout's MCPContextProvider goes one step further: any MCP server becomes a registered context. Scout calls query_mcp_<slug> and a sub-agent answers from that server's tools. Same protocol, different ergonomic layer.

Source: agents/mcp/agent.py

Next

Dependencies →