mcp-servers
# MCP Servers in Claude Code
What this skill does
# MCP Servers in Claude Code
Complete guide to Model Context Protocol server configuration and usage.
## Overview
MCP (Model Context Protocol) allows Claude Code to connect to external servers that provide additional tools, resources, and capabilities. Supports 300+ external tools and services.
## Transport Types
| Transport | Description | Recommended |
|-----------|-------------|-------------|
| `http` | HTTP-based (streamable) | Yes (recommended) |
| `sse` | Server-Sent Events | Deprecated |
| `stdio` | Local process via stdin/stdout | For local servers |
## Adding MCP Servers via CLI
```bash
# HTTP server (recommended)
claude mcp add --transport http github https://api.githubcopilot.com/mcp/
# SSE server (deprecated)
claude mcp add --transport sse asana https://mcp.asana.com/sse
# Local stdio server
claude mcp add --transport stdio my-db -- npx -y @some/package
# With environment variables
claude mcp add --transport stdio -e AIRTABLE_API_KEY=YOUR_KEY airtable -- npx -y airtable-mcp-server
# With scope
claude mcp add --scope project server-name -- command args
# List configured servers
claude mcp list
# Get server details
claude mcp get server-name
# Remove server
claude mcp remove server-name
```
## Installation Scopes
| Scope | Storage | Shared |
|-------|---------|--------|
| `local` (default) | `~/.claude.json` | No (personal, this project) |
| `project` | `.mcp.json` | Yes (version controlled) |
| `user` | `~/.claude.json` with scope flag | No (personal, all projects) |
## Configuration File
MCP servers are configured in `.mcp.json` at the project root.
### Stdio Server
```json
{
"mcpServers": {
"server-name": {
"type": "stdio",
"command": "executable",
"args": ["arg1", "arg2"],
"env": {
"KEY": "value"
},
"disabled": false
}
}
}
```
### HTTP Server
```json
{
"mcpServers": {
"github": {
"type": "http",
"url": "https://api.githubcopilot.com/mcp/"
}
}
}
```
### Environment Variable Expansion
```json
{
"mcpServers": {
"my-server": {
"command": "${CLAUDE_PLUGIN_ROOT}/servers/api",
"args": ["--config", "${CLAUDE_PLUGIN_ROOT}/config.json"],
"env": {
"API_KEY": "${MY_API_KEY}",
"PORT": "${PORT:-3000}"
}
}
}
}
```
`${VAR}` expands to env var value. `${VAR:-default}` provides fallback.
### Configuration Locations
- **Local**: `~/.claude.json` (personal, one project)
- **Project**: `.mcp.json` in project root (checked into git)
- **User**: `~/.claude.json` with user scope (personal, all projects)
### Fields
| Field | Type | Description |
|-------|------|-------------|
| `type` | string | Transport: `stdio`, `http`, `sse` |
| `command` | string | Executable to run (stdio) |
| `args` | string[] | Arguments to pass (stdio) |
| `url` | string | Server URL (http/sse) |
| `headers` | object | HTTP headers (http/sse) |
| `env` | object | Environment variables |
| `disabled` | boolean | Temporarily disable server |
| `cwd` | string | Working directory for the server |
## Adding MCP Servers via CLI
```bash
# Add server interactively
claude mcp add
# Add with name and command
claude mcp add server-name -- command arg1 arg2
# Add with scope
claude mcp add --scope project server-name -- npx -y @package/server
# Add with environment variables
claude mcp add server-name -e KEY=value -- command args
# List configured servers
claude mcp list
# Remove server
claude mcp remove server-name
# Get server details
claude mcp get server-name
```
## Common MCP Servers
### Filesystem Server
```json
{
"mcpServers": {
"filesystem": {
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-filesystem", "/allowed/path"]
}
}
}
```
### PostgreSQL Server
```json
{
"mcpServers": {
"postgres": {
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-postgres"],
"env": {
"DATABASE_URL": "postgresql://user:pass@localhost:5432/dbname"
}
}
}
}
```
### GitHub Server
```json
{
"mcpServers": {
"github": {
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-github"],
"env": {
"GITHUB_PERSONAL_ACCESS_TOKEN": "ghp_..."
}
}
}
}
```
### Brave Search
```json
{
"mcpServers": {
"brave-search": {
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-brave-search"],
"env": {
"BRAVE_API_KEY": "BSA..."
}
}
}
}
```
### Puppeteer (Browser Automation)
```json
{
"mcpServers": {
"puppeteer": {
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-puppeteer"]
}
}
}
```
### Memory (Persistent Knowledge Graph)
```json
{
"mcpServers": {
"memory": {
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-memory"]
}
}
}
```
### Slack
```json
{
"mcpServers": {
"slack": {
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-slack"],
"env": {
"SLACK_BOT_TOKEN": "xoxb-...",
"SLACK_TEAM_ID": "T..."
}
}
}
}
```
### Sentry
```json
{
"mcpServers": {
"sentry": {
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-sentry"],
"env": {
"SENTRY_AUTH_TOKEN": "sntrys_..."
}
}
}
}
```
### Firecrawl (Web Scraping)
```json
{
"mcpServers": {
"firecrawl": {
"command": "npx",
"args": ["-y", "firecrawl-mcp"],
"env": {
"FIRECRAWL_API_KEY": "fc-..."
}
}
}
}
```
### Context7 (Library Docs)
```json
{
"mcpServers": {
"context7": {
"command": "npx",
"args": ["-y", "@context7/mcp-server"]
}
}
}
```
### Perplexity (AI Search)
```json
{
"mcpServers": {
"perplexity": {
"command": "npx",
"args": ["-y", "perplexity-mcp"],
"env": {
"PERPLEXITY_API_KEY": "pplx-..."
}
}
}
}
```
## OAuth MCP Servers
Some MCP servers support OAuth authentication:
```bash
# Add OAuth-enabled server
claude mcp add --transport http \
--callback-port 8080 \
--client-id "my-client-id" \
--client-secret "my-secret" \
github https://api.githubcopilot.com/mcp/
```
### OAuth Configuration
```json
{
"mcpServers": {
"oauth-server": {
"type": "http",
"url": "https://api.example.com/mcp/",
"oauth": {
"clientId": "your-client-id",
"clientSecret": "your-client-secret",
"callbackPort": 8080,
"scopes": ["read", "write"]
}
}
}
}
```
## Additional CLI Commands
```bash
# Add MCP server from JSON blob
claude mcp add-json my-server '{"command":"node","args":["server.js"]}'
# Import servers from Claude Desktop app
claude mcp add-from-claude-desktop
# Reset MCP server (clear cached state)
claude mcp reset server-name
```
## Tool Naming Convention
MCP tools are exposed to Claude with the naming pattern:
```
mcp__<server-name>__<tool-name>
```
For example:
- `mcp__filesystem__read_file`
- `mcp__postgres__query`
- `mcp__github__create_issue`
## SSE-Based Servers
For remote MCP servers using Server-Sent Events:
```json
{
"mcpServers": {
"remote-server": {
"url": "https://my-server.example.com/mcp/sse",
"headers": {
"Authorization": "Bearer token123"
}
}
}
}
```
## Building Custom MCP Servers
### TypeScript Server (Recommended)
```typescript
import { Server } from "@modelcontextprotocol/sdk/server/index.js";
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
import {
ListToolsRequestSchema,
CallToolRequestSchema,
} from "@modelcontextprotocol/sdk/types.js";
const server = new Server(
{ name: "my-server", version: "1.0.0" },
{ capabilities: { tools: {} } }
);
// List available tools
server.setRequestHandler(ListToolsRequestSchema, async () => ({
tools: [
{
name: "my_tool",
description: "Does something useful",
inputSchema: {
type: "object",
propRelated in AI Agents
skill-development
IncludedComprehensive meta-skill for creating, managing, validating, auditing, and distributing Claude Code skills and slash commands (unified in v2.1.3+). Provides skill templates, creation workflows, validation patterns, audit checklists, naming conventions, YAML frontmatter guidance, progressive disclosure examples, and best practices lookup. Use when creating new skills, validating existing skills, auditing skill quality, understanding skill architecture, needing skill templates, learning about YAML frontmatter requirements, progressive disclosure patterns, tool restrictions (allowed-tools), skill composition, skill naming conventions, troubleshooting skill activation issues, creating custom slash commands, configuring command frontmatter, using command arguments ($ARGUMENTS, $1, $2), bash execution in commands, file references in commands, command namespacing, plugin commands, MCP slash commands, Skill tool configuration, or deciding between skills vs slash commands. Delegates to docs-management skill for official documentation.
reprompter
IncludedTransform messy prompts into well-structured, effective prompts — single or multi-agent. Use when: "reprompt", "reprompt this", "clean up this prompt", "structure my prompt", rough text needing XML tags and best practices, "reprompter teams", "repromptception", "run with quality", "smart run", "smart agents", multi-agent tasks, audits, parallel work, anything going to agent teams. Don't use when: simple Q&A, pure chat, immediate execution-only tasks. See "Don't Use When" section for details. Outputs: Structured XML/Markdown prompt, quality score (before/after), optional team brief + per-agent sub-prompts, agent team output files. Success criteria: Single mode quality score ≥ 7/10; Repromptception per-agent prompt quality score 8+/10; all required sections present, actionable and specific.
adaptive-compaction
IncludedAdaptive add-on policy and recovery layer that decides WHEN to compact, prune, snapshot, or fork -- replacing fixed-percent auto-compaction across Claude Code, Codex, and MCP-capable hosts. Trigger on auto-compact timing or damage: "when should I compact", "is it safe to compact now or start a fresh session", "auto-compact fires too early/mid-task", "switching to an unrelated task but the window still has space", "context rot", "answers get worse the longer the session runs", "the agent forgot the plan or my decisions after it summarized", "add a layer on top that manages context without changing the agent", raising autoCompactWindow to give the policy room, or installing/tuning a cross-tool compaction policy or PreCompact hook -- even when "compaction" is never said but the problem is context-window pressure or post-summarization memory loss. Do NOT use to summarize a conversation, build RAG, write a summarization prompt (decides WHEN not HOW), or answer max-context-length trivia.
agent-skill-creator
IncludedCreate cross-platform agent skills from workflow descriptions. Activates when users ask to create an agent, automate a repetitive workflow, create a custom skill, or need advanced agent creation. Triggers on phrases like create agent for, automate workflow, create skill for, every day I have to, daily I need to, turn process into agent, need to automate, create a cross-platform skill, validate this skill, export this skill, migrate this skill. Supports single skills, multi-agent suites, transcript processing, template-based creation, interactive configuration, cross-platform export, and spec validation.
llm-wiki
IncludedUse when building or maintaining a persistent personal knowledge base (second brain) in Obsidian where an LLM incrementally ingests sources, updates entity/concept pages, maintains cross-references, and keeps a synthesis current. Triggers include "second brain", "Obsidian wiki", "personal knowledge management", "ingest this paper/article/book", "build a research wiki", "compound knowledge", "Memex", or whenever the user wants knowledge to accumulate across sessions instead of being re-derived by RAG on every query.
skill-master
IncludedAgent Skills authoring, evaluation, and optimization. Create, edit, validate, benchmark, and improve skills following the agentskills.io specification. Use when designing SKILL.md files, structuring skill folders (references, scripts, assets), ingesting external documentation into skills, running trigger evals, benchmarking skill quality, optimizing descriptions, or performing blind A/B comparisons. Keywords: agentskills.io, SKILL.md, skill authoring, eval, benchmark, trigger optimization.