What is Model Context Protocol?
Model Context Protocol (MCP) is an open standard developed by Anthropic that enables seamless integration between AI applications and external data sources. Think of it as a universal connector that allows Large Language Models (LLMs) to securely access and interact with your tools, databases, and services.
Key Benefits:
- Standardized Integration: One protocol to connect LLMs with any data source
- Security First: Built-in authentication and permission controls
- Bidirectional Communication: LLMs can both read and write data
- Extensible: Easy to build custom integrations
Core Concepts

1. MCP Servers
Lightweight programs that expose specific capabilities (resources, tools, prompts) to LLMs through the MCP protocol.
2. MCP Clients
Applications (like Claude Desktop, IDEs) that connect to MCP servers and enable LLM interaction with external systems.
3. Resources
Data sources that MCP servers can expose (files, databases, APIs)
4. Tools
Functions that LLMs can invoke to perform actions (search, create, update, delete)
5. Prompts
Reusable prompt templates with arguments
Architecture Overview
┌─────────────────┐
│ LLM Client │
│ (Claude/GPT) │
└────────┬────────┘
│
│ MCP Protocol
│
┌────────┴────────┐
│ MCP Server │
│ (Your Tool) │
└────────┬────────┘
│
│
┌────────┴────────┐
│ External Data │
│ (DB/API/Files) │
└─────────────────┘
MCP Quick Reference Cheatsheet
Installation & Setup
Install MCP Inspector (Development Tool)
npx @modelcontextprotocol/inspector
Install Claude Desktop (Official Client)
# macOS
brew install --cask claude
# Windows/Linux: Download from https://claude.ai/download
Configuration
Claude Desktop MCP Configuration
Location: ~/Library/Application Support/Claude/claude_desktop_config.json (macOS)
{
"mcpServers": {
"filesystem": {
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-filesystem", "/path/to/allowed/directory"]
},
"github": {
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-github"],
"env": {
"GITHUB_PERSONAL_ACCESS_TOKEN": "your_token_here"
}
},
"postgres": {
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-postgres", "postgresql://user:pass@localhost/db"]
}
}
}
Popular MCP Servers
| Server | Purpose | Installation Command |
|---|---|---|
| filesystem | Read/write local files | npx @modelcontextprotocol/server-filesystem |
| github | GitHub repository access | npx @modelcontextprotocol/server-github |
| postgres | PostgreSQL database | npx @modelcontextprotocol/server-postgres |
| brave-search | Web search | npx @modelcontextprotocol/server-brave-search |
| slack | Slack workspace access | npx @modelcontextprotocol/server-slack |
| google-drive | Google Drive files | npx @modelcontextprotocol/server-google-drive |
| puppeteer | Browser automation | npx @modelcontextprotocol/server-puppeteer |
| sqlite | SQLite database | npx @modelcontextprotocol/server-sqlite |
Docker MCP Integration
Using Docker MCP Server
# Pull the Docker MCP server
docker pull ghcr.io/docker/model-context-protocol-server
# Run with Docker socket access
docker run -v /var/run/docker.sock:/var/run/docker.sock \
ghcr.io/docker/model-context-protocol-server
Claude Desktop Config for Docker MCP
{
"mcpServers": {
"docker": {
"command": "docker",
"args": ["run", "-i", "--rm",
"-v", "/var/run/docker.sock:/var/run/docker.sock",
"ghcr.io/docker/model-context-protocol-server"]
}
}
}
Building Custom MCP Servers
TypeScript/Node.js Template
import { Server } from "@modelcontextprotocol/sdk/server/index.js";
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
const server = new Server({
name: "my-custom-server",
version: "1.0.0"
}, {
capabilities: {
resources: {},
tools: {}
}
});
// Define a tool
server.setRequestHandler("tools/list", async () => ({
tools: [{
name: "my_tool",
description: "What this tool does",
inputSchema: {
type: "object",
properties: {
query: { type: "string" }
}
}
}]
}));
// Handle tool execution
server.setRequestHandler("tools/call", async (request) => {
if (request.params.name === "my_tool") {
// Your logic here
return {
content: [{ type: "text", text: "Result" }]
};
}
});
const transport = new StdioServerTransport();
await server.connect(transport);
Python Template
from mcp.server import Server
from mcp.server.stdio import stdio_server
app = Server("my-custom-server")
@app.list_tools()
async def list_tools():
return [{
"name": "my_tool",
"description": "What this tool does",
"inputSchema": {
"type": "object",
"properties": {
"query": {"type": "string"}
}
}
}]
@app.call_tool()
async def call_tool(name: str, arguments: dict):
if name == "my_tool":
# Your logic here
return {"content": [{"type": "text", "text": "Result"}]}
if __name__ == "__main__":
stdio_server(app)
Testing Your MCP Server
# Using MCP Inspector
npx @modelcontextprotocol/inspector node path/to/your/server.js
# Test with curl (if using HTTP transport)
curl -X POST http://localhost:3000/mcp \
-H "Content-Type: application/json" \
-d '{"method": "tools/list"}'
Common MCP Methods
| Method | Purpose | Example |
|---|---|---|
initialize | Establish connection | First call to server |
resources/list | List available resources | Get all accessible data |
resources/read | Read specific resource | Fetch file contents |
tools/list | List available tools | Get executable functions |
tools/call | Execute a tool | Run a function |
prompts/list | List prompt templates | Get reusable prompts |
prompts/get | Get specific prompt | Retrieve template |
Security Best Practices
- Least Privilege: Only grant necessary permissions
{ "filesystem": { "args": ["-y", "@modelcontextprotocol/server-filesystem", "/specific/path"] } } - Environment Variables: Never hardcode secrets
{ "env": { "API_KEY": "${API_KEY}" } } - Input Validation: Always validate tool inputs
if (!isValidInput(request.params.arguments)) { throw new Error("Invalid input"); } - Rate Limiting: Implement rate limits for API calls
- Audit Logging: Log all tool executions
- Network Isolation: Use Docker networks for sensitive services
Debugging Tips
# Enable MCP debug logging in Claude Desktop
# Add to config:
{
"mcpServers": {
"your-server": {
"command": "node",
"args": ["server.js"],
"env": {
"DEBUG": "mcp:*"
}
}
}
}
# Check Claude Desktop logs
# macOS:
tail -f ~/Library/Logs/Claude/mcp*.log
# Windows:
# %APPDATA%\Claude\logs\
Docker-Specific MCP Operations
Container Management
# List containers through MCP
# Claude can execute: "Show me all running Docker containers"
# Create container
# Claude can execute: "Create a new nginx container"
# View logs
# Claude can execute: "Show logs for container myapp"
Image Operations
# Pull images
# Claude can execute: "Pull the latest postgres image"
# Build images
# Claude can execute: "Build image from Dockerfile in /path"
# List images
# Claude can execute: "What Docker images do I have?"
Real-World Use Cases
1. Automated Documentation
Connect GitHub + Filesystem MCP to analyze code and generate docs
2. Database Analysis
Use Postgres/SQLite MCP for natural language database queries
3. Infrastructure Management
Docker MCP for container orchestration and debugging
4. Content Management
Google Drive + Slack MCP for cross-platform content workflows
5. Research & Analysis
Brave Search + Filesystem MCP for automated research compilation
Getting Started Checklist
- [ ] Install Claude Desktop or MCP-compatible client
- [ ] Create MCP configuration file
- [ ] Choose and configure your first MCP server
- [ ] Test connection with simple query
- [ ] Build custom server for your specific needs
- [ ] Implement security controls
- [ ] Set up monitoring and logging
Resources
- Official Specification: https://spec.modelcontextprotocol.io
- MCP GitHub: https://github.com/modelcontextprotocol
- Docker MCP Server: https://github.com/docker/model-context-protocol-server
- Community Servers: https://github.com/modelcontextprotocol/servers
- Inspector Tool: https://github.com/modelcontextprotocol/inspector
Contributing to MCP Ecosystem
# Clone server template
git clone https://github.com/modelcontextprotocol/typescript-sdk
cd typescript-sdk/examples/server
# Install dependencies
npm install
# Develop your server
# Test with Inspector
# Publish to npm or Docker Hub
Common Issues & Solutions
| Issue | Solution |
|---|---|
| Server not connecting | Check config file syntax, verify command path |
| Permission denied | Ensure proper file/directory permissions |
| Tool not executing | Validate input schema matches server definition |
| Slow responses | Implement caching, optimize queries |
| Docker socket error | Verify Docker daemon running, check socket permissions |
References
- Awesome MCP List – https://github.com/collabnix/awesome-mcp-lists
- MCP Reddit Feeds – https://collabnix.com/docker/mcp-reddit/