Aller au contenu principal

MCP Servers

Extensions via the Model Context Protocol to extend Claude's capabilities

What is MCP?

The Model Context Protocol (MCP) is an open protocol from Anthropic that allows extending Claude's capabilities with external servers.

┌────────────────────────────────────────────────────────────────┐
│ │
│ Claude Code │
│ │ │
│ │ MCP Protocol │
│ ▼ │
│ ┌─────────────────────────────────────────────────────────┐ │
│ │ MCP Servers │ │
│ │ │ │
│ │ ┌───────────┐ ┌───────────┐ ┌───────────┐ │ │
│ │ │filesystem │ │ github │ │ memory │ │ │
│ │ │ │ │ │ │ │ │ │
│ │ │ File │ │ GitHub │ │ Persistent│ │ │
│ │ │ access │ │ API │ │ memory │ │ │
│ │ └───────────┘ └───────────┘ └───────────┘ │ │
│ │ │ │
│ │ ┌───────────┐ ┌───────────┐ ┌───────────┐ │ │
│ │ │ postgres │ │ fetch │ │ puppeteer │ │ │
│ │ │ │ │ │ │ │ │ │
│ │ │ Database │ │ HTTP │ │ Headless │ │ │
│ │ │ │ │ requests │ │ browser │ │ │
│ │ └───────────┘ └───────────┘ └───────────┘ │ │
│ │ │ │
│ └─────────────────────────────────────────────────────────┘ │
│ │
└────────────────────────────────────────────────────────────────┘

Configuration

MCP servers are configured in .mcp.json at the root of the project:

{
"mcpServers": {
"filesystem": {
"command": "npx",
"args": ["-y", "@anthropic/mcp-server-filesystem", "/path/to/allowed/dir"],
"enabled": true
},
"github": {
"command": "npx",
"args": ["-y", "@anthropic/mcp-server-github"],
"env": {
"GITHUB_TOKEN": "ghp_xxxx"
},
"enabled": true
}
}
}

Available servers

Official Anthropic servers

ServerDescriptionPackage
filesystemAdvanced file access@anthropic/mcp-server-filesystem
githubGitHub integration@anthropic/mcp-server-github
memoryPersistent memory@anthropic/mcp-server-memory
fetchHTTP requests@anthropic/mcp-server-fetch
postgresPostgreSQL database@anthropic/mcp-server-postgres
sqliteSQLite database@anthropic/mcp-server-sqlite
puppeteerBrowser automation@anthropic/mcp-server-puppeteer

Community servers

ServerDescriptionSource
notionNotion integrationCommunity
slackSlack integrationCommunity
linearLinear integrationCommunity

Configuration examples

Filesystem

Extended access to the filesystem:

{
"mcpServers": {
"filesystem": {
"command": "npx",
"args": [
"-y",
"@anthropic/mcp-server-filesystem",
"/home/user/projects",
"/home/user/documents"
],
"enabled": true
}
}
}

Capabilities:

  • Read/write files outside the project
  • Navigate the directory tree
  • Search for files

GitHub

Full integration with GitHub:

{
"mcpServers": {
"github": {
"command": "npx",
"args": ["-y", "@anthropic/mcp-server-github"],
"env": {
"GITHUB_TOKEN": "ghp_xxxxxxxxxxxx"
},
"enabled": true
}
}
}

Capabilities:

  • Create issues and PRs
  • Read repo content
  • Manage branches
  • View workflows

Memory

Persistent memory across sessions:

{
"mcpServers": {
"memory": {
"command": "npx",
"args": ["-y", "@anthropic/mcp-server-memory"],
"enabled": true
}
}
}

Capabilities:

  • Save information
  • Retrieve previous contexts
  • Build a knowledge graph

PostgreSQL

Connection to a PostgreSQL database:

{
"mcpServers": {
"postgres": {
"command": "npx",
"args": ["-y", "@anthropic/mcp-server-postgres"],
"env": {
"DATABASE_URL": "postgresql://user:pass@localhost:5432/db"
},
"enabled": true
}
}
}

Capabilities:

  • Run SQL queries
  • Explore the schema
  • Analyze data

Fetch

External HTTP requests:

{
"mcpServers": {
"fetch": {
"command": "npx",
"args": ["-y", "@anthropic/mcp-server-fetch"],
"enabled": true
}
}
}

Capabilities:

  • GET/POST/PUT/DELETE
  • Custom headers
  • Cookie handling

Puppeteer

Browser automation:

{
"mcpServers": {
"puppeteer": {
"command": "npx",
"args": ["-y", "@anthropic/mcp-server-puppeteer"],
"enabled": true
}
}
}

Capabilities:

  • Navigate web pages
  • Take screenshots
  • Execute JavaScript
  • Fill out forms

Configuration structure

Full format

{
"mcpServers": {
"server-name": {
"command": "command",
"args": ["arg1", "arg2"],
"env": {
"VAR": "value"
},
"enabled": true
}
}
}

Fields

FieldDescriptionRequired
commandCommand to executeYes
argsCommand argumentsNo
envEnvironment variablesNo
enabledEnable/disableNo (default: true)

Enable/Disable

Via the file

{
"mcpServers": {
"github": {
"enabled": false // Disabled
}
}
}
{
"mcpServers": {
"filesystem": {
"command": "npx",
"args": ["-y", "@anthropic/mcp-server-filesystem", "."],
"enabled": false
},
"memory": {
"command": "npx",
"args": ["-y", "@anthropic/mcp-server-memory"],
"enabled": false
},
"github": {
"command": "npx",
"args": ["-y", "@anthropic/mcp-server-github"],
"env": {
"GITHUB_TOKEN": ""
},
"enabled": false
}
}
}

Create an MCP server

Basic structure

import { Server } from '@anthropic/mcp-server';

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

// Define tools
server.tool('my_tool', {
description: 'Tool description',
parameters: {
type: 'object',
properties: {
param1: { type: 'string' }
}
},
handler: async (params) => {
// Implementation
return { result: '...' };
}
});

server.start();

Official documentation

Security

Best practices

  1. Tokens as environment variables

    {
    "env": {
    "GITHUB_TOKEN": "${GITHUB_TOKEN}"
    }
    }
  2. Restrict filesystem paths

    {
    "args": ["-y", "@anthropic/mcp-server-filesystem", "/specific/path"]
    }
  3. Disable unused servers

    {
    "enabled": false
    }
  4. Do not commit secrets

    # .gitignore
    .mcp.json.local

Risks

ServerRiskMitigation
filesystemAccess to sensitive filesLimit paths
postgresDatabase accessRead-only user
puppeteerCode executionSandboxing

See also