MCP servers for Claude Code: commands and gotchas for 8 servers

Published on
7 min read.
Tags: AIClaude Code

Each MCP server for Claude Code goes in with one command, but the eight on this page each break in a different place: Playwright can't find Chrome, Grafana fails if the server name comes after -e, Sentry wants Sentry-Bearer instead of Bearer, and PagerDuty archived its local server. No vendor doc compares them, so here are the commands and gotchas side by side, followed by the setup mistakes that repeat across all of them.

These days the only one I still run is Datadog.

All eight at a glance

ServerRunsAuthThe thing that breaks
GitHubhosted, HTTPpersonal access tokendouble quotes write the token into the config
Playwrightlocal, npxnonefirst tool call fails without Google Chrome
Sentryhosted, HTTPOAuth, or tokena token needs Sentry-Bearer, not Bearer
Datadoghosted, HTTPOAuthone endpoint per Datadog site, and an org admin must turn on MCP Access
PagerDutyhosted, or local uvxAPI keythe local server is archived, and EU accounts need another host
Grafanalocal, uvxservice account tokenserver name must come before the -e flags
Context7local, npxnone (key optional)Claude doesn't always call it unless the prompt says use context7
Sequential Thinkinglocal, npxnonehard to tell it helped unless you see the tool call

Quick commands

# GitHub (export GITHUB_PAT first)
claude mcp add-json github '{"type":"http","url":"https://api.githubcopilot.com/mcp/","headers":{"Authorization":"Bearer ${GITHUB_PAT}"}}'

# Playwright
claude mcp add playwright -- npx @playwright/mcp@latest

# Sentry (then log in through /mcp)
claude mcp add --transport http sentry https://mcp.sentry.dev/mcp

# Datadog, US1 site (then log in through /mcp)
claude mcp add --transport http datadog https://mcp.datadoghq.com/v1/mcp

# PagerDuty, hosted (export PAGERDUTY_API_KEY first)
claude mcp add-json pagerduty '{"type":"http","url":"https://mcp.pagerduty.com/mcp","headers":{"Authorization":"Token token=${PAGERDUTY_API_KEY}"}}'

# Grafana (this form stores the token in plain text, see below)
claude mcp add grafana \
  -e GRAFANA_URL=https://myinstance.grafana.net \
  -e GRAFANA_SERVICE_ACCOUNT_TOKEN=glsa_your_token \
  -- uvx mcp-grafana

# Context7
claude mcp add context7 -- npx -y @upstash/context7-mcp

# Sequential Thinking
claude mcp add sequential-thinking -- npx -y @modelcontextprotocol/server-sequential-thinking

The sections below cover the mistakes these commands share. Tokens, permissions and troubleshooting for one server are in its own post, linked from the table.

Hosted servers need --transport http

GitHub, Sentry, Datadog and hosted PagerDuty run on the vendor's side, and Claude Code connects to a URL. Without --transport http (or "type":"http" in add-json), Claude Code saves the URL as a local command. Claude Code 2.1.330 still adds the server and only prints a warning:

Warning: The command "https://mcp.sentry.dev/mcp" looks like a URL, but is treated as a stdio server because --transport wasn't set.

The server is in your config either way, and claude mcp get sentry later shows Failed to connect with ENOENT ... posix_spawn 'https://mcp.sentry.dev/mcp'. Remove it and add it again with the flag.

Playwright, Grafana, Context7, Sequential Thinking and the old local PagerDuty server run on your machine. Claude Code starts the process itself, so they need Node.js for npx or uv for uvx.

Local servers: name, then -e, then --

For a local server, use this order: claude mcp add <name> [-e KEY=value ...] -- <command> [server flags].

-e takes more than one value, so a name placed after it can get read as another environment variable. This is what the Grafana command printed:

Invalid environment variable format: grafana, environment variables should be added as: -e KEY1=value1 -e KEY2=value2

Everything after -- goes to the server untouched. Leave the -- out and the Claude Code CLI tries to read the server's flags as its own:

$ claude mcp add playwright npx @playwright/mcp@latest --headless
error: unknown option '--headless'
(Did you mean --header?)

With claude mcp add playwright -- npx @playwright/mcp@latest --headless, the flag reaches Playwright. The same goes for Grafana's --disable-write.

Keep tokens out of ~/.claude.json

claude mcp add -e TOKEN=... and -H "Authorization: ..." write the secret into your Claude Code config as plain text. To keep it in your shell instead, use add-json with a ${VAR} placeholder inside single quotes:

export GITHUB_PAT=ghp_your_token_here
claude mcp add-json github '{"type":"http","url":"https://api.githubcopilot.com/mcp/","headers":{"Authorization":"Bearer ${GITHUB_PAT}"}}'

Claude Code expands the placeholder each time it starts the server. Two ways this goes wrong:

  • Double quotes let your shell expand ${GITHUB_PAT} before Claude Code sees it, so the real token (or an empty string) lands in the config.
  • The variable has to be set in the shell that starts Claude Code. If it isn't, claude mcp list ends with [Warning] [github] mcpServers.github: Missing environment variables: GITHUB_PAT. Put the export in ~/.zshrc or ~/.bashrc.

claude mcp get <name> shows the stored config. The header should still read ${GITHUB_PAT}, not the token.

Local servers take the same placeholder in env. This is the Grafana command from above without the plain-text token:

export GRAFANA_SERVICE_ACCOUNT_TOKEN=glsa_your_token
claude mcp add-json grafana '{"type":"stdio","command":"uvx","args":["mcp-grafana"],"env":{"GRAFANA_URL":"https://myinstance.grafana.net","GRAFANA_SERVICE_ACCOUNT_TOKEN":"${GRAFANA_SERVICE_ACCOUNT_TOKEN}"}}'

OAuth servers (Sentry, Datadog) skip all of this. Run /mcp inside Claude Code, pick the server and log in in the browser. Claude Code stores the OAuth token itself.

On Windows, GitHub's install guide notes that add-json can fail with Invalid input for HTTP servers. The GitHub post has the add form to use there.

claude mcp list only checks that the server starts

claude mcp list shows ✓ Connected once the process starts or the URL answers. (OAuth servers show "needs authentication" in /mcp until you log in.) Connected says nothing about the token, the permissions or the browser. Playwright reports Connected on a machine with no Chrome and fails on the first tool call. Grafana reports Connected with an expired token, and the first query comes back 401 or 403.

Ask one real question about data you know exists, like "list my open pull requests" or "what are the triggered monitors in Datadog". An empty answer usually means the account behind the token can't see that data. Check its permissions before you change the command.

Scope: one project, every project, or the team

claude mcp add defaults to local scope, so the server only loads in the directory where you ran the command. --scope user loads it in every project. --scope project writes it to .mcp.json in the repo root, which you can commit. With ${VAR} placeholders, each teammate sets their own token and no secret goes into git. Claude Code asks each person to approve project servers the first time they load.

Start read-only

Most of these servers can write. They open PRs, change dashboards, and create or update incidents. The local PagerDuty server is the exception: It stays read-only until you add --enable-write-tools. Turn writes off until a workflow needs them:

  • GitHub: the /mcp/readonly URL or the X-MCP-Readonly: true header, plus a read-only token.
  • Grafana: --disable-write, plus a Viewer service account.
  • PagerDuty: leave out --enable-write-tools on the local server.
  • Datadog: a role with mcp_read but no mcp_write, and leave the org's MCP Write Access setting off.
  • Sentry: pick the tool groups at the OAuth prompt, or limit them with ?skills= when you use a token.

Fewer tools also means fewer tool definitions in Claude's context. GitHub's X-MCP-Toolsets header, Datadog's ?toolsets= and Grafana's --disable-<category> all cut the list down.

Context7

Context7, from Upstash, fetches current, version-specific docs and code examples for a library and puts them in Claude's context. It helps when Claude keeps writing an API from an older version.

claude mcp add context7 -- npx -y @upstash/context7-mcp

Claude doesn't always reach for it on its own. Add use context7 to the prompt:

Create a Next.js proxy that checks for a valid JWT in cookies
and redirects unauthenticated users to /login. use context7

If Claude calls the Context7 tools before answering, it works. The command runs without an account. The Context7 README suggests a free API key from context7.com/dashboard for higher rate limits. Append --api-key YOUR_API_KEY after the package name.

Sequential Thinking

Sequential Thinking is a reference server from the Model Context Protocol project. It gives Claude a tool to work through a problem as a series of numbered thoughts that it can revise or branch from. The README pitches it for problems where the full scope isn't clear at the start.

claude mcp add sequential-thinking -- npx -y @modelcontextprotocol/server-sequential-thinking

When Claude uses it, the tool call shows up in the session. On short, simple prompts you may not notice much difference.

I don't install it anymore. Claude Code has extended thinking built in now.

References

Final check

Hosted servers need --transport http, local ones need the name before -e and server flags after --. Put tokens in ${VAR} placeholders inside single quotes, and test with a real question after claude mcp list shows Connected.