AppInspected

Fix guides

Your MCP config file may be holding API keys in plain text. Here's how to check and fix it.

Last reviewed November 20, 2026 against the providers' current documentation.

The short version

Open https://yoursite.com/.mcp.json and https://yoursite.com/.cursor/mcp.json in a private window. If either shows JSON with "mcpServers", it's public: rotate every key in it, stop deploying the file, and replace each value with ${VAR} (Claude Code) or ${env:NAME} (Cursor). Then search git history, because .mcp.json is meant to be committed.

Why it matters

An MCP server gives your coding agent access to a service: GitHub, your database, Stripe, Slack, a search API. Most need a key, and the setup instructions usually show it pasted straight into the config, in an env block for local servers or an Authorization header for remote ones. Claude Code keeps project servers in .mcp.json at the project root, and its docs say to check that file into version control so your team gets the same tools. Cursor keeps them in .cursor/mcp.json. Anyone who gets the file gets the keys, and those keys usually have broad access, because they were made for an agent that does real work.

Fix it, in this order

  1. Check your live site

    Open https://yoursite.com/.mcp.json and https://yoursite.com/.cursor/mcp.json in a private window. JSON with "mcpServers" means the file is public. Your homepage or a 404 means it isn't. Our free check requests both paths and only flags a real MCP config, not your app's fallback page.
  2. Read every server entry

    Look at each server's env, headers and args. A value like "GITHUB_PERSONAL_ACCESS_TOKEN": "ghp_...", "Authorization": "Bearer sk-..." or a database URL with a password is a live credential. A reference like ${GITHUB_TOKEN} or ${env:GITHUB_TOKEN} is only a name and is safe to publish. Also note internal URLs: they tell an attacker which services you run.
  3. Rotate what you find

    Create a new key in each service's dashboard and revoke the old one, starting with tokens that can write: GitHub, database, payment and email providers. Deleting the file isn't enough once it was public or pushed, because copies may already exist.
  4. Replace values with references

    Claude Code expands ${VAR} and ${VAR:-default} in a .mcp.json's command, args, env, url and headers, for example "Authorization": "Bearer ${API_KEY}". Cursor uses ${env:NAME} in the same fields, and local (stdio) servers can load an envFile such as .env. Put the real values in your shell or that git-ignored file, so the shared config holds only names. If you add servers with claude mcp add -s project, open the file afterwards and confirm the values are still references.
  5. Keep personal servers out of the project

    If a server is only for you, don't put it in the project at all. Claude Code's local and user scopes store servers in ~/.claude.json in your home folder, and Cursor's global config is ~/.cursor/mcp.json. Neither travels with the project.
  6. Stop shipping dotfiles

    Deploy your build output (dist/, build/, out/), not the project root, and keep these files out of public/. Add .cursor/ to .npmignore and .dockerignore, run npm pack --dry-run before publishing a package, and block dotfiles at your server as a safety net:
    location ~ /\.(?!well-known) {
        deny all;
    }
  7. Check git history

    git log --all -p -- .mcp.json .cursor/mcp.json shows every version that was committed. If a key ever appeared in a pushed commit, treat it as leaked even if the latest version is clean, and rotate it.

Or ask your AI tool to do it

Paste this into Lovable, Bolt, Cursor, Claude Code or whichever tool built your app. Review what it changes before you deploy.

Read .mcp.json and .cursor/mcp.json in this project (whichever exist). List every server whose env, headers, args or url contains a literal credential (API key, token, password, Authorization header, database URL), with the service it belongs to, so I can rotate them. Then rewrite those values as environment variable references (${VAR} for Claude Code's .mcp.json, ${env:NAME} for Cursor), add the variable names with empty values to .env.example, make sure .env is in .gitignore, make sure my host deploys only the build output folder, and tell me whether a literal key appears anywhere in git history (git log --all -p -- .mcp.json .cursor/mcp.json).

How this happens

MCP setup guides show the quickest path: paste the key into the config and restart the agent. It works at once, so nobody goes back. The file sits in the project folder next to the code, gets committed with it (that's the intended use for .mcp.json), and then rides along with anything that copies the folder: a static host serving the project root, a zip upload, a Docker image or an npm package.

Check that it's really fixed

After you deploy, run the free check. It reads your live site the way an attacker would and tells you if any secret key is still visible.

Topic check: Claude Code security check

Find the other leaks before someone else does

The free check reads your home page and its scripts. The website security report goes through up to 30 pages and 40 JavaScript files, plus .env and .git files, security headers, cookies and CORS, domain and email records, and libraries with known vulnerabilities. Every finding comes with the fix for your host and a prompt for your AI tool.

$19 once, including 20 runs over 30 days so you can fix things and check again.

Get the report, $19 See an example report

Example report header: a score out of 100, findings by severity, Download PDF and Email me this report.

Questions

Is .mcp.json supposed to be in git?

Yes. Claude Code's docs say to check it into version control so the whole team gets the same MCP servers. That's exactly why it must never hold a key: write ${VAR} references and let each person set the values on their machine.

Is ~/.claude.json safe?

It lives in your home folder, not the project, so it isn't deployed or committed with your code. It's still plain text with any key you added at local or user scope, so keep it out of dotfile repos, backups you share and screenshots.

Does the AppInspected free check look for this?

Yes. It requests /.mcp.json and /.cursor/mcp.json on your site and flags a file only when it's a real MCP config. It's rated critical when a value looks like a key or token, and medium when it holds only server names and references. It can't see your git history or your machine. The $19 website security report also requests these paths and scans up to 30 pages and 40 scripts of your app for keys.

Sources

Related guides