MCP Server Setup¶
Model Context Protocol Server verbinden und konfigurieren.
Was ist MCP?¶
MCP (Model Context Protocol) ist ein offener Standard für Tool-Integrationen:
┌─────────────┐ MCP ┌─────────────┐
│ Claude Code │◄────────────►│ MCP Server │
└─────────────┘ └─────────────┘
│
┌──────┴──────┐
▼ ▼
Database External API
Server hinzufügen¶
Via CLI¶
# HTTP Transport (empfohlen für Cloud-Services)
claude mcp add --transport http notion https://mcp.notion.com/mcp
# Stdio Transport (für lokale Server)
claude mcp add --transport stdio my-server -- npx -y @some/mcp-server
# SSE Transport
claude mcp add --transport sse events https://api.example.com/mcp/sse
Via settings.json¶
{
"mcpServers": {
"notion": {
"type": "http",
"url": "https://mcp.notion.com/mcp"
},
"filesystem": {
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-filesystem"],
"env": {
"ALLOWED_PATHS": "/home/user/projects"
}
}
}
}
Via .mcp.json (Projekt-spezifisch)¶
Im Projekt-Root:
{
"mcpServers": {
"project-db": {
"command": "npx",
"args": ["-y", "@my/mcp-postgres"],
"env": {
"DATABASE_URL": "${DATABASE_URL}"
}
}
}
}
Authentifizierung¶
Bearer Token¶
claude mcp add --transport http secure-api https://api.example.com/mcp \
--header "Authorization: Bearer ${API_TOKEN}"
OAuth 2.0¶
Öffnet OAuth-Flow für Server die es unterstützen.
Environment Variables¶
{
"mcpServers": {
"github": {
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-github"],
"env": {
"GITHUB_TOKEN": "${GITHUB_TOKEN}"
}
}
}
}
${VAR} wird aus Environment aufgelöst.
Server verwalten¶
Alle Server anzeigen¶
Server entfernen¶
Server-Status prüfen¶
Transport-Typen¶
| Transport | Use Case | Beispiel |
|---|---|---|
| HTTP | Cloud-Services | Notion, Slack APIs |
| SSE | Event-Streaming | Real-time Updates |
| Stdio | Lokale Server | Filesystem, Database |
Scopes¶
Local (Default)¶
Nur für aktuelles Projekt:
Gespeichert in: ./.claude/mcp.json
User¶
Für alle Projekte des Users:
Gespeichert in: ~/.claude/mcp.json
Project¶
Wird mit Git committed:
Gespeichert in: ./.mcp.json
Troubleshooting¶
Server startet nicht¶
Oder in settings.json:
Connection Closed (Windows)¶
Windows braucht cmd /c Wrapper:
Output zu groß¶
Wenn MCP-Tool mehr als 10K Tokens zurückgibt:
Auth-Fehler¶
Re-authenticate über den OAuth-Flow.
Beliebte MCP Server¶
| Server | Zweck | Installation |
|---|---|---|
| Filesystem | Datei-Operationen | @modelcontextprotocol/server-filesystem |
| GitHub | Issues, PRs, Repos | @modelcontextprotocol/server-github |
| PostgreSQL | DB-Queries | @modelcontextprotocol/server-postgres |
| Slack | Messages, Channels | Via Slack MCP |
| Notion | Pages, Databases | https://mcp.notion.com/mcp |
Mehr unter: github.com/modelcontextprotocol