Join our Discord Server

What is Model Context Protocol (MCP) – Quick Reference Guide

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

ServerPurposeInstallation Command
filesystemRead/write local filesnpx @modelcontextprotocol/server-filesystem
githubGitHub repository accessnpx @modelcontextprotocol/server-github
postgresPostgreSQL databasenpx @modelcontextprotocol/server-postgres
brave-searchWeb searchnpx @modelcontextprotocol/server-brave-search
slackSlack workspace accessnpx @modelcontextprotocol/server-slack
google-driveGoogle Drive filesnpx @modelcontextprotocol/server-google-drive
puppeteerBrowser automationnpx @modelcontextprotocol/server-puppeteer
sqliteSQLite databasenpx @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

MethodPurposeExample
initializeEstablish connectionFirst call to server
resources/listList available resourcesGet all accessible data
resources/readRead specific resourceFetch file contents
tools/listList available toolsGet executable functions
tools/callExecute a toolRun a function
prompts/listList prompt templatesGet reusable prompts
prompts/getGet specific promptRetrieve template

Security Best Practices

  1. Least Privilege: Only grant necessary permissions { "filesystem": { "args": ["-y", "@modelcontextprotocol/server-filesystem", "/specific/path"] } }
  2. Environment Variables: Never hardcode secrets { "env": { "API_KEY": "${API_KEY}" } }
  3. Input Validation: Always validate tool inputs if (!isValidInput(request.params.arguments)) { throw new Error("Invalid input"); }
  4. Rate Limiting: Implement rate limits for API calls
  5. Audit Logging: Log all tool executions
  6. 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

IssueSolution
Server not connectingCheck config file syntax, verify command path
Permission deniedEnsure proper file/directory permissions
Tool not executingValidate input schema matches server definition
Slow responsesImplement caching, optimize queries
Docker socket errorVerify Docker daemon running, check socket permissions

References

Join our Discord Server