Skip to main content
Cursor is a code editor with an AI agent that can read repositories, edit files, run shell commands, and call external tools on a developer’s machine. TrustGuard firewall hooks evaluate local prompts and actions.

NeuralTrust controls

The trustguard-cursor-plugin package provides the firewall hooks and can also register TrustGate as an MCP server. Configure the two functions independently.

Deployment options

Use separate credentials for TrustGuard and TrustGate. The hooks use a tgk_… collector key in cursor.json. MCP authenticates as a consumer with OAuth or an ag_… API key. A tgk_… key does not authenticate MCP, and cursor.json does not accept MCP settings.

Before you start

Create the policy in Observe mode. Observe records decisions in Activity without enforcing them. Review the results, then switch the policy to Enforce. See Policies.
Developers do not need NeuralTrust accounts for the firewall path.

Set up prompt and tool screening (TrustGuard)

Install the plugin

In Customize → Plugins, import the trustguard-cursor-plugin repository from GitHub or a Git URL. Exact UI labels vary by Cursor version. Teams can distribute the plugin through the Cursor Team Marketplace. For an offline pilot, or to use Customize → Plugins → Add → From Local Repo, clone the repository locally:
make install-local copies the plugin into ~/.cursor/plugins/local/trustguard. Cursor rejects out-of-tree symlinks.

Deploy the managed config

Deploy this file with MDM:
On first use, the plugin bootstrap downloads the checksum-pinned trustguard-cursor binary from GitHub Releases. MDM can deploy the config file; distribute the plugin package separately if you need to pin a private fork. For pilots without MDM, write the same JSON shape to ~/.trustguard/cursor.json and chmod 600 it.

Set up governed tool access (TrustGate)

Cursor treats TrustGate as a remote MCP server: one url per MCP consumer, and the agent sees the merged toolkit that consumer is routed to. Copy the endpoint or Cursor snippet from the consumer’s Connect tab:
Register it from plugin variables or from mcp.json, but not both. Two entries pointing to the same URL duplicate every tool.

Option A: plugin variables

The same plugin registers a remote MCP server named TrustGate. Values are Cursor plugin variables (Customize → Plugins → Configure), not cursor.json: OAuth consumers need only the URL. Cursor starts the login flow on first tool use. A team admin can set the variables for a Team Marketplace installation.

Option B: mcp.json

Write the server into .cursor/mcp.json (project) or ~/.cursor/mcp.json (global). Cursor loads both files; see Configuration for precedence. OAuth consumers (recommended). Omit headers and let Cursor run the handshake:
Open Customize in the sidebar to find the server and complete the login. Cursor stores the tokens; the tools then show up under Available Tools in chat. API-key consumers. Send the consumer key as a header:
Cursor resolves ${env:VAR} in url and headers, so a committed project file does not contain the secret. Export the variable through a shell profile or your secret-management tooling, then reload the window. Private (Hybrid) data plane. Add the gateway slug unless the MCP host already scopes the gateway:
For OAuth consumers on Hybrid, send X-AG-Gateway-Slug alone. After editing mcp.json, refresh the server (or toggle it off and on) in Customize. Editing the file alone does not reconnect an already-loaded server.

Team rollout

For a team rollout, register the consumer in the Cursor dashboard instead of requiring each developer to edit mcp.json: Allowlisting approves a configuration; it does not install or enable the server. Keep the tool scope on the consumer or role. The Cursor-side tool allowlist governs automatic execution, not what the agent can see.

Verify

Firewall.
  1. Open Cursor and send a test prompt.
  2. Confirm the event in TrustGuard Activity.
  3. consumer_id is typically cursor:<email> when the Cursor account email is present.
Smoke-test the binary (optional):
MCP.
  1. Confirm TrustGate is enabled under Customize → MCP, and that its tools appear under Available Tools in chat.
  2. Ask the agent to list or use a tool from a toolkit bound to that consumer.
  3. Confirm the call in TrustGate telemetry. See Metrics.
For connection or auth failures, open the Output panel (Cmd+Shift+U) and select MCP Logs.

Reference

Coverage

TrustGuard evaluates Cursor prompts, tool calls, and tool results on the developer’s machine. Ask. Cursor displays an approval prompt for Ask on tool calls. The prompt reads A TrustGuard policy needs your approval to continue. rather than the gate name. At beforeSubmitPrompt, Ask submits the prompt with a warning because no approval dialog is available. Use Block to stop a prompt. Limits. This collector does not support redaction. transform maps to ask by default, so a masking policy becomes a warning unless transform_action: "deny" is set. postToolUse is warn-only. A finding is added as untrusted context; no permission decision is emitted, and the completed tool call cannot be revoked. The hooks do not evaluate model responses or tool declarations. Use TrustGate to control which tools are available. Full comparison: Coverage.

What is evaluated

Every hook calls POST /v1/evaluate with the collector tgk_… key, and the policy’s detectors decide the verdict. MCP tool calls pass through the hooks like any other tool call. For a hook name such as mcp__<server>__<tool>, tool.name is the final <tool> segment. It does not include the server name. Gate on the short tool name, not the full hook tool_name.

Configuration

cursor.json (TrustGuard firewall only). Keys: data_url, api_key, fail_mode. It never holds MCP values. When the managed file includes api_key:
  • Locked: api_key, data_url, fail_mode. A user file and environment variables cannot replace them.
  • User-overridable settings may still be loaded from ~/.trustguard/cursor.json: timeout_ms, transform_action, events, consumer_id.
Without a managed file, all configuration is loaded from ~/.trustguard/cursor.json (chmod 600). mcp.json (TrustGate only). Two scopes are loaded: When the same server name exists in both, the project configuration takes precedence in that workspace. Cursor infers the transport from the keys: url means remote, and command means local. Do not mix them in one entry. TrustGate always uses url. Auth headers. TrustGate accepts X-AG-API-Key, x-api-key, or Authorization: Bearer ag_…. For OAuth it advertises discovery at /.well-known/oauth-authorization-server and /.well-known/oauth-protected-resource and supports dynamic client registration. The Cursor configuration does not require a client ID or secret. Cursor authenticates from two fixed callbacks: https://www.cursor.com/agents/mcp/oauth/callback (web and Cloud Agents) and http://localhost:8787/callback (desktop). TrustGate accepts both, so they do not need to be allowlisted per developer. Cursor’s static auth block (client ID and secret) is for providers without dynamic registration and is not needed here. The consumer configuration determines which IdP handles the login. See Auth.
Use OAuth for consumers that resolve tools per user. The identity used to log in selects the roles, and therefore the registries and tools, on Identity-based consumers.
Authenticating to TrustGate is not the same as authenticating to the upstream servers. When a registry uses OAuth (forwarded), the first call for a user without a stored credential returns a connect link; the user authorizes once and TrustGate stores and refreshes the credential. Deployment ownership.

Tools and approvals

TrustGate defines the consumer’s tool set. Cursor applies additional settings on the local machine: Cursor Run Mode and server visibility apply only to the local client. Configure restrictions that must apply to every client on the consumer or role. To limit MCP tool calls, attach the Per-Tool Rate Limiter policy. The Tool Injection policy is LLM-only and does not affect MCP.

Attributes

  • attributes.collector.type = "ide"
  • attributes.source.application = "cursor-plugin"
  • attributes.cursor.event, workspace, and related fields
  • consumer_id typically cursor:<email>
Every decision appears in Activity under that consumer_id, providing per-developer attribution when the email is available. Gate on source.application and/or tool.name / tool.command. Do not rely on attributes.tool for MCP preToolUse; the name is on the payload.

Troubleshooting