Reference · AI tool configuration
claude_desktop_config.json and .cursor/mcp.json: audit your MCP servers
Find claude_desktop_config.json and .cursor/mcp.json, list every MCP server and the command it runs, limit the filesystem server's allowed directories, spot command-execution servers and rotate keys stored in plain text.
| Target artifact | The MCP server lists claude_desktop_config.json (Claude Desktop) and mcp.json (Cursor), and the API keys inside them. |
|---|---|
| Default behaviour | Each local server runs the command its entry names, with your user account's permissions. Keys put in a server's env block sit in the file as plain text, and a project's .cursor/mcp.json can be committed to git with them. |
| Safe state | Only servers you recognize, from the vendor or a source you reviewed, pinned to a version; the filesystem server limited to named folders; no server that runs arbitrary shell commands unless you meant it; config files readable by you alone; no keys in a committed file. |
| Check on Windows | (Get-Content "$env:APPDATA\Claude\claude_desktop_config.json" -Raw | ConvertFrom-Json).mcpServers.PSObject.Properties | ForEach-Object { '{0}: {1} {2}' -f $_.Name, $_.Value.command, ($_.Value.args -join ' ') } |
| Check on macOS | ls -l ~/Library/Application\ Support/Claude/claude_desktop_config.json ~/.cursor/mcp.json |
| Check on Linux | ls -l ~/.cursor/mcp.json && grep -o '"command": *"[^"]*"' ~/.cursor/mcp.json |
| Fix | chmod 600 on each file; remove servers you do not use; revoke and replace any key that was in a shared, synced or committed file |
Where the files are
| Program | Scope | Path |
|---|---|---|
| Claude Desktop | Your account, Windows | %APPDATA%\Claude\claude_desktop_config.json |
| Claude Desktop | Your account, macOS | ~/Library/Application Support/Claude/claude_desktop_config.json |
| Cursor | Every project | ~/.cursor/mcp.json (on Windows, %USERPROFILE%\.cursor\mcp.json) |
| Cursor | One project | .cursor/mcp.json in the project folder |
Claude Desktop writes its MCP logs to ~/Library/Logs/Claude on macOS and %APPDATA%\Claude\logs on Windows. They show which servers started and what failed.
List what each server runs
The Windows check in the table prints one line per server: its name, its command and its arguments. It does not print the env block. Arguments can still contain keys, so do not paste the output anywhere public.
macOS and Linux
grep -o '"command": *"[^"]*"' ~/Library/Application\ Support/Claude/claude_desktop_config.json
grep -o '"command": *"[^"]*"' ~/.cursor/mcp.jsonThen open the file in a text editor to read each server's args next to its command.
Servers that can run shell commands
A server whose job is to run terminal commands gives the model your shell, with your permissions. Flag entries whose command is a shell, or whose package name mentions running commands:
(Get-Content "$env:APPDATA\Claude\claude_desktop_config.json" -Raw | ConvertFrom-Json).mcpServers.PSObject.Properties | ForEach-Object { '{0}: {1} {2}' -f $_.Name, $_.Value.command, ($_.Value.args -join ' ') } | Select-String -Pattern 'shell|terminal|exec|command|powershell|cmd|bash'grep -n -i -E 'shell|terminal|exec|command|powershell|cmd|bash' ~/.cursor/mcp.jsonThe second command also matches every "command" key; read the lines around each hit. Keep such a server only if you meant to give the model a shell, and keep its tool-approval prompts on.
Limit the filesystem server
The reference filesystem server, @modelcontextprotocol/server-filesystem, works only inside its allowed directories. In a configuration file, those are the arguments after the package name. A client on the 2025 protocol versions that supports roots can replace that list while it runs; the server's documentation says roots are deprecated as of protocol version 2026-07-28, and that adding --confine-roots keeps a client's roots inside the directories you gave.
"filesystem": {
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-filesystem", "/Users/me/Projects/notes"]
}- List the narrowest folders that do the job. Your home folder or a whole drive gives the model every file you can open, including SSH keys and browser profiles.
- Pin the version, for example
@modelcontextprotocol/server-filesystem@VERSION. A barenpx -y packagefetches whatever is newest each time it starts.
Move keys out of the file
Cursor
Cursor can read a local server's variables from a separate file with envFile, which works only for servers it starts itself (STDIO), or from your environment with ${env:NAME} in the configuration, which also works for remote servers, so the key itself never sits in mcp.json. Keep the separate file out of git.
Claude Desktop
Prefer servers packaged as desktop extensions, which keep keys in the operating system's keychain, over plain-text env entries. In April 2025, Trail of Bits found claude_desktop_config.json readable by other accounts on macOS; chmod 600 limits it to you:
chmod 600 ~/Library/Application\ Support/Claude/claude_desktop_config.jsonWas a key committed to git?
In the project folder, this lists every commit that touched the file, with its changes:
git log --all -p -- .cursor/mcp.jsonIf a key appears, removing it in a new commit is not enough: anyone with a copy of the repository has it. Revoke it at the service that issued it and create a new one.
When to rotate keys
Revoke every key in a configuration file, at the service that issued it, if any of these is true:
- The file was readable by other accounts, synced to a shared or cloud folder, or committed to a repository.
- The computer ran information-stealing malware or an untrusted MCP server. See infostealer session triage.
- You ran an affected version of a server with a published flaw, such as
mcp-remote0.0.5 to 0.1.15 (CVE-2025-6514, fixed in 0.1.16), or the copiedpostmark-mcppackage, whose version 1.0.16 sent a blind copy of every email to an attacker.
Then give each server its own key with the smallest scope that works.
Related guides and lookups
Sources
- Model Context Protocol: connect to local servers
- Model Context Protocol: filesystem server
- Cursor: Model Context Protocol
- Anthropic: desktop extensions
- Trail of Bits: insecure credential storage in MCP, April 2025
- JFrog: CVE-2025-6514 in mcp-remote
- The Hacker News: first malicious MCP server, September 2025