How to Detect MCP Servers on Windows, macOS and Linux

MCP servers are programs or URLs that AI assistants call with the user's permissions. Nothing gets installed, so your software inventory never lists them. Here is where each client keeps them, two read-only scripts that list them on one machine in under a minute, and how to turn that into an inventory for every laptop.

By Kuntur team · Published · Updated

Short answer. MCP servers live in JSON files in each user's profile: claude_desktop_config.json, ~/.claude.json, .mcp.json, ~/.cursor/mcp.json, VS Code's mcp.json, ~/.gemini/settings.json and a few more, plus ~/.codex/config.toml for Codex. Run the PowerShell or bash script below as the user (not as SYSTEM or root): it prints one line per server with the command or URL and masks tokens. Then list running node, npx, uvx, python and docker processes whose parent is an AI client. To do it on every laptop, run the same script from Intune, Jamf or your RMM and merge the output, or use an agent that keeps the list current.

What an MCP server is, and why it matters on an endpoint

The Model Context Protocol (MCP) lets an AI client such as Claude Desktop, Claude Code, Cursor or VS Code call external tools. A stdio MCP server is just a command the client launches, usually npx, uvx, python or docker, and it runs with the full permissions of the logged-in user. A remote MCP server is a URL the client talks to over HTTP, often with an OAuth token or an API key stored in the same config file.

From a security point of view that means three things:

None of this shows up in a software inventory: there is nothing to "install". The only reliable signal is the config files, plus the child processes they spawn.

Where each client stores its MCP configuration

These paths come from each vendor's documentation (linked in the sources at the end). Check all of them; developers often use two or three clients.

ClientWindowsmacOS / LinuxKey
Claude Desktop%APPDATA%\Claude\claude_desktop_config.json~/Library/Application Support/Claude/claude_desktop_config.jsonmcpServers
Claude Code (user and local scope)%USERPROFILE%\.claude.json~/.claude.jsonmcpServers, and projects.<path>.mcpServers
Claude Code (project scope).mcp.json at the root of any repositorymcpServers
Cursor%USERPROFILE%\.cursor\mcp.json~/.cursor/mcp.json, plus .cursor/mcp.json per projectmcpServers
VS Code (workspace).vscode/mcp.json in a workspaceservers
VS Code (user profile)%APPDATA%\Code\User\mcp.json~/Library/Application Support/Code/User/mcp.json (macOS), ~/.config/Code/User/mcp.json (Linux)servers
GitHub Copilot CLI%USERPROFILE%\.copilot\mcp-config.json~/.copilot/mcp-config.jsonmcpServers
Gemini CLI%USERPROFILE%\.gemini\settings.json~/.gemini/settings.json, plus .gemini/settings.json per projectmcpServers
Codex CLI and IDE extension%USERPROFILE%\.codex\config.toml~/.codex/config.toml (or $CODEX_HOME/config.toml)TOML tables [mcp_servers.<name>]
Windsurf (Devin Desktop)%APPDATA%\devin\mcp_config.json; older builds: %USERPROFILE%\.codeium\windsurf\mcp_config.json~/.config/devin/mcp_config.json; older builds: ~/.codeium/windsurf/mcp_config.jsonmcpServers

Cline, Roo Code, Kiro, Amazon Q, Zed and LM Studio have their own files too; the full list is on MCP server config paths per AI client. Two details that trip people up. VS Code uses servers as the top-level key, everyone else uses mcpServers, so a parser that only looks for one misses half the results. And Claude Code keeps per-project servers inside ~/.claude.json under the project's path, not in the repository, so a clean repo does not mean a clean machine.

Detect MCP servers manually on Windows

Run this in a normal (non-admin) PowerShell session as the user you want to check. It reads every known config file and prints one line per server with its command and arguments, or its URL. Values that look like secrets (tokens and keys in arguments, credentials and query strings in URLs) print as ***, and env and headers are never printed.

# Values that look like secrets (tokens, keys, flag values, URL credentials and queries) print as ***.
function Hide-Secret([string[]]$a) {
  $n = 'token|key|secret|password|auth|bearer|apikey'; $f = $false
  foreach ($s in $a) {
    if ($f -or $s -cmatch '^(sk-|ghp_|gho_|github_pat_|xox[bp]-|AKIA|AIza|glpat-|hf_)[A-Za-z0-9_-]{8,}|^[A-Za-z0-9_-]{32,}$') { '***' }
    elseif ($s -match '^[a-z][a-z0-9+.-]*://') { $s -replace '://[^/@]*@', '://' -replace '\?.*', '?***' }
    elseif ($s -match '^[-\w.]+(=(?!=)|: )' -and ($s -split '[=:]')[0] -match $n) { $s -replace '^([-\w.]+(=|: )).*', '$1***' }
    else { $s }
    $f = $s -match $n -and $s -match '^-[^=]*$|:$|^bearer$'
  }
}
$paths = @(
  "$env:APPDATA\Claude\claude_desktop_config.json",
  "$env:USERPROFILE\.claude.json",
  "$env:USERPROFILE\.cursor\mcp.json",
  "$env:APPDATA\Code\User\mcp.json",
  "$env:USERPROFILE\.copilot\mcp-config.json",
  "$env:USERPROFILE\.gemini\settings.json",
  "$env:APPDATA\devin\mcp_config.json",
  "$env:USERPROFILE\.codeium\windsurf\mcp_config.json"
)
$found = foreach ($p in $paths) {
  if (-not (Test-Path $p)) { continue }
  try { $j = Get-Content $p -Raw | ConvertFrom-Json } catch { Write-Warning "Unparseable: $p"; continue }
  $sets = @($j.mcpServers, $j.servers)
  if ($j.projects) { $j.projects.PSObject.Properties | ForEach-Object { $sets += $_.Value.mcpServers } }
  foreach ($s in $sets) {
    if (-not $s) { continue }
    $s.PSObject.Properties | ForEach-Object {
      $v = $_.Value
      $target = if ($v.url) { Hide-Secret $v.url } else { (@($v.command) + @(Hide-Secret $v.args)) -join ' ' }
      [pscustomobject]@{ File = $p; Server = $_.Name; Target = $target }
    }
  }
}
$found | Format-Table -AutoSize -Wrap

Example output: C:\Users\ana\.cursor\mcp.json github npx -y @modelcontextprotocol/server-github. No output means none of these files define a server for this user. Codex keeps its servers in TOML, which the script above does not parse; list their names with:

$t = "$env:USERPROFILE\.codex\config.toml"
if (Test-Path $t) { Select-String -Path $t -Pattern '^\s*\[mcp_servers\.([^\].]+)\]' | ForEach-Object { $_.Matches[0].Groups[1].Value } }

Then look for project-level files in the places developers keep code. Scanning the whole disk is slow; the user profile is usually enough, as long as you skip AppData and dependency caches (a naive recursive scan of a developer profile can take minutes; this one takes seconds):

$skip = 'AppData','node_modules','.git','.cache','.npm','.nuget','.vscode-server','scoop','go'
@(Get-Item "$env:USERPROFILE\.mcp.json", "$env:USERPROFILE\mcp.json" -Force -ErrorAction SilentlyContinue) +
@(Get-ChildItem $env:USERPROFILE -Directory -Force -ErrorAction SilentlyContinue |
  Where-Object { $_.Name -notin $skip } |
  Get-ChildItem -Recurse -Force -File -Filter '*mcp.json' -Depth 6 -ErrorAction SilentlyContinue) |
  Where-Object { $_ -and $_.Name -in '.mcp.json','mcp.json' -and $_.FullName -notmatch '\\node_modules\\' } |
  Select-Object FullName, LastWriteTime

Finally, catch what is running right now. Stdio servers are children of the client process, so list node, npx, uvx, python and docker processes together with their parent (secret-looking arguments are masked the same way):

# Uses Hide-Secret from the first snippet (run that first): secret-looking arguments print as ***.
$procs = Get-CimInstance Win32_Process
$byId = @{}; $procs | ForEach-Object { $byId[$_.ProcessId] = $_ }
$procs | Where-Object { $_.Name -match '^(node|npx|uvx|uv|python|docker)(\.exe)?$' } |
  ForEach-Object {
    $parent = $byId[$_.ParentProcessId]
    [pscustomobject]@{ PID = $_.ProcessId; Parent = $parent.Name; CommandLine = (Hide-Secret ("$($_.CommandLine)" -split ' ')) -join ' ' }
  } | Where-Object { $_.Parent -match 'Claude|Cursor|Code|Windsurf|Devin' } | Format-List

A command line that contains @modelcontextprotocol/, mcp-server or -mcp is almost always an MCP server. Electron clients sometimes spawn servers through an intermediate helper process, so if the parent filter returns nothing, drop the last Where-Object and read the command lines directly.

Product page: MCP server inventory for endpoints (what Kuntur records for each server, on Windows, macOS and Linux).

Detect MCP servers manually on macOS and Linux

The same checks in bash, using jq (install it with Homebrew or your package manager if it is missing):

# Values that look like secrets (tokens, keys, flag values, URL credentials and queries) print as ***.
M='def sn: test("token|key|secret|password|auth|bearer|apikey"; "i");
   def url: sub("://[^/@]*@"; "://") | sub("\\?.*"; "?***");
   def mask: reduce (.[] | tostring) as $s ({o: [], f: false};
     .o += [if .f or ($s | test("^(sk-|ghp_|gho_|github_pat_|xox[bp]-|AKIA|AIza|glpat-|hf_)[A-Za-z0-9_-]{8,}|^[A-Za-z0-9_-]{32,}$")) then "***"
            elif ($s | test("^[a-z][a-z0-9+.-]*://"; "i")) then ($s | url)
            elif ($s | test("^[-\\w.]+(=(?!=)|: )")) and ($s | sub("[=:].*"; "") | sn) then ($s | sub("^(?<k>[-\\w.]+(=|: )).*"; "\(.k)***"))
            else $s end]
     | .f = ($s | sn and test("^-[^=]*$|:$|^bearer$"; "i"))) | .o;'
for f in \
  "$HOME/Library/Application Support/Claude/claude_desktop_config.json" \
  "$HOME/.claude.json" \
  "$HOME/.cursor/mcp.json" \
  "$HOME/Library/Application Support/Code/User/mcp.json" \
  "$HOME/.config/Code/User/mcp.json" \
  "$HOME/.copilot/mcp-config.json" \
  "$HOME/.gemini/settings.json" \
  "$HOME/.config/devin/mcp_config.json" \
  "$HOME/.codeium/windsurf/mcp_config.json"; do
  [ -f "$f" ] || continue
  echo "== $f"
  jq -r "$M"'[.mcpServers, .servers, (.projects // {} | .[].mcpServers)]
         | map(select(. != null) | to_entries[]) | .[]
         | "\(.key)\t\(if .value.url then (.value.url | url) else ([.value.command] + (.value.args // [] | mask) | join(" ")) end)"' "$f" \
    || echo "   (unparseable JSON)"
done

Codex servers, by name only (the file is TOML, not JSON):

f="${CODEX_HOME:-$HOME/.codex}/config.toml"
[ -f "$f" ] && sed -nE 's/^[[:space:]]*\[mcp_servers\.([^].]+)\].*/\1/p' "$f"

Project files under the home directory:

find "$HOME" \( -name node_modules -o -name Library \) -prune -o \
  \( -name '.mcp.json' -o -path '*/.cursor/mcp.json' -o -path '*/.vscode/mcp.json' \) -print 2>/dev/null

And running stdio servers, shown with their parent process:

# Uses $M from the first snippet (run that first): secret-looking arguments print as ***.
ps -axo pid=,ppid=,command= | grep -Ei 'mcp|modelcontextprotocol' | grep -v grep |
  while read -r pid ppid cmd; do
    printf '%s\tparent=%s\t%s\n' "$pid" "$(ps -o comm= -p "$ppid")" \
      "$(printf '%s' "$cmd" | jq -Rr "$M"'split(" ") | mask | join(" ")')"
  done

What to look for in the results

Doing it across a fleet: Intune, GPO, Jamf

All of the files above live in the user profile, so collection has to run in the user's context, not as SYSTEM or root.

The limits are worth stating plainly. Scripts give you a point-in-time snapshot. Each new client adds a new path you have to know about. Project files in folders outside the profile (a D:\src drive, a WSL distro, a dev container) are missed unless you look there. And parsing output from hundreds of remediation runs into a usable list is the part that eats the afternoon.

Found a config and want a second opinion? Paste it into the free MCP config auditor: it flags plaintext secrets (masked), unpinned packages, broad file access and insecure remotes in your browser. The risks themselves are explained in MCP server security risks: a checklist, and the review to run before approving a new server is in How to vet MCP servers.

From one laptop to an inventory of every MCP server

If the question is "how do I inventory all the MCP servers in my environment?", the scripts above are step one. The rest is bookkeeping:

  1. Collect per user, per machine. Run the script in the user's context from your MDM or RMM and keep the file path, server name and command or URL. Do not collect env or headers values.
  2. Group by what runs, not by name. Two people can call different packages github. Use the package and version, the image, the binary or the remote host as the identity.
  3. Record a decision for each identity. Approved or unauthorized, who decided and when. Keep it apart from the raw scan data so a rescan does not overwrite it.
  4. Refresh it. Developers add a server in two lines of JSON. A list older than a week is already incomplete.

The fields to record and two fleet collectors are in MCP server inventory across your fleet. If you would rather not maintain scripts, Kuntur's MCP server inventory does these four steps on its own.

Automate it

To check a single Windows machine without writing anything, run the free Kuntur scanner in PowerShell. It runs locally, needs no account or admin rights, and writes an HTML report to the Desktop listing MCP servers along with AI apps, CLIs, extensions and local models. It does not upload results.

  1. Download scan.ps1.
  2. Read it. It's plain text; here's what it does.
  3. Check its SHA-256 against the published hash: Get-FileHash .\scan.ps1 -Algorithm SHA256
  4. Run it: powershell -ExecutionPolicy Bypass -File .\scan.ps1

Windows shortcut, if you trust the source (PowerShell)

irm https://app.kuntur.io/scan.ps1 | iex

You can download and read the script first; what it does is documented.

For a fleet, the Kuntur agent (Windows, macOS, Linux) reports MCP servers continuously from every user profile, together with the rest of the AI tools on each endpoint, and lets you mark each one approved or unauthorized with an audit trail. In the console, servers are grouped by identity with the endpoints, users and clients that carry each one, and a new server can trigger an email, Slack, Teams or webhook alert. When an auditor asks how you control MCP servers, the audit evidence pack exports those decisions with who made them and when. It does not block or remove anything; enforcement stays with your existing tools, such as the Claude Code managed policy above. Rollout uses the same Intune, GPO and MDM paths described in the deployment guides. Free up to 5 endpoints; the 14-day trial covers up to 25 with no card.

Start free trial See MCP servers in the live demo

FAQ

How do I inventory all MCP servers running in my environment?
Run a read-only script in each user's context that reads every client's MCP config file (Claude Desktop, Claude Code, Cursor, VS Code, Gemini CLI, Codex and others) and lists running stdio servers. Collect the output through your MDM or RMM, group servers by the package, image or remote host they run, record an approval decision per server, and refresh at least weekly. An endpoint agent such as Kuntur does this continuously.
Where does Codex CLI keep its MCP servers?
In ~/.codex/config.toml (or $CODEX_HOME/config.toml), as TOML tables named [mcp_servers.<name>] with command, args and env keys. JSON parsers miss it, so read it separately.
Does the script print API keys or tokens?
No. env and headers are never printed, and arguments or URLs that look like secrets are replaced with ***. Review the output before sharing it anyway, because a token with an unusual format can slip past any pattern.
Where is the Claude Desktop MCP config file?
On Windows it is %APPDATA%\Claude\claude_desktop_config.json; on macOS it is ~/Library/Application Support/Claude/claude_desktop_config.json. Servers are listed under the mcpServers key.
Can I see which MCP servers are actually running, not just configured?
Partly. Stdio servers run as child processes of the AI client, so you can find them by walking the process tree (node, npx, uvx, python or docker under Claude, Cursor or Code). Remote HTTP servers have no local process; you only see them in config files and network traffic.
Is there a way to block MCP servers centrally?
For Claude Code, yes: a managed-mcp.json in a system path takes exclusive control, and an empty mcpServers map disables MCP. VS Code and GitHub Copilot have organization allowlists. Other clients have no equivalent policy today, so inventory is the only control.
Does a project .mcp.json run automatically?
Claude Code asks for approval before using project-scoped servers from .mcp.json. That prompt is the control, so a repository that ships a .mcp.json is still worth flagging in code review.

Sources

  1. Model Context Protocol: Connect to local MCP servers (Claude Desktop config paths)
  2. Claude Code docs: Connect Claude Code to tools via MCP (scopes, ~/.claude.json, .mcp.json)
  3. Claude Code docs: Control MCP server access for your organization (managed-mcp.json)
  4. Cursor docs: Model Context Protocol
  5. VS Code docs: Add and manage MCP servers
  6. VS Code docs: MCP configuration reference
  7. Gemini CLI docs: MCP servers (settings.json)
  8. OpenAI Codex docs: Model Context Protocol (config.toml)
  9. Devin Desktop / Windsurf docs: Cascade MCP
  10. OWASP GenAI: A practical guide for secure MCP server development

More guides: