NeuralTrust controls
Use the TrustGuard plugin to evaluate individual actions. Add TrustGate when
Claude Code needs controlled access to MCP tools. Each has its own configuration
and credentials.
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 to use the TrustGuard plugin.
An OAuth-backed MCP application requires a login against the identity provider it
trusts.
TrustGuard plugin
The Claude Code plugin registers lifecycle hooks on the developer’s machine. Before an action runs, each hook callsPOST /v1/evaluate with a collector
tgk_… key. Unlike the Enterprise inference
hook, the plugin receives shell
commands and supports Ask on tool calls.
Hooks fire only when all three pieces are present:
-
Enable the plugin. Deploy this through server-managed settings (claude.ai
Admin → Claude Code → Managed settings) or as the file
/Library/Application Support/ClaudeCode/managed-settings.json:Do not addpluginConfigs,mcpServers, or an MCP URL. Organization-wide MCP access uses a separate organization connector. -
Deploy the collector config with MDM, and optionally pin the binary:
-
Confirm the plugin is enabled. An installed plugin, including one with
Scope: managed, does not run until its status isenabled: -
Start a new Claude Code session so
hooks.jsonloads.
Connect to TrustGate
For centrally managed access, use a Claude organization connector. Claude Code loads that connector after the user completes the connection. Confirm in/mcp
that TrustGate is the org connector, not “Provided by a plugin”.
For local testing, add the MCP application directly to the CLI. This does not
replace the organization connector. Copy the endpoint from the application’s
Connect tab:
Authorization: Bearer ag_… or x-api-key, for
clients that can only set one of those headers. On a private (Hybrid) data plane, add
--header "X-AG-Gateway-Slug: <gateway-slug>" as well.
Route model traffic through TrustGate
Claude Code can send its own model requests through an LLM application instead of straight to Anthropic, so the same rate limits, budgets, guardrails, and traces apply to the coding agent as to any other application. Claude Code speaks the Anthropic Messages API; TrustGate serves it at/{application-slug}/v1/messages and routes it to whichever
registry the application binds — an Anthropic registry, or a cross-format route to an OpenAI
or Gemini registry.
-
Create an LLM application, bind the registries and models it may use, and issue an
ag_…API key. Copy the LLM host from the Connect tab. -
Point Claude Code at the application:
Both header forms authenticate the API key. On a private (Hybrid) data plane add the gateway header:The key identifies the application, not the person using it, so model traffic shows no user in Activity until Claude Code names one. Send it in
X-NeuralTrust-End-User(one header per line, so a Hybrid plane keepsX-AG-Gateway-Slugon the line above):The value is attribution only: it lands on the trace and in Activity, and grants nothing.ANTHROPIC_CUSTOM_HEADERSreaches model requests only; MCP traffic needs none of this, because there the person signs in and the gateway already knows them. - Start a new session and send a prompt. The request appears in TrustGate traces under the application, with the user you named.
404 model_not_supported
when none does — so point Claude Code at a model the registry offers (ANTHROPIC_MODEL
for one session, or ANTHROPIC_DEFAULT_OPUS_MODEL / ANTHROPIC_DEFAULT_SONNET_MODEL /
ANTHROPIC_DEFAULT_HAIKU_MODEL for the aliases), and expect TrustGate to adapt the
request:
The Warning above still applies: with
ANTHROPIC_BASE_URL set, Claude Code skips
server-managed settings, so deploy the TrustGuard plugin enablement as the
managed-settings.json file.
Verify
TrustGuard plugin
Check that the binary and collector config are installed, then send a test lifecycle event:source.application = claude-code-plugin means the binary and key work. If
Claude Code still never evaluates, the plugin is disabled or hooks did not
reload.
TrustGate MCP connection
- Confirm that
/mcplists TrustGate, then call a tool from a bound registry. - Confirm the call in TrustGate Activity.
TrustGate inference
WithANTHROPIC_BASE_URL set, run /status inside claude and confirm the API base URL
is the application URL, then send a prompt and open the trace in the console. A 401 means
the key is wrong or revoked; a 404 means the slug or the path is wrong (the base URL must
end with the application slug, no /v1).
Reference
Coverage
This table describes the TrustGuard plugin, not the TrustGate MCP connection.
Ask. The plugin honors Ask on tool calls by raising Claude Code’s native
permission dialog. The subtitle is the generic TrustGuard sentence
A TrustGuard policy needs your approval to continue.; the title is Claude
Code’s tool name and the plugin cannot change it. An ask on
UserPromptSubmit does not stop the prompt. Claude Code has no confirmation
dialog for that event, so it submits the prompt with a warning. Use a Block
gate to stop a prompt.
Limits. The plugin does not support redaction or evaluate tool declarations.
There is no hook for assistant output, so model responses, system prompts,
token usage, and extended thinking are not evaluated. Route MCP through
TrustGate if you need controls over the available tool set. The plugin does
not run in claude.ai or Desktop; use the Enterprise inference
hook to evaluate model requests
across the organization.
What is evaluated
The plugin sends one evaluation call per lifecycle hook.tool.name is payload.params.name: for mcp__<server>__<tool> that is the
last segment. Gate on that short name, not the full hook tool_name. The
policy’s detectors decide the verdict.
Configuration
Managed settings (plugin enablement only).managed-settings.json carries
extraKnownMarketplaces and enabledPlugins. It does not hold a collector key
or an MCP URL.
claude-code.json (TrustGuard collector only). Keys: data_url, api_key,
fail_mode. When the managed file contains api_key, that key plus data_url
and fail_mode are locked. A user file cannot replace them.
fail_mode: open plus an empty hook body {} means allow; that is also the
response when evaluate returns allow.
When a detector cannot run. The hooks always block, with no setting to
change it: in Enforce the prompt or tool call is denied, and in Observe it is
only recorded. The user sees a message that the request could not be evaluated.
In Activity the detector shows as not executed, with the action it applied,
and it is not listed as a detection.
Binary discovery. The MDM path is checked first, then ~/.trustguard/bin.
The user path is not required when the MDM binary exists. On a private
fork of the plugin repository, an unauthenticated GitHub Releases request may
return 404. Set TRUSTGUARD_GITHUB_TOKEN and pin the release version. If the
download fails, the bootstrap fails open.
Remote sessions. Over SSH or WSL, the hooks run on the remote host. An
MDM-deployed binary on the Mac does not cover that session. The config and
binary must exist where the agent runs.
MCP auth. The CLI accepts OAuth2 or an ag_… application key as
X-AG-API-Key (the plane also takes it as Authorization: Bearer ag_… or
x-api-key). A private data plane needs X-AG-Gateway-Slug unless the MCP
host already scopes the gateway. Which IdP backs
the OAuth login is configured on the application. See
Auth. Authenticating to TrustGate is separate from
authenticating to the upstream servers; a registry using OAuth (forwarded)
returns a connect link on the first call for a user without a stored credential.
Deployment ownership. IT manages plugin enablement through
managed-settings.json or server-managed settings, and deploys the organization
collector key in claude-code.json through MDM. An Anthropic organization owner
manages organization connectors.
Configure the application’s available tools on General in the NeuralTrust
console; every caller the application admits sees the same tool set.
To limit MCP tool calls, attach the Per-Tool Rate
Limiter policy.
Attributes
The plugin stampssource.application = claude-code-plugin and a
per-developer consumer_id. These values provide per-developer attribution in
Activity.
A gate on claude-code does not match the plugin. That value identifies Claude
Code requests seen server-side by the Enterprise inference hook. Use a
collector and default policy for each integration path, and configure their
gates separately.
To target the plugin, create a gate with
source.application eq claude-code-plugin, then choose Ask or Block
as appropriate for the event. The field is under Policies → Gates → Source
application. Gates run before detectors. In Observe mode, Block is recorded
but not enforced. Test the condition on the policy Test tab with Extra
parameter Source application set to claude-code-plugin.
Troubleshooting
Related
- Claude Enterprise: organization inference hooks and managed MCP connectors
- Policies: Gates: Ask and Block configuration, including
source.applicationvalues - Evaluate API: requests sent by the plugin hooks
- Collectors: collector types and keys
- MCP overview: applications, catalog merging, and upstream authentication
- TrustGate authentication: API key and OAuth2 authentication for MCP applications
- How TrustGuard works: evaluation and enforcement across integrations
- Plugin repository: source, releases, and the hook contract