Daniele Messi.
Essay · 8 min read

MCP Servers Explained: How to Connect AI to Your Tools

What are MCP servers, how they work, and how to use them with Claude Code. A practical guide with real examples for developers.

By Daniele Messi · April 5, 2026 · Geneva

Key Takeaways

  • MCP (Model Context Protocol) is an open standard designed to standardize how AI assistants connect to external tools and data, functioning as a “USB port for AI.”
  • It replaces the need for numerous custom integrations with a single, unified protocol, significantly streamlining development efforts for AI applications.
  • The MCP architecture comprises three core components: the MCP Host (the AI application), the MCP Server (the tool integration), and the Transport layer, which utilizes either stdio or SSE for communication.
  • Developers using tools like Claude Code can leverage MCP to grant their AI access to diverse platforms such as Slack, GitHub, databases, and monitoring dashboards through a consistent interface.

What Is MCP and Why Should You Care

Model Context Protocol (MCP) is an open standard that lets AI assistants connect to external tools and data sources. Think of it as a USB port for AI — a standardized way to plug in databases, APIs, file systems, and custom tools so the AI can actually do things beyond generating text.

Before MCP, every integration was custom. Want your AI to query a database? Write a specific plugin. Want it to read your calendar? Build another one. MCP replaces this fragmentation with a single protocol that any tool can implement.

For developers using Claude Code, MCP means you can give your AI assistant access to Slack, GitHub, databases, monitoring dashboards, and anything else you build a server for — all through a consistent interface.

How MCP Works

The architecture has three parts:

MCP Host — the AI application (Claude Code, Claude Desktop, or your own app). It sends requests and receives responses.

MCP Server — a lightweight process that exposes tools, resources, and prompts. Each server focuses on one integration.

Transport — how the host and server communicate. Two options: stdio (local processes) or SSE (remote HTTP connections).

┌─────────────┐     stdio/SSE     ┌──────────────┐
│  Claude Code │ ◄──────────────► │  MCP Server   │
│  (Host)      │                   │  (e.g. Slack) │
└─────────────┘                   └──────────────┘

A single host can connect to multiple servers simultaneously. Claude Code already supports this — you can have a GitHub server, a database server, and a custom server all running at once.

Setting Up Your First MCP Server

The fastest way to start is with an existing community server. Let us connect Claude Code to a SQLite database.

Install the SQLite MCP server:

npx @anthropic-ai/create-mcp-server

Or add it manually to your Claude Code configuration. Edit ~/.claude/settings.json:

{
  "mcpServers": {
    "sqlite": {
      "command": "npx",
      "args": ["-y", "@anthropic-ai/mcp-server-sqlite", "/path/to/your/database.db"]
    }
  }
}

Restart Claude Code. You can now ask it to query your database directly:

“Show me all users who signed up in the last 7 days”

Claude will use the MCP tools to run the actual SQL query and return results.

Building a Custom MCP Server

Community servers cover common use cases, but the real power is building your own. Here is a minimal MCP server in TypeScript that exposes a weather tool:

import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
import { z } from "zod";

const server = new McpServer({
  name: "weather",
  version: "1.0.0",
});

server.tool(
  "get-weather",
  "Get current weather for a city",
  { city: z.string().describe("City name") },
  async ({ city }) => {
    const res = await fetch(
      `https://wttr.in/${encodeURIComponent(city)}?format=j1`
    );
    const data = await res.json();
    const current = data.current_condition[0];

    return {
      content: [{
        type: "text",
        text: `${city}: ${current.temp_C}°C, ${current.weatherDesc[0].value}`
      }]
    };
  }
);

const transport = new StdioServerTransport();
await server.connect(transport);

Register it in your settings:

{
  "mcpServers": {
    "weather": {
      "command": "node",
      "args": ["path/to/weather-server.js"]
    }
  }
}

Now Claude Code can check the weather as part of its workflow. The pattern scales to anything: internal APIs, CRMs, deployment pipelines, monitoring systems.

MCP Concepts: Tools, Resources, and Prompts

MCP servers can expose three types of capabilities:

Tools are functions the AI can call. They take parameters and return results. Examples: run a database query, send a Slack message, create a GitHub issue.

server.tool("create-issue", "Create a GitHub issue", {
  title: z.string(),
  body: z.string(),
  repo: z.string(),
}, async ({ title, body, repo }) => {
  // Call GitHub API
});

Resources are data the AI can read. They are like files or endpoints the AI can access on demand. Examples: a configuration file, live metrics, documentation.

server.resource(
  "config",
  "app://config",
  async () => ({
    contents: [{
      uri: "app://config",
      text: JSON.stringify(appConfig),
      mimeType: "application/json",
    }]
  })
);

Prompts are reusable prompt templates the server provides. They help standardize how the AI interacts with the tool.

For most practical use cases, you will primarily build tools.

Practical MCP Use Cases

Here are real scenarios where MCP servers add immediate value:

Database assistant: connect to PostgreSQL or SQLite. Ask Claude to analyze data, find anomalies, or generate reports without writing SQL manually.

Deployment helper: wrap your CI/CD pipeline. Ask Claude to check build status, trigger deployments, or roll back a release.

Documentation search: index your internal docs. Claude can search and reference them when answering questions about your codebase.

Monitoring bridge: connect to Grafana or your metrics system. Ask Claude about error rates, latency trends, or capacity planning.

Content management: connect to your CMS API. Ask Claude to draft, edit, and publish content directly.

Security Considerations

MCP servers run with the permissions of their process. A few rules:

  • Principle of least privilege: give each server only the access it needs. A read-only database server should not have write permissions.
  • No secrets in config files: use environment variables for API keys and tokens.
  • Audit tool calls: MCP servers log every tool invocation. Review these logs regularly.
  • Network isolation: if a server accesses sensitive systems, run it in a container or restrict its network access.
{
  "mcpServers": {
    "database": {
      "command": "node",
      "args": ["db-server.js"],
      "env": {
        "DB_URL": "postgresql://readonly:pass@localhost/mydb"
      }
    }
  }
}

The MCP Ecosystem Today

The ecosystem is growing fast. Anthropic maintains official servers for common integrations. The community has built hundreds more. Key resources:

  • Official servers: filesystem, GitHub, GitLab, Slack, Google Drive, PostgreSQL, SQLite, Puppeteer
  • Community registry: browse available servers and their capabilities
  • SDK: available in TypeScript, Python, Java, and Kotlin
  • Claude Code: has built-in MCP support, no additional setup needed beyond server configuration

Getting Started Checklist

  1. Pick one integration that would save you time daily
  2. Check if a community MCP server already exists for it
  3. If not, build a minimal server with one tool using the SDK
  4. Add it to your Claude Code configuration
  5. Test it, iterate, add more tools as needed

The best MCP server is the one that removes a repetitive task from your workflow. Start small, start specific, and expand from there.

FAQ

What is the primary purpose of Model Context Protocol (MCP)?

MCP is an open standard that allows AI assistants to connect to external tools and data sources in a standardized way. It aims to replace the fragmentation of custom integrations with a single, consistent protocol, functioning like a “USB port for AI.”

How does MCP simplify AI integration for developers?

Before MCP, integrating AI with a new tool required building a specific plugin for each instance. MCP eliminates this by providing a universal protocol that any tool can implement, enabling AI applications like Claude Code to access various services through a consistent interface.

What are the main components of the MCP architecture?

The MCP architecture consists of three primary parts: the MCP Host, which is the AI application sending requests; the MCP Server, a lightweight process exposing specific tools or resources; and the Transport layer, which handles communication via stdio for local processes or SSE for remote HTTP connections.

What kinds of external tools can AI connect to using MCP Servers?

MCP Servers enable AI to connect to a wide range of external tools and data sources. This includes databases, APIs, file systems, and specific applications like Slack, GitHub, and monitoring dashboards, allowing the AI to perform actions beyond just generating text.

Keep reading.