Subscribe to the Non-Human & AI Identity Journal

How should security teams govern AI agents that access APIs through GraphQL and MCP?

Security teams should govern the agent, the transport, and the schema as one access path. MCP determines how the agent reaches the system, while GraphQL determines what the agent can understand and query. Treat the schema as part of the authorization boundary, review field exposure by business sensitivity, and restrict composition paths that let an agent assemble more context than the workflow requires.

Why This Matters for Security Teams

GraphQL and MCP create a compound access path, and autonomous agents exploit the gaps between transport control, schema exposure, and downstream authorization. That is why the agent must be governed as a workload identity, not just as an API client. Current guidance from OWASP Agentic AI Top 10 and CSA MAESTRO agentic AI threat modeling framework is moving toward runtime authorization, because static roles do not describe goal-driven behaviour well enough. A role can permit a tool call, but it cannot express whether the agent should see a billing field, customer notes, or a hidden mutation path during a specific task.

That matters because agentic systems can chain calls, infer hidden relationships, and expand context in ways that a human workflow never would. NHI governance also applies here: the agent’s tokens, secrets, and tool permissions are part of the identity surface, which is why NHI control thinking from OWASP NHI Top 10 remains relevant. In practice, many security teams first discover overbroad agent access after sensitive GraphQL fields have already been queried or MCP tools have already been chained.

How It Works in Practice

The operational model is to treat MCP as the agent’s execution lane and GraphQL as the data and action contract, then enforce policy at both layers. Use NIST AI Risk Management Framework principles to assign ownership for the agent, define acceptable tasks, and require request-time policy checks. In practice, that means the agent proves its workload identity, receives a short-lived credential for the task, and is evaluated against policy before every tool call or GraphQL operation.

Security teams should narrow the schema to the minimum business function and treat field-level exposure as an authorization decision, not a design afterthought. That often includes:

  • Restricting GraphQL introspection in production or limiting it to approved operational users.
  • Separating read and mutation paths so the agent cannot move from query to action without explicit approval.
  • Issuing JIT credentials with short TTLs and revoking them when the task ends.
  • Binding MCP tool permissions to the specific workflow, not to the agent generally.
  • Logging every field, tool, and downstream API accessed for audit and replay.

For implementation patterns, NHIMG’s Ultimate Guide to NHIs and Analysis of Claude Code Security both reinforce the same point: the agent needs cryptographic workload identity, not a standing credential that can be reused beyond intent. These controls tend to break down when GraphQL schemas are deeply nested and MCP servers are shared across many teams, because the effective permission boundary becomes too large to reason about at request time.

Common Variations and Edge Cases

Tighter schema and tool control often increases integration overhead, requiring organisations to balance agent usefulness against security precision. There is no universal standard for how much GraphQL introspection an autonomous agent should receive, so current guidance suggests starting with deny-by-default for sensitive fields and expanding only when a workflow proves stable. The same caution applies to MCP: a tool catalog that is convenient for development can become an overexposed capability set in production.

Edge cases usually appear when the agent needs to operate across multiple systems or when a single prompt can trigger both discovery and execution. In those environments, RBAC alone is too coarse, because it grants access based on job title rather than task context. A better pattern is intent-based authorisation with policy-as-code, backed by ephemeral secrets and a workload identity primitive such as SPIFFE or OIDC. That aligns with NIST Cybersecurity Framework 2.0 and the operational focus in OWASP Non-Human Identity Top 10.

The practical rule is simple: if the agent can infer more than the workflow needs, the schema is too open; if the agent can keep using the same secret after the task, the credential lifetime is too long. That guidance becomes less reliable in highly dynamic, multi-tenant platforms where shared MCP infrastructure and federated GraphQL gateways make per-request policy enforcement difficult.

Standards & Framework Alignment

This section maps relevant standards and security frameworks to the operational risks and controls described in this guidance.

OWASP Agentic AI Top 10 and CSA MAESTRO address the attack and risk surface, while NIST AI RMF set the governance and control requirements practitioners need to meet.

Framework Control / Reference Relevance
OWASP Agentic AI Top 10 A2 Agentic apps need runtime limits on autonomous tool use and schema exposure.
CSA MAESTRO T1 MAESTRO maps agent threats across identity, tools, and data paths.
NIST AI RMF AI RMF supports governance, measurement, and accountability for autonomous agents.

Constrain each agent action to approved intent, then block extra tool or field access by default.