13.5 MCP Servers: External System Integration
Course: Claude Code - Enterprise Development Section: Extending Claude Code Video Length: 4-5 minutes Presenter: Daniel Treasure
Opening Hook
"You've extended Claude Code with agents, skills, and plugins. Now, the final frontier: what if you could connect Claude to any external system—databases, APIs, third-party services? That's what MCP Servers do. They're the bridge between Claude Code and the world. Let me show you how they work and how to build one."
Key Talking Points
1. What Is an MCP Server?
What to say: "MCP—Model Context Protocol—is a standardized way to expose external systems to Claude. An MCP Server wraps a service (GitHub, Notion, a database, your internal API) and exposes its operations as tools. Claude Code connects to MCP Servers, and suddenly Claude can read from Notion, query your database, create GitHub issues, all through a standardized interface. The protocol handles credentials, permissions, and error handling."
What to show on screen: - Conceptual diagram: Claude Code ↔ MCP Protocol ↔ MCP Server ↔ External System - Show examples: GitHub MCP Server (read repos, create issues), Notion MCP Server (read/write pages), PostgreSQL MCP Server (query database) - Highlight: the MCP Server is the adapter layer
2. MCP Servers Already Exist
What to say: "Before you build, check if one exists. The MCP ecosystem is growing. There are servers for GitHub, Notion, Google Drive, AWS, databases, APIs, and more. If Anthropic or the community has already built what you need, install it and use it. Building is for when you need to integrate something custom or proprietary."
What to show on screen: - Show the MCP registry or marketplace (conceptual) - List 10-15 available servers: GitHub, Notion, Postgres, MySQL, S3, Linear, Slack, etc. - Show how to discover servers - Explain: installing vs. building
3. How MCP Servers Connect: Transports
What to say: "MCP Servers communicate with Claude Code over a transport. There are three: stdio (local, secure, simplest), HTTP (remote, flexible, requires auth), and SSE (deprecated, don't use it for new work). Most local development uses stdio—your server runs locally, Claude Code talks to it over stdin/stdout. Remote servers use HTTP with API keys or OAuth. Pick based on where the server runs and your security model."
What to show on screen: - Diagram: Stdio transport (local process) vs. HTTP transport (remote endpoint) - Show configuration: local server path in settings.json vs. HTTP URL + credentials - Emphasize: credentials are stored outside the model, never seen by Claude
4. Building an MCP Server: Protocol and Schema
What to say: "To build an MCP Server, you implement the protocol: define operations with input/output schemas (JSON Schema), handle authentication, and respond to requests. Each operation is a tool Claude can call. The schema tells Claude what inputs it expects and what it returns. You handle credentials securely, separate from the model. You manage rate limits, error handling, everything a real API needs."
What to show on screen: - Show MCP Server skeleton in a language (Python, Node, Go) - Walk through: 1) Define an operation/tool with schema, 2) Handle the request, 3) Return structured result - Show example: "GetDatabaseRecords" operation, takes table name and filters, returns JSON array - Emphasize: the schema is the contract
5. Using Claude Code as an MCP Server
What to say: "Advanced but cool: you can expose Claude Code itself as an MCP Server using the claude mcp serve command. This means other AI systems or external tools can delegate work to Claude Code. It's the ultimate extensibility—Claude Code becomes both a consumer of MCP Servers and a provider of functionality."
What to show on screen:
- Show terminal command: claude mcp serve
- Explain: this starts Claude Code as an MCP Server on a local or remote transport
- Use case: external workflow tool calls Claude Code for code generation, Claude Code calls database MCP Server for data
- Show the chain: Workflow → Claude Code MCP Server → Database MCP Server
Demo Plan
- (0:45) Explain MCP servers conceptually with diagram (Claude Code ↔ MCP Protocol ↔ External System)
- (1:30) Show how to install/configure an existing MCP Server (e.g., GitHub) in settings.json
- (2:15) Trigger Claude Code to use the MCP Server tool; show seamless integration
- (3:00) Walk through building a simple MCP Server skeleton: define operation, schema, handler
- (3:45) Discuss transports: stdio for local, HTTP for remote, credentials outside the model
- (4:30) Show
claude mcp servecommand; explain use cases for exposing Claude Code as a service - (5:00) Recap: MCP is the final layer of extensibility
Code Examples & Commands
Installing an existing MCP Server (settings.json)
{
"mcpServers": {
"github": {
"command": "node",
"args": ["path/to/github-mcp-server/dist/index.js"],
"env": {
"GITHUB_TOKEN": "${GITHUB_TOKEN}"
}
},
"notion": {
"command": "python",
"args": ["-m", "notion_mcp_server"],
"env": {
"NOTION_TOKEN": "${NOTION_TOKEN}"
}
},
"postgres": {
"command": "./postgres-mcp-server",
"args": ["--connection", "postgresql://user:pass@localhost/mydb"]
}
}
}
Simple MCP Server skeleton (Python/FastMCP)
from mcp.server.fastmcp import FastMCP
server = FastMCP("my-mcp-server")
@server.tool()
def get_database_records(table: str, limit: int = 10) -> list[dict]:
"""Fetch records from a database table."""
# Credentials loaded from env, never passed by Claude
db_connection = os.getenv("DB_CONNECTION")
# Query the database
results = query_database(db_connection, f"SELECT * FROM {table} LIMIT {limit}")
# Return structured result
return [dict(row) for row in results]
@server.tool()
def create_issue(title: str, description: str, labels: list[str] = None) -> dict:
"""Create an issue in external tracking system."""
# Handle credentials securely
api_token = os.getenv("ISSUE_TRACKER_TOKEN")
# Make API call
issue = create_issue_in_system(api_token, title, description, labels)
return {
"id": issue["id"],
"url": issue["url"],
"status": "created"
}
if __name__ == "__main__":
server.run()
MCP Server with JSON Schema (detailed example)
from mcp.server.fastmcp import FastMCP
from pydantic import BaseModel, Field
server = FastMCP("database-mcp")
class QueryFilters(BaseModel):
table: str = Field(..., description="Database table name")
columns: list[str] = Field(default=["*"], description="Columns to select")
where_clause: str = Field(default="", description="WHERE clause (optional)")
limit: int = Field(default=100, description="Row limit")
@server.tool()
def query_database(filters: QueryFilters) -> dict:
"""Execute a SELECT query against the database."""
db = get_database_connection()
query = f"SELECT {', '.join(filters.columns)} FROM {filters.table}"
if filters.where_clause:
query += f" WHERE {filters.where_clause}"
query += f" LIMIT {filters.limit}"
results = db.execute(query).fetchall()
return {
"row_count": len(results),
"rows": [dict(row) for row in results]
}
if __name__ == "__main__":
server.run()
Exposing Claude Code as an MCP Server
# Start Claude Code as an MCP Server on stdio (local)
claude mcp serve
# Or expose over HTTP (for remote clients)
claude mcp serve --transport http --port 5000
# External system now treats Claude Code as a service:
# POST http://localhost:5000/mcp (MCP protocol over HTTP)
Connecting to a remote HTTP-based MCP Server
{
"mcpServers": {
"custom-api": {
"command": "http",
"url": "https://mcp-server.company.com",
"auth": {
"type": "bearer",
"token": "${MCP_API_KEY}"
}
}
}
}
Gotchas & Tips
Credentials are never sent to Claude. The MCP Server handles auth. Claude Code passes the request to the server, the server authenticates, processes, and returns results. This is the security boundary.
Schema matters. If your MCP Server has poor schemas, Claude won't know how to use the tool. Spend time writing clear descriptions for inputs and outputs. JSON Schema is strict; test with sample data before deploying.
Stdio is local-only, HTTP is flexible. Stdio is faster and simpler for local development. Use stdio for servers running on your machine. Use HTTP for remote servers, cloud deployments, or multi-machine architectures.
MCP Servers can fail. If a server crashes or times out, Claude Code logs an error and continues. Build retry logic and timeouts into your server. Test failure modes.
Rate limiting and caching. External systems have rate limits. If Claude makes 100 requests in 10 seconds, you'll hit them. Consider caching frequently-accessed data. Implement backoff and retry logic in the server.
The MCP registry is community-driven. Before building, search the registry. If your use case is common, someone has already solved it.
Transports are pluggable. New transports may emerge (gRPC, WebSocket). The protocol is stable; transports are implementation details.
Lead-out
"MCP Servers are the final extensibility layer. Agents handle complexity. Skills encapsulate procedures. Plugins bundle functionality. MCP Servers bridge to the external world. Together, they form a complete enterprise AI platform. You've now seen the full picture: specialized agents, automated guardrails, predefined skills, reusable plugins, and external system integration. That's how you scale Claude Code across an organization—not by expanding prompts, but by architecting a system that's composable, auditable, and maintainable. Go build something amazing."
Reference URLs
- Model Context Protocol (MCP) specification
- MCP registry and available servers
- FastMCP Python framework (building servers)
- HTTP and stdio transport documentation
- Security best practices for MCP Servers
- OAuth and credential management patterns
Prep Reading
- MCP protocol deep dive
- Building production-grade MCP Servers
- Testing and debugging MCP Servers
- Deploying remote MCP Servers
- Security and permission models
- Performance tuning and caching
Notes for Daniel: This is the most technical video in the series. Have a working MCP Server example ready (can be simple—even a mock one that returns hardcoded data). If possible, show a real integration: install an existing GitHub or Notion MCP Server and trigger Claude Code to use it. The claude mcp serve command demo is optional but impressive if you have time. Pre-create the Python server skeleton so you don't spend time on boilerplate. Emphasize the credential security aspect because that's the most important architectural difference from naive tool use. If you go over time, skip the HTTP transport details—they're important but secondary to understanding what MCP servers do.