Source: https://measuremy.site/blog/how-to-add-an-mcp-server-to-claude-code

[measuremy.site](https://measuremy.site/) / [Blog](https://measuremy.site/blog)

# Adding an MCP server to Claude Code

October 14, 2026 · 4 min read

[Photo by Tima Miroshnichenko on Pexels](https://www.pexels.com/photo/a-computer-monitor-5380589/)

## What you need before you start

[Claude Code](https://measuremy.site/guides/claude-code-analytics) manages MCP servers through commands in the terminal. You do not need to edit a config file for most cases, although project scope may create one. Before you start, have the server's connection details ready.

- Claude Code installed and working in your terminal.
- The [MCP server](https://measuremy.site/blog/what-is-an-mcp-server) name and either a local command or a hosted URL.
- Any authentication details the provider tells you to use.

## Choose the right scope

Claude Code can add a server at different scopes. The right choice depends on whether the server should be available everywhere or only in one project.

- User scope is available across all your projects on the same machine.
- Project scope is tied to a single project and can be useful for shared team setups.
- Local scope is narrower and useful when you do not want the server to follow you into other projects.

Check Claude Code's current documentation for the exact flags and behavior in your version.

## Add a local server

If the MCP server runs as a local command, such as a small script or CLI tool, you add it with the standard MCP add command. The important parts are the server name, the transport type, the scope, and the command that starts the server.

```
claude mcp add my-server --transport stdio --scope user -- my-command --flag
```

Replace `my-server` with a name you will recognise, and replace `my-command --flag` with the command your server provider supplied. The `--transport stdio` part tells Claude Code that the server is a local process.

## Add a hosted server

If the server is hosted, you will usually add it with a URL and a remote transport type such as SSE or HTTP. Use the URL exactly as your provider gives it to you. Do not paste the URL into a normal chat prompt and ask Claude Code to guess the setup; use the MCP management command instead.

The command follows the same pattern as a local server, but the transport is remote and the final argument is the provider's URL. Some providers give you a one-sentence instruction that includes the full command, which is the easiest way to avoid transport or scope mistakes.

## Authenticate if required

Some hosted MCP servers use OAuth instead of an API key. After you add the server and restart Claude Code, a browser window may open for sign-in. Once you approve the sign-in, the connection is active without copying a key into your config.

A hosted [analytics MCP server](https://measuremy.site/guides/analytics-mcp-server) may work this way. For example, measuremy.site uses browser sign-in and no API key, so one sign-in can cover all your sites. If your server uses OAuth, keep the browser session available during setup.

## Test the connection

After adding a server, restart Claude Code. Then check that the server is listed and shows as connected.

```
claude mcp list
```

If the server does not appear, check the scope you used. A server added at project scope will not show up when you run Claude Code from a different directory. A server added at user scope should be visible across projects.

## Use the tools in a project

Once the server is connected, you can ask Claude Code to use its tools in normal language. You do not need to call the server directly or write HTTP requests. For an analytics server, you might ask for the top pages this week, a funnel report, or a list of campaign links.

The agent decides which tools to call and reads the results for you. If the server offers multiple tools, start with a small request to confirm the connection works before asking for a large report.

## Troubleshooting common problems

- Server shows as disconnected after restart: remove it and add it again with the same scope.
- Browser sign-in does not open: run the add command again and watch for the browser window.
- Tools are missing in a project: check whether a project scope config is overriding your user scope.
- Local command fails: run the command by itself in the terminal to confirm it works outside Claude Code.
- Server works in one directory but not another: you probably added it at local or project scope rather than user scope.

## Keep credentials out of shared files

If you use project scope for a server that needs an API key, be careful not to commit secrets into a project config file that other people can read. Prefer OAuth where it is offered, or use user scope for private credentials. This is a general security practice, not a rule about any specific server.

Adding an MCP server to Claude Code is mostly a matter of choosing a scope, running one management command, restarting, and confirming the connection. Once that is done, the server's tools become part of your normal workflow in the terminal. Start with a small, specific request after setup so you can see whether the server is returning data before you rely on it for decisions.

### See it on your own site

measuremy.site is cookieless analytics your coding agent can read. 30-day free trial, no card. Plans from $9/month.

[Start free trial](https://measuremy.site/login) [See the live demo](https://measuremy.site/share/measuremy.site)

Add measuremy.site analytics to this project: connect the measuremy.site MCP server at https://a.measuremy.site/mcp for all my projects (claude mcp add --scope user; it signs in with OAuth, no key, and one sign-in covers every site), then tell me how to sign in. Details: measuremy.site/llms.txt

## Free tools

- [Analytics tag checker](https://measuremy.site/tools/analytics-tag-checker): Which analytics and pixels a site runs, plus duplicate and broken tags.
- [Free UTM link builder](https://measuremy.site/tools/utm-link-builder): Add utm_source, medium and campaign to any link.
- [Website traffic checker](https://measuremy.site/tools/website-traffic-checker): A site's popularity rank and estimated monthly visits.

[All free tools](https://measuremy.site/tools)

## More from the blog

- [How to calculate your website conversion rate, and what to compare it to](https://measuremy.site/blog/calculate-website-conversion-rate)
- [Is my A/B test result significant? A plain-English guide with a worked example](https://measuremy.site/blog/is-my-ab-test-significant)
- [What is bounce rate, how is it calculated, and is yours a problem?](https://measuremy.site/blog/what-is-bounce-rate)
- [How to add a visitor counter to your website or GitHub README](https://measuremy.site/blog/add-visitor-counter-to-website)
- [How much traffic does a website get? How to estimate any site's visits](https://measuremy.site/blog/how-much-traffic-does-a-website-get)
- [How to track QR code scans: count them, and see which poster worked](https://measuremy.site/blog/track-qr-code-scans)
- [How to see how many people clicked your link (without a paid shortener)](https://measuremy.site/blog/how-many-people-clicked-my-link)
- [How to check if your Google Analytics 4 tag is installed (and only counting once)](https://measuremy.site/blog/check-if-ga4-is-installed)
- [Why GA4 shows your campaign traffic as Unassigned (and how to fix the links)](https://measuremy.site/blog/ga4-unassigned-traffic)
- [Does your redirect keep your UTM tags? How to check before a campaign goes out](https://measuremy.site/blog/redirect-drops-utm-tags)
- [How I built a self-hosted analytics MCP server on Cloudflare Workers and D1](https://measuremy.site/blog/analytics-mcp-server-cloudflare-workers)
- [UTM tracking explained: what the parameters mean and how to use them](https://measuremy.site/blog/utm-tracking-explained)
- [Conversion funnel analysis for small sites: a practical guide](https://measuremy.site/blog/conversion-funnel-analysis)
- [Sudden drop in website traffic? A checklist for finding the cause](https://measuremy.site/blog/sudden-drop-in-website-traffic)
- [What is an MCP server? A plain-English guide for people who run websites](https://measuremy.site/blog/what-is-an-mcp-server)
- [How long should you keep analytics data?](https://measuremy.site/blog/how-long-should-you-keep-analytics-data)
- [How to Build a Small MCP Server That Actually Helps](https://measuremy.site/blog/how-to-build-your-own-mcp-server)
- [How to Find the Biggest Drop Off in a Funnel](https://measuremy.site/blog/how-to-find-the-biggest-drop-off-in-a-funnel)
- [What Is the Urchin Tracking Module?](https://measuremy.site/blog/what-is-the-urchin-tracking-module-and-why-utm-stuck-around)
- [What Microsoft MCP servers actually do](https://measuremy.site/blog/microsoft-mcp-servers-explained)
- [UTM parameters for email newsletters](https://measuremy.site/blog/utm-parameters-for-email-newsletters)
- [Track Button Clicks Without Google Tag Manager](https://measuremy.site/blog/how-to-track-clicks-on-a-button-without-google-tag-manager)
- [How to track the results of a social media post without cookies](https://measuremy.site/blog/how-to-measure-the-results-of-a-social-media-post)
- [How to track traffic from a GitHub README](https://measuremy.site/blog/how-to-track-traffic-from-a-github-readme)
- [How to measure a product launch without guessing](https://measuremy.site/blog/how-to-measure-a-product-launch)
