How agents connect to tools (vertical) and to other agents (horizontal)
Prev: LangChain & LangGraph. Next: OpenClaw & Hermes.
Before MCP: every IDE, every chat app, every agent framework wrote custom integrations for GitHub, Postgres, filesystem...
Before A2A: Agent A could not hand off a subtask to Agent B from another vendor.
By Anthropic. Standard wire format between host (app with LLM) and servers (tool providers).
| Role | Examples | Job |
|---|---|---|
| Host | Claude Desktop, Cursor, IDE | Runs LLM, shows UI |
| Client | Inside host | 1:1 connection to a server |
| Server | filesystem, postgres, github | Exposes tools/resources/prompts |
| Primitive | LLM sees | Example |
|---|---|---|
| tools/list | Callable functions | read_file(path), query(sql) |
| resources/list | Readable URIs | file:///project/README.md |
| prompts/list | Template names | code-review, summarize-diff |
pip install mcp
from mcp.server import Server
from mcp.types import Tool, TextContent
import mcp.server.stdio
app = Server("demo-server")
@app.list_tools()
async def list_tools():
return [Tool(
name="get_policy",
description="Get refund policy text",
inputSchema={"type":"object","properties":{"sku":{"type":"string"}},"required":["sku"]},
)]
@app.call_tool()
async def call_tool(name: str, arguments: dict):
if name == "get_policy":
return [TextContent(type="text", text=f"Refund for {arguments['sku']}: 30 days")]
async def main():
async with mcp.server.stdio.stdio_server() as (read, write):
await app.run(read, write, app.create_initialization_options())
# Run: python server.py — host connects via stdio or HTTP
// ~/.claude/claude_desktop_config.json (Windows: %APPDATA%\Claude\)
{
"mcpServers": {
"demo": {
"command": "python",
"args": ["C:/path/to/server.py"]
},
"filesystem": {
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-filesystem", "C:/allowed/folder"]
}
}
}
| Transport | How host starts server | Typical use |
|---|---|---|
| stdio | Spawns child process; JSON-RPC over stdin/stdout | Claude Desktop, local dev |
| SSE / HTTP | Server runs separately; host connects to URL | Remote team servers, Docker |
Most tutorials use stdio because zero networking setup. Production often wraps the same server in HTTP for auth + scaling.
# langchain-mcp-adapters (conceptual flow)
from langchain_mcp_adapters.client import MultiServerMCPClient
client = MultiServerMCPClient({
"policy": {"command": "python", "args": ["policy_server.py"]},
})
tools = await client.get_tools() # LangChain Tool objects from MCP list_tools
llm_with_mcp = llm.bind_tools(tools)
# Feed into your LangGraph ToolNode — same as native @tool
Pattern: MCP for shared infra plugins; native @tool for business logic only your app needs.
| In-app Python @tool | MCP server | |
|---|---|---|
| Process | Same as agent | Separate process |
| Reuse | This codebase only | Claude Desktop + Cursor + any MCP host |
| Security boundary | Weaker | OS-level separation possible |
| When | Your product backend | Developer tools, shared infra plugins |
By Google. Lets agents discover and delegate to other agents over HTTP.
{
"name": "HotelBookingAgent",
"description": "Books hotel rooms given city and dates",
"url": "https://hotels.example.com/a2a",
"skills": [{
"id": "book_hotel",
"name": "Book Hotel",
"input_schema": {
"type": "object",
"properties": {
"city": {"type": "string"},
"check_in": {"type": "string", "format": "date"}
}
}
}]
}
POST https://hotels.example.com/a2a/tasks
{
"skill_id": "book_hotel",
"input": {"city": "Paris", "check_in": "2025-07-01", "nights": 3},
"context_id": "trip-abc-123"
}
# Response (in progress)
{"task_id": "t-884", "state": "working", "status": "Searching availability..."}
# Poll or webhook when done
{"task_id": "t-884", "state": "completed", "artifacts": [{
"type": "application/json",
"data": {"confirmation": "HTL-991", "hotel": "Le Marais", "total_usd": 420}
}]}
| Situation | Pick |
|---|---|
| All agents in your Python monolith | LangGraph supervisor subgraph |
| Partner runs their agent; you only have URL + contract | A2A Agent Card + Task API |
| Same company, different teams / languages | A2A or internal gRPC — A2A if you want standard discovery |
| Scenario | Protocol |
|---|---|
| Read company wiki, query SQL, call REST API | MCP |
| Delegate to legal-review agent at another company | A2A |
| Cursor coding assistant + local filesystem | MCP |
| Supervisor agent + specialist microservices | A2A (or internal LangGraph) |