MCP Protocol Tutorial: Connect AI Agents to Real-World Tools
Learn the Model Context Protocol (MCP) — how it works, why it matters, and how to connect AI agents to 73+ tools via JSON-RPC 2.0.
What you will learn
- Understand what MCP is and why AI agents need it
- Learn the JSON-RPC 2.0 message format MCP uses
- Connect to 73+ tools through a single MCP endpoint
- Build your first MCP tool call from scratch
What Is MCP?
The Model Context Protocol (MCP) is a standard for connecting AI agents to external tools and data sources. Think of it as USB-C for AI — one protocol that connects any agent to any tool, regardless of framework.
Without MCP, every agent-tool integration is custom. Agent A uses REST to talk to GitHub, Agent B uses a different SDK for Jira, Agent C has its own Slack connector. MCP standardizes this: one protocol, one endpoint, any tool.
Each agent has custom integrations for each tool. 10 agents × 5 tools = 50 custom connectors to build and maintain.
All agents connect through one MCP endpoint. 73+ tools available instantly. Add a new tool once, every agent can use it.
How MCP Works
MCP uses JSON-RPC 2.0 — a lightweight remote procedure call protocol. The agent sends a JSON request to the MCP server, the server executes the tool, and returns the result. It is stateless, language-agnostic, and easy to debug.
- Client (agent) sends a JSON-RPC request with method name and parameters
- Server validates the request, checks permissions, and executes the tool
- Server returns the result (or an error) as a JSON-RPC response
- Every call is logged with actor context, latency, and cost
Your First MCP Tool Call
import requests
# Call the MCP endpoint
response = requests.post(
"https://dobby-ai.com/api/v1/gateway/mcp/endpoint",
headers={
"Authorization": "Bearer gk_user_your_key_here",
"Content-Type": "application/json"
},
json={
"jsonrpc": "2.0",
"id": 1,
"method": "tools/call",
"params": {
"name": "create_task",
"arguments": {
"title": "Review PR #42",
"description": "Security review needed",
"priority": "high"
}
}
}
)
result = response.json()
print(result["result"]) # Task created successfullyAvailable Tool Categories
- Task Management — create, update, list, assign tasks (7 tools)
- GitHub Integration — PRs, issues, code search, branch management (7 tools)
- Memory & Knowledge — store, retrieve, search agent memories (4 tools)
- Web & Search — search the web, evaluate pages, extract data (7 tools)
- Workflow — manage multi-stage agent workflows (4 tools)
- Scheduling — create, pause, list agent schedules (4 tools)
- Approvals — get pending, approve, reject, request changes (4 tools)
Dobby exposes 73+ MCP tools through a single endpoint. Every tool call goes through the Gateway — authenticated, policy-checked, cost-tracked, and logged. You can use these tools from Claude Desktop, Cursor, VS Code, or any MCP-compatible client.
Discovering Available Tools
# List all available tools
response = requests.post(
"https://dobby-ai.com/api/v1/gateway/mcp/endpoint",
headers={"Authorization": "Bearer gk_user_your_key_here"},
json={
"jsonrpc": "2.0",
"id": 1,
"method": "tools/list"
}
)
tools = response.json()["result"]["tools"]
for tool in tools:
print(f"{tool['name']}: {tool['description']}")MCP vs REST API
Dobby supports both MCP and REST. Use MCP when your agent is an AI that needs to discover and call tools dynamically. Use REST when you are building a traditional integration with known endpoints. Both go through the same Gateway with the same authentication, policies, and audit trail.
MCP is the native protocol for AI agent tools. REST is for traditional integrations. Most teams use both — MCP for agent-to-tool communication, REST for dashboards and automation scripts.