Hermes Agent: MCP Protocol
Last updated: 2026-08-31
MCP is the USB port for AI tool interconnection — through Model Context Protocol, Hermes Agent can discover and invoke any MCP-compatible tool server, infinitely expanding capability boundaries.
📋 Prerequisites: Lesson 8 Tools and Toolsets, Lesson 15 Plugins
1. What You Will Learn
| # | Content |
|---|---|
| ❶ | MCP protocol concepts and principles |
| ❷ | Hermes' MCP integration |
| ❸ | MCP server configuration |
| ❹ | Tool discovery and invocation |
| ❺ | Custom MCP server development |
2. Story
(1) Pain Point: Every AI Tool Has a Different Interface
Bob uses 5 AI tools, each with its own API format, authentication method, and tool definitions. Integrating a new tool means developing a new adapter.
(2) Solution: MCP Unified Protocol, Plug and Play
Alice connects Hermes to various tool servers via MCP:
# One line of config to connect an MCP server
hermes mcp add filesystem --command "npx @anthropic/mcp-filesystem /home/alice"
hermes mcp add github --command "npx @anthropic/mcp-github"
# Hermes automatically discovers all available tools
hermes mcp tools
# Discovered 15 new tools: read_file, write_file, search_files, create_issue...
3. MCP Protocol Concepts
(1) What is MCP?
MCP (Model Context Protocol) is an open protocol that defines the communication standard between AI applications (clients) and tool servers:
graph LR
A[Hermes Agent<br/>MCP Client] -->|Standard Protocol| B[MCP Server 1<br/>Filesystem]
A -->|Standard Protocol| C[MCP Server 2<br/>GitHub]
A -->|Standard Protocol| D[MCP Server 3<br/>Database]
A -->|Standard Protocol| E[MCP Server N<br/>Custom]
(2) MCP Core Concepts
| Concept | Description | Analogy |
|---|---|---|
| MCP Client | AI application making requests | USB Host |
| MCP Server | Server providing tools | USB Device |
| Tool | Specific operation provided by Server | Device function |
| Resource | Data source provided by Server | Device storage |
| Prompt | Prompt template provided by Server | Device preset |
(3) MCP vs Traditional API
| Dimension | Traditional API | MCP |
|---|---|---|
| Interface format | Custom per service | Unified standard |
| Tool discovery | Manual documentation | Auto-discovery |
| Authentication | Custom implementation | Unified approach |
| Connection method | HTTP/SDK | stdio/SSE |
| Ecosystem | Siloed | Interconnected |
4. Hermes' MCP Integration
(1) Configure MCP
# ~/.hermes/config.yaml
mcp:
enabled: true
# MCP server list
servers:
filesystem:
command: "npx"
args: ["@anthropic/mcp-filesystem", "/home/alice/projects"]
github:
command: "npx"
args: ["@anthropic/mcp-github"]
env:
GITHUB_TOKEN: "${GITHUB_TOKEN}"
database:
command: "python"
args: ["-m", "mcp_server_postgres"]
env:
DATABASE_URL: "${DATABASE_URL}"
brave-search:
command: "npx"
args: ["@anthropic/mcp-brave-search"]
env:
BRAVE_API_KEY: "${BRAVE_API_KEY}"
(2) Connection Management
# Add MCP server
hermes mcp add filesystem --command "npx @anthropic/mcp-filesystem /home/alice"
# List configured servers
hermes mcp list
# Test connection
hermes mcp test filesystem
# View tools provided by server
hermes mcp tools filesystem
# Remove server
hermes mcp remove filesystem
5. Tool Discovery and Invocation
(1) Auto-Discovery
After connecting to an MCP server, Hermes automatically discovers all available tools:
hermes mcp tools
# Output example:
# ┌─────────────────────┬──────────────┬────────────────────────┐
# │ Tool │ Server │ Description │
# ├─────────────────────┼──────────────┼────────────────────────┤
# │ read_file │ filesystem │ Read file contents │
# │ write_file │ filesystem │ Write to file │
# │ search_files │ filesystem │ Search in files │
# │ create_issue │ github │ Create GitHub issue │
# │ list_prs │ github │ List pull requests │
# │ query │ database │ Execute SQL query │
# │ search │ brave-search │ Web search │
# └─────────────────────┴──────────────┴────────────────────────┘
(2) Use in Conversation
me: Read the contents of README.md
Agent: [MCP: filesystem/read_file]
# My Project...
me: Create an Issue on GitHub
Agent: [MCP: github/create_issue]
Title? → "Bug: Login fails on mobile"
✅ Issue #42 created
me: Search for the latest AI news
Agent: [MCP: brave-search/search]
Found 5 results...
(3) Tool Routing
When multiple MCP servers provide similar tools, Hermes auto-routes:
mcp:
routing:
# Prefer MCP tools
prefer_mcp: true
# Priority for same-named tools
priority:
filesystem.read_file: 100 # MCP version preferred
fs_read: 50 # Built-in version secondary
# Conflict resolution
conflict_resolution: "priority" # priority / server_order / ask_user
6. Custom MCP Server Development
(1) Python MCP Server
# mcp_server_custom.py
from mcp.server import Server, Tool
server = Server("custom-tools")
@server.tool("get_weather")
async def get_weather(city: str) -> dict:
"""Get current weather for a city"""
# Custom logic
import httpx
response = httpx.get(f"https://api.weather.com/{city}")
return response.json()
@server.tool("send_notification")
async def send_notification(message: str, channel: str = "default") -> dict:
"""Send a notification to a channel"""
# Custom notification logic
return {"status": "sent", "channel": channel}
if __name__ == "__main__":
server.run()
(2) TypeScript MCP Server
// mcp-server-custom.ts
import { Server, Tool } from "@anthropic/mcp";
const server = new Server("custom-tools");
server.tool("query_database", {
description: "Query the database",
parameters: {
sql: { type: "string", required: true },
limit: { type: "number", default: 100 }
},
async execute({ sql, limit }) {
// Custom database query
const results = await db.query(sql, { limit });
return { rows: results };
}
});
server.run();
(3) Register Custom Server
# Register custom MCP server
hermes mcp add custom-tools \
--command "python mcp_server_custom.py" \
--working-dir /path/to/server
# Or configure in config.yaml
mcp:
servers:
custom-tools:
command: "python"
args: ["mcp_server_custom.py"]
working_dir: "/path/to/server"
env:
API_KEY: "${CUSTOM_API_KEY}"
7. MCP Ecosystem
(1) Official MCP Servers
| Server | Function | Install |
|---|---|---|
| filesystem | File system operations | npx @anthropic/mcp-filesystem |
| github | GitHub operations | npx @anthropic/mcp-github |
| gitlab | GitLab operations | npx @anthropic/mcp-gitlab |
| postgres | PostgreSQL queries | npx @anthropic/mcp-postgres |
| sqlite | SQLite operations | npx @anthropic/mcp-sqlite |
| brave-search | Web search | npx @anthropic/mcp-brave-search |
| google-drive | Google Drive | npx @anthropic/mcp-google-drive |
| slack | Slack operations | npx @anthropic/mcp-slack |
(2) Community MCP Servers
The community maintains 100+ MCP servers covering:
- Project management: Jira, Linear, Asana
- Design tools: Figma, Canva
- Cloud services: AWS, GCP, Azure
- Data analysis: Pandas, Jupyter
- Communication: Twilio, SendGrid
❓ FAQ
hermes mcp test <server> tests connection, --debug shows communication details.📖 Summary
- MCP is the open protocol for AI tool interconnection, like a USB port
- Hermes natively supports MCP Client, connecting to any MCP server
- Auto-discovery of tools with unified invocation interface
- Supports Python/TypeScript custom MCP server development
- Official + community 100+ MCP servers covering various scenarios
📝 Exercises
- Basic (⭐): Configure an MCP server (e.g., filesystem), verify tool discovery and invocation.
- Intermediate (⭐⭐): Configure 3 MCP servers simultaneously, use tools from different servers in conversation.
- Advanced (⭐⭐⭐): Develop a custom MCP server wrapping your commonly-used API, register it with Hermes and verify the complete workflow.