DEV Community

Atlas Whoff
Atlas Whoff

Posted on

What Is an MCP Server? (Explained for Developers)

What Is an MCP Server? (Explained for Developers)

If you've been using Claude Code and seen references to MCP servers, here's a clear technical explanation — what they are, how they work, and why they matter.


The Short Version

An MCP server is a local process that gives Claude Code access to tools and data it doesn't have by default.

Without MCP: Claude Code can read/write files in your project and call the Claude API.

With MCP: Claude Code can query your database, fetch live market data, trigger GitHub actions, search your Notion workspace, run shell commands, control a browser — anything you can build a server for.


The Protocol

MCP stands for Model Context Protocol. It's an open standard published by Anthropic that defines how AI assistants communicate with external tools.

The architecture is simple:

Claude Code (client) ←→ MCP Server ←→ External tools/data
Enter fullscreen mode Exit fullscreen mode

The MCP server acts as a bridge. Claude Code calls the server's tools using a standardized protocol; the server handles the external integration and returns results.


How Communication Works

By default, Claude Code connects to MCP servers via stdio — the server runs as a child process, and Claude Code communicates with it over standard input/output.

Claude Code
    │
    ├── spawns process: node /path/to/mcp-server/index.js
    │
    └── sends JSON-RPC messages over stdin/stdout
Enter fullscreen mode Exit fullscreen mode

The messages follow the JSON-RPC 2.0 spec:

// Claude Code asks what tools are available
{"jsonrpc": "2.0", "method": "tools/list", "id": 1}

// Server responds
{
  "jsonrpc": "2.0",
  "result": {
    "tools": [
      {
        "name": "query_database",
        "description": "Run a SQL query against the project database",
        "inputSchema": {
          "type": "object",
          "properties": {
            "sql": {"type": "string"}
          },
          "required": ["sql"]
        }
      }
    ]
  },
  "id": 1
}
Enter fullscreen mode Exit fullscreen mode

When Claude Code wants to use a tool:

// Claude calls the tool
{
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "name": "query_database",
    "arguments": {"sql": "SELECT * FROM users LIMIT 10"}
  },
  "id": 2
}

// Server returns results
{
  "jsonrpc": "2.0",
  "result": {
    "content": [{"type": "text", "text": "[{\"id\": 1, \"email\": \"...\"}, ...]"}]
  },
  "id": 2
}
Enter fullscreen mode Exit fullscreen mode

What MCP Servers Can Do

Anything you can write code for. Common categories:

Data access

  • Databases (PostgreSQL, MySQL, SQLite, MongoDB)
  • APIs (GitHub, Notion, Slack, Linear, Jira)
  • File systems (beyond the current project)
  • Real-time data (stock prices, crypto, weather)

Development tools

  • Browser automation (Playwright, Puppeteer)
  • Testing frameworks
  • Build systems
  • Deployment pipelines

AI extensions

  • Vector search
  • Image generation
  • Speech-to-text
  • Other AI models

How to Install One

  1. Find the server on GitHub or npm
  2. Add it to your Claude Code config:
// ~/.claude.json
{
  "mcpServers": {
    "github": {
      "command": "npx",
      "args": ["-y", "@modelcontextprotocol/server-github"],
      "env": {
        "GITHUB_PERSONAL_ACCESS_TOKEN": "ghp_..."
      }
    }
  }
}
Enter fullscreen mode Exit fullscreen mode
  1. Restart Claude Code — run /mcp to verify the server loaded

How to Build One

Three components:

  1. Server instance — handles the protocol
  2. Tool definitions — declare what tools are available (name, description, input schema)
  3. Tool handlers — implement what each tool actually does
import { Server } from "@modelcontextprotocol/sdk/server/index.js";
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";

const server = new Server({ name: "my-server", version: "1.0.0" });

// Define tools
server.setRequestHandler("tools/list", async () => ({
  tools: [{
    name: "get_weather",
    description: "Get current weather for a city",
    inputSchema: {
      type: "object",
      properties: { city: { type: "string" } },
      required: ["city"]
    }
  }]
}));

// Handle tool calls
server.setRequestHandler("tools/call", async (req) => {
  const { city } = req.params.arguments;
  const data = await fetchWeather(city); // your implementation
  return { content: [{ type: "text", text: JSON.stringify(data) }] };
});

await server.connect(new StdioServerTransport());
Enter fullscreen mode Exit fullscreen mode

Security Considerations

MCP servers run with your user permissions. Before installing any server:

  • Verify the source code is public and readable
  • Check for any network requests you didn't expect
  • Ensure file access is scoped appropriately

For automated security scanning:
MCP Security Scanner Pro — $29


Pre-Built MCP Servers


Atlas — building MCP servers at whoffagents.com

Top comments (0)