External capabilities join the same routing as native tools
What You’ll Learn
- What MCP (Model Context Protocol) is and why it matters
- How external tools integrate through the same dispatch map
- How plugins extend the agent without modifying core code
The Problem
Your agent has 10 tools — bash, read, write, edit, task, etc. But what about database queries? Browser automation? Image generation? You can’t add every possible tool to the core codebase.
The Solution
MCP servers expose external capabilities through a standard protocol. Plugins register dynamically. Both join the same TOOL_HANDLERS dispatch map:
+------------------+
| TOOL_HANDLERS |
| { |
| bash: native |
| read: native |
+----------+ | db_query: mcp | +----------+
| MCP | -----> | browser: mcp | <----- | Plugin |
| Server A | | img_gen: plugin| | Loader |
+----------+ | } | +----------+
+------------------+
How It Works
-
MCP servers run as separate processes, exposing tools via JSON-RPC over stdio or HTTP.
-
A
PluginLoaderdiscovers and registers external tool handlers:
class PluginLoader:
def load_mcp_server(self, command: str):
process = subprocess.Popen(command.split(), stdin=PIPE,
stdout=PIPE)
tools = discover_tools(process)
for tool in tools:
TOOL_HANDLERS[tool.name] = lambda **kw, p=process: \
call_mcp_tool(p, tool.name, kw)
- External tools go through the same permission pipeline, same hook system, same result format.
What Changed From s18
| Component | Before (s18) | After (s19) |
|---|---|---|
| Tools | Fixed set | Extensible via MCP/plugin |
| Capabilities | Local filesystem + bash | Any external service |
| Routing | Native tools only | Same dispatch map |
| Permissions | Native only | External tools get same |
Try It
cd learn-claude-code
python agents/s19_mcp_plugin.py
Start an MCP server for SQLite and query a databaseLoad a plugin for image generation and create an iconList all available tools — both native and external
Key Takeaway
External capabilities join the same routing, permission, and result-append path as native tools. MCP and plugins don’t bypass the harness — they extend it through the same interfaces.