Skip to content
Smartplane

How to Find and Govern Shadow AI Agents in Your Company

How to find and govern shadow AI agents: inventory MCP configs, keys and OAuth grants, then put what you keep on one gateway.

By Smartplane team

Back to blog

How to find and govern shadow AI agents in your company is an inventory, a decision on each row, and one path for whatever you keep. A shadow agent can call a tool, or hold a credential that calls one, while the company never granted that call, cannot name an owner, or has no log of what it did. You find them in MCP configs, OAuth app grants, API keys, egress and proxy logs, and IDE extensions. You shut off what has no owner, and you put the rest behind one gateway that can take the access back.

What counts as a shadow AI agent?

An approved chatbot on the company account is not the problem by itself. The problem is an identity that can act. A config that starts a local MCP server, an OAuth grant that lets an app read mail, an API key in a shell profile, and an editor extension that posts to a model are the same shape: something can reach a system, and the grant list does not mention it.

NIST AI RMF 1.0 puts the inventory in GOVERN 1.6: mechanisms are in place to inventory AI systems, and they are resourced according to organizational risk priorities. A policy that names "approved AI," and a folder nobody updates, is not that mechanism. For each agent the inventory has to say who owns it, what it can call, which credential it uses, and where the record of those calls lives.

OWASP ASI03, Identity and Privilege Abuse, treats identity as the agent's persona and as the material that stands for it: API keys, OAuth tokens, and delegated sessions. Without a distinct, governed identity, least privilege cannot be enforced. A key pasted into a config is an identity the directory cannot revoke.

NIST's design tenets for agent identity make that an engineering list. The agent has an identity you can tell apart from the human and from a shared service account. Should AI agents have their own identity or act on behalf of the user? is when that identity stands alone, when the call carries the user's delegation, and when you record both. Access is least privilege, short-lived, and revocable. The policy that allows a call sits outside the model. The log is append-only, and the agent cannot edit it. A laptop config meets none of those by default.

Where do you look?

Search five places, in this order, and repeat the search. GOVERN 1.6 is a resourced mechanism, not a spreadsheet filled from memory.

MCP configs. Editors and agents read a local JSON file that names each server, how to start it, and which environment variables to pass. Search laptops and repositories for mcpServers, for files named mcp.json, and for config checked in next to the code. A hit is any server the company did not register. A command that runs a package stores a credential on that machine. A URL you do not operate is a shared server whose tool list you have not reviewed.

How to secure an MCP server is the checklist for a server you keep: who may connect, which token it accepts, and which calls it runs. The security best practices forbid accepting a token that was not issued for that server, and forbid forwarding the caller's token upstream. A config that does either comes off the laptop.

OAuth app grants. In the identity provider and in each SaaS admin console, list user-consented apps and admin-consented apps added outside the ticket queue. Google Workspace, Microsoft Entra ID, GitHub, Slack, and Notion are the usual set. Record the scopes. Mail read, and a repository scope that includes administration, are different findings from a profile read. A user's own consent ends when you revoke that user. An admin grant for the tenant keeps working after they leave.

API keys and tokens. Search secret stores, .env files, CI variables, shell profiles, and the password manager for keys to model APIs, warehouses, payment, and source control. A key issued to "the platform bot" and copied onto three laptops is one credential with three homes. Record the issuer, the last rotation if you have it, and every place the value sits. A key with no owner is a shut-off, before you know which agent uses it.

Egress and proxy logs. A config search misses an agent that was set up by hand and never committed. Look at outbound calls from developer machines and from CI to model hosts, MCP endpoints, and SaaS APIs with no matching grant. Record the destination, the volume, and the process, not the contents of the prompt. Pair a new destination with the person or the build that opened it. A destination you cannot name is a row.

IDE extensions and desktop agents. List extensions that are not on the company allow-list, and desktop apps that register a local server. The MCP specification treats tool descriptions as untrusted unless they come from a server you trust, and it says the protocol cannot enforce that. An extension you did not review is an untrusted server already on the machine.

What do you write down for each one?

Each finding becomes one row. Two reviewers should fill it in the same way.

FieldWhat to record
WhereLaptop, repo path, IdP app, CI variable, or log source
WhoThe person who added it, or "unknown"
What it can callTools, scopes, or hosts, named
CredentialPersonal token, shared key, or admin consent
LogWhere calls are recorded, or "none"
DataProduction, customer, source, or a sandbox
DecisionKeep, move, or shut off

"Unknown" is a complete answer. It shuts the agent off until someone claims the row.

This sketch is one editor config. It is an inventory finding, not a product file format.

{
  "where": "laptop mcp config",
  "who": "platform engineer",
  "mcpServers": {
    "orders": {
      "command": "npx",
      "args": ["-y", "postgres-server"],
      "env": {
        "DATABASE_URL": "postgres://admin:pw@prod-db:5432/app"
      }
    }
  },
  "log": "none",
  "decision": "move"
}

That URL is a production credential on a laptop, in a file the model can read, with no log. The decision is to take the credential off the laptop.

Which agents do you shut off?

Triage has three outcomes. Keep is rare on the first pass. Move is for a useful agent whose credential and tool list you will own. Shut off is the default when a field is unknown.

Shut off when any of these are true:

  • Nobody will put their name on the row.
  • The credential is shared, long-lived, and copied in more than one place.
  • The tools include production write, payment, or a shell, with no separate approval for that call.
  • The server forwards the caller's token upstream.
  • There is no log, and the data is customer or production data.
  • The person who added it has left, and the grant is still live.

OWASP LLM06:2025, Excessive Agency, splits the failure into too many tools, too much permission, and too much autonomy. A shadow config usually has all three: every upstream operation, an admin key because it was the one at hand, and a model that picks the next call alone. Shutting it off removes the autonomy. Moving it removes the extra tools and the extra permission.

Revoke at the issuer first, so a copy in a second file dies with the key. Then remove the config and the extension, and confirm the egress row goes quiet. Record the revoke on the same row, with the time and the person who did it. For a personal sandbox credential, tell the owner before you revoke it. For anything that can reach production, revoke it and tell them the same day.

How do you govern what you keep?

What you keep needs a home that is not a laptop file. The NIST tenets ask for a distinct identity, least privilege, grants that expire and can be revoked, a policy check outside the model, monitoring, and an append-only record the agent cannot edit. One gateway is how a company meets that list once.

How to secure AI agent access in your company is that move. Agents connect to one MCP endpoint. Administrators register tools, MCP servers, skills, databases, and APIs once, and grant them to a person, a team, a role, or a project, down to one tool, with an end date. The agent lists only what that member may use. The gateway holds the upstream credential, injects it for the call, and returns the result. The plaintext stays off the laptop and out of the model.

The grant answers which tools appear. The call is a second question. RBAC vs ABAC for AI agents separates them. A support role may include orders.read and stripe.refund, and the amount, the folder, or the branch still decides whether this call may run.

Guard rules are that second check, in plain language, before the call. The classifier sees the tool, the arguments, and the member, and not the secret used to run the call. Start in monitor mode so matching calls are allowed and flagged. When the rule behaves, enforce it. An enforcing rule fails closed: if the check is down or returns something unexpected, the action is denied and the denial is logged.

NIST's separation tenet is why the check sits outside the model. The model takes instructions and data as one stream, so a prompt hidden in tool output can ask for a wider action. LLM01:2025, Prompt Injection, is that failure. The tools specification tells the server to validate inputs, enforce access controls, rate-limit calls, and sanitize outputs. The grant and the rule are those controls.

A refund over a threshold, a deploy, or a delete waits for a person who is not the requester. Reads the role already allows can run. If every call waits, people approve from habit, which is the fatigue NIST's human-review tenet names. Keep the person on the calls that are hard to undo.

Directory deactivation, over SSO and SCIM, revokes the membership, the tokens, the grants, the teams, and the personal connected accounts in one path. A token that outlives its owner is the same agent, under a name that no longer matches an employee. Tokens are stored as a hash, they expire, and they die with the membership. The MCP authorization specification requires a bearer token on each HTTP request, in the header, issued for that server. A CI job gets its own credential, with an expiry, separate from any engineer's session.

What does the log have to show?

If you cannot say what this agent did on Tuesday, the move is unfinished. NIST's immutable-evidence tenet asks for a tamper-evident, append-only record of identity, delegated intent, and actions, held where the agent cannot change it. One log covers tool calls, denials, approvals, grant changes, and sign-ins. Each event carries the hash of the one before it. Secret values stay out. A delivery records which secret, to whom, and when. Export a window and check it offline. The inventory row points at that log, and a side spreadsheet stops being the record.

The first inventory finds what is already there. Egress, new OAuth grants, and new MCP configs have to keep producing rows, or the next laptop rebuilds the shadow path over a weekend. GOVERN 1.5 is the matching line in the AI RMF: ongoing monitoring and periodic review, with named roles and a frequency.

What does a first pass check off?

CheckWhat good looks like
MCP configsEvery server is on a row, with an owner and a decision
OAuth grantsScopes are listed; admin-consent apps have a ticket
API keysEach key has one home, an owner, and a rotation date
EgressUnmatched destinations become rows within the week
ExtensionsAnything off the allow-list is removed or owned
CredentialProduction secrets are off laptops and out of the model
GrantTools are granted to a person, team, role, or project
RuleRisky calls are monitored, then enforced, and fail closed
OffboardingDirectory removal revokes tokens, grants, and connected accounts
LogCalls, denials, and grant changes are append-only

A first pass that fills the table and shuts off the unknown rows is done. A first pass that writes a policy and leaves the configs in place is a document.

Frequently asked questions

Is a personal chatbot account a shadow agent?

It is unsanctioned use of a model. It becomes a shadow agent when a connector, an MCP server, or an API key can reach company systems. A chat window with no connector is a question about pasted text. A credential is an access question, and it goes on the inventory.

Can a written policy replace the gateway?

A policy says what people may add. It does not revoke a key, hide a tool, or record a call. Keep the policy. Put the credential and the check on the gateway, where a revoke reaches the next call.

Should every call wait for approval?

Reads the role already allows can run. Deletes, payments, and anything hard to undo wait for someone who is not the requester. A queue of everything gets approved unread.

What if the only copy of the workflow is on one laptop?

Move it or shut it off. Register the upstream on the gateway, grant it to the owner, and delete the local credential. Until then the laptop is the production path, and the path leaves with the laptop.

Where do you put the ones you keep?

Smartplane is the gateway those rows move to. Agents connect to one MCP endpoint. You register each tool, MCP server, skill, database, and API once, and you grant it to a person, a team, a role, or a project. Databases answer reads unless you grant writes. Guard rules run in monitor mode until you enforce them, and an enforcing rule fails closed. A call that should sometimes proceed waits for approval from someone who is not the requester. Sign-in uses the work account. Deactivation in Okta, Entra ID, or Google Workspace, over SSO and SCIM, revokes the membership, the tokens, the grants, the teams, and the personal connected accounts together. The audit log is append-only and hash-chained, and secret values stay out of it.

The inventory stays yours to run. The gateway does not walk the laptops. A kept row goes there, so the next search finds a grant and a log. The security page is the control list. The product is the endpoint you put in the client, in place of the key you revoked.