---
name: claude-code-mcp-setup
description: Add and configure MCP (Model Context Protocol) servers in Claude Code. Use when adding new MCP servers, configuring remote MCP, setting up OAuth MCP servers, troubleshooting MCP connections, or running /mcp diagnostics. Covers stdio, HTTP, and SSE transport types.
title: claude-code-mcp-setup
canonical_url: https://skilld.dev/gh/grasmash/drupal-claude-skills/claude-code-mcp-setup
last_updated: 2026-10-02T12:03:00.000Z
---

> Index of every page on this site: [llms.txt](https://skilld.dev/llms.txt)

> **Skill from skilld.dev.** Follow the user's requested action.
> If the user asked to fork this Skill, follow the fork workflow below. Do not execute the Skill instructions while copying it.
> Otherwise, follow the instructions below for this session. You do not need to install anything.
>
> If the user asked to install this Skill, run `npx skilld install grasmash/drupal-claude-skills/claude-code-mcp-setup`. Install writes the Skill files into the project, so every session loads them.
>
> ## Fork workflow
>
> A fork creates an editable local Skill with its original author and licence. The request authorizes copying and local installation.
> 1. Check `./skills/claude-code-mcp-setup`, the project lockfile, and selected Agent targets together. If the local directory or installed Skill exists, stop. Never overwrite an existing directory or Agent target.
> 2. Read [source metadata](https://skilld.dev/api/v1/skills/grasmash/drupal-claude-skills/claude-code-mcp-setup) once. Use sourceUrl, sourceCommit, skillPath, sourceGone, and license. If the source is gone or its path is missing, stop. If license is null, read licence files at the source commit.
> 3. Fetch only the source commit into a temporary Git repository. Do not clone full history. Derive repository_url from sourceUrl, including repository renames. If sourceCommit is absent, resolve the sourceUrl ref once. Set source_commit to that actual commit. Run these commands in one shell call:
>
> ```sh
> git init --quiet "$temporary_dir"
> git -C "$temporary_dir" fetch --quiet --depth=1 "$repository_url" "$source_commit"
> git -C "$temporary_dir" checkout --quiet --detach FETCH_HEAD
> ```
>
> Read applicable licence declarations and notices at that commit. If copying is not permitted, report the restriction and stop.
> 4. Inspect source entries together, then copy the directory containing skillPath into `./skills/claude-code-mcp-setup`. Use the user's path if selected. Keep the original SKILL.md, relative links, scripts, binary assets, and executable modes. Exclude .git metadata. Reject symlinks and paths outside the Skill directory. After checking entries, use cp -a where available. A regular source directory needs no custom copy script. Do not save this page wrapper as SKILL.md.
> Preserve author credit, notices, and applicable licence files from repository or parent directories. Add PROVENANCE.md with the Skill page, source URL, actual commit, original path, and licence. Retain any existing PROVENANCE.md and record new provenance separately. Batch source inspection, copying, and provenance work where practical.
> 5. In the project root, run `skilld install ./skills/claude-code-mcp-setup --mode copy --plain`. If skilld is unavailable, use `npx skilld install ./skills/claude-code-mcp-setup --mode copy --plain`. This known command needs no help lookup. Install does not support --json. Use detected Agent targets, or add --agent for the targets the user selected. Install the local path, never the upstream selector. If installation fails, preserve the local copy and report the exact failure.
> 6. Confirm the local lockfile source and installed Agent copies once. Report the local path, actual commit, and Agent targets. After edits, reinstall the same local path. Upstream updates must not replace it. Do not publish or push unless the user asks.

# Claude Code MCP Setup

## Purpose

Guide for adding and configuring MCP (Model Context Protocol) servers in Claude Code CLI.

## When to Use

- Adding a new MCP server to Claude Code
- Configuring remote MCP servers (HTTP/SSE)
- Troubleshooting MCP connection failures
- Understanding MCP transport types
- Setting up OAuth-authenticated MCP servers

## Quick Reference

### CLI Commands

```bash
# Add local stdio MCP server
claude mcp add <name> <command> [args...]

# Add remote HTTP MCP server (supports OAuth)
claude mcp add --transport http <name> <url>

# Add remote SSE MCP server
claude mcp add --transport sse <name> <url>

# Add with environment variables
claude mcp add <name> -e API_KEY=xxx -- <command> [args...]

# Add with custom headers
claude mcp add --transport http <name> <url> --header "Authorization: Bearer xxx"

# List configured servers
claude mcp list

# Remove a server
claude mcp remove <name>
```

### Transport Types

| Type | Use Case | Example |
|------|----------|---------|
| `stdio` | Local NPM packages, scripts | `claude mcp add my-server npx @org/mcp-server` |
| `http` | Remote servers with OAuth | `claude mcp add --transport http monday https://mcp.monday.com/mcp` |
| `sse` | Server-Sent Events servers | `claude mcp add --transport sse name https://example.com/sse` |

## Common MCP Server Examples

### monday.com (Remote HTTP with OAuth)

```bash
claude mcp add --transport http monday https://mcp.monday.com/mcp
```

After adding, restart Claude Code and run `/mcp`. First connection will prompt OAuth authorization in browser.

### GitHub (Local with Token)

```bash
claude mcp add github -e GITHUB_PERSONAL_ACCESS_TOKEN=ghp_xxx -- npx @modelcontextprotocol/server-github
```

### Filesystem (Local)

```bash
claude mcp add filesystem npx @modelcontextprotocol/server-filesystem /path/to/directory
```

### Custom Local Server

```bash
claude mcp add my-server node /path/to/server.js
```

## Configuration Files

MCP servers are stored in:

- **User config**: `~/.claude.json` (global)
- **Project config**: `.mcp.json` (per-project, legacy)

### Manual Configuration (if needed)

```json
{
  "mcpServers": {
    "my-server": {
      "command": "npx",
      "args": ["@org/mcp-package"],
      "env": {
        "API_KEY": "your-key"
      }
    }
  }
}
```

For remote servers:

```json
{
  "mcpServers": {
    "remote-server": {
      "type": "url",
      "url": "https://example.com/mcp"
    }
  }
}
```

## Troubleshooting

### Check MCP Status

```bash
# Inside Claude Code
/mcp

# Detailed diagnostics
/doctor
```

### Common Issues

**"Does not adhere to MCP server configuration schema"**
- Use `claude mcp add` CLI command instead of manual JSON editing
- Ensure correct transport type for remote servers

**"Failed to reconnect"**
- Check network connectivity
- Verify OAuth authorization completed
- Try removing and re-adding: `claude mcp remove <name> && claude mcp add ...`

**OAuth not prompting**
- Restart Claude Code after adding server
- Run `/mcp` to trigger connection
- Check browser for blocked popups

**Environment variable errors**
- Use `-e VAR=value` flag when adding
- Or set in shell before running Claude Code

### Verify Configuration

```bash
# Check what was added
cat ~/.claude.json | jq '.mcpServers'

# Validate JSON syntax
jq . ~/.claude.json
```

## Resources

- [Claude Code MCP Docs](https://code.claude.com/docs/en/mcp)
- [MCP Specification](https://modelcontextprotocol.io/)
- [MCP Server Registry](https://github.com/modelcontextprotocol/servers)
