# Find the MCP servers on your devices

> List every MCP server your users' AI tools are configured with, on which machine, in which tool, and what it runs or reaches.

Your security team asks which MCP servers your users' AI tools are connected to, and whether any of them reach
something nobody approved. Your realm's AI fleet already holds the answer for every approved device: each tool's MCP
servers, by name, transport, and the command it runs or the address it reaches.

## Before you start

- You hold a privilege that reads the realm's configuration, such as `RealmViewer` or `RealmOwner`, with your session
  in `$CVYUH_SESSION` ([Call the API](../../../develop/api/)), and `jq` to read the answers.
- Your devices are enrolled and approved for AI governance; see
  [Get started with AI Governance](../../get-started/).

## Find them

<Steps>

1. **List the fleet's devices**, and keep their fleet device ids:

   ```sh
   curl -s https://foobar.cvyuh.com/api/v0/endpoint/aig/v1/api/v1/devices \
     -H "Cookie: x-cvyuh-token=$CVYUH_SESSION" | jq -r '.[].id' > devices.txt
   ```

2. **Read each device's tools, and print one line per MCP server:** the machine, the tool, the server's name, its
   transport, and the command it runs or the address it reaches:

   ```sh
   while read -r id; do
     curl -s "https://foobar.cvyuh.com/api/v0/endpoint/aig/v1/api/v1/devices/$id" \
       -H "Cookie: x-cvyuh-token=$CVYUH_SESSION" |
       jq -r '.hostname as $h | .discoveries[] | .kind as $k | .mcp_servers[]
              | [$h, $k, .name, .transport, (.url // .command), (if .enabled then "on" else "off" end)] | @tsv'
   done < devices.txt
   ```

   ```
   maya-laptop   claude-code   github     http    <server address>   on
   ben-laptop    cursor        tickets    stdio   <command>          on
   ```

3. **Look for what you didn't expect.** A server reached over `http` or `sse` shows where your users' tools send
   their calls; a `stdio` server shows a program they run on the laptop. The fleet record's `source` on each server
   names the settings file it came from, so you can tell the user exactly where to remove it.

4. **Look for keys in addresses.** An address is sent as written, so a key placed in its query shows here. List the
   ones that carry a query:

   ```sh
   while read -r id; do
     curl -s "https://foobar.cvyuh.com/api/v0/endpoint/aig/v1/api/v1/devices/$id" \
       -H "Cookie: x-cvyuh-token=$CVYUH_SESSION" |
       jq -r '.hostname as $h | .discoveries[] | .kind as $k | .mcp_servers[]
              | select((.url // "") | contains("?") or contains("@")) | [$h, $k, .name, .source] | @tsv'
   done < devices.txt
   ```

   Ask each user to move the key into the server's headers or environment, in the file named last.

</Steps>

<Aside type="note" title="What reaches the realm">
  The server's name, transport, command or address, whether it's enabled, and its settings file reach the realm. Its
  arguments, environment and headers never leave the device. The address and command are sent as written.
</Aside>

## Check it worked

Add an MCP server to a tool on one device, wait a minute or two, and run step 2 again: the new server is listed. The
AI tools agent looks again soon after a settings file changes, and every 15 minutes regardless.

## Undo it

Nothing to undo: these calls only read. Delete `devices.txt` when you're done.

## Related

- [MCP servers and skills](../../discovery/mcp-and-skills/): what's listed for each, and what's left out.
- [Supported tools](../../discovery/supported-tools/): which tools' MCP servers are found.
- [Fleet records](../../fleet/fleet-records/): every call the fleet answers.
- [Protect an MCP server](../../../gateway/guides/protect-an-mcp-server/): for the MCP servers you run, decide each
  tool call at the gateway.
