NeuralTrust controls
Install TrustGuard from the
trustguard-copilot-plugin.
Configure TrustGate separately as a remote MCP server in Copilot’s MCP config.
Deployment options
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.
Set up prompt and tool screening (TrustGuard)
Pilot: Copilot CLI plugin
-
Add the marketplace and install the plugin:
-
Write the API key config to
~/.trustguard/copilot.jsonandchmod 600it:
Enterprise: policy hooks
IT deploys policy hooks, which Copilot CLI loads machine-wide before user, repository and plugin hooks. Developers cannot disable them:disableAllHooks does not apply to policy hooks. The Kandji scripts install four
pieces:
The managed config is the same JSON shape as the pilot file, carrying the org
tgk_… key. The policy hook file calls the wrapper, not the collector
directly. TRUSTGUARD_COPILOT_BIN overrides the platform-specific binary lookup.
VS Code Agent mode
Install the plugin from your organization marketplace. Agent hooks are currently a VS Code preview feature, so confirm enterprise policy permits hooks and controls which marketplace sources are allowed before you roll out.Cloud coding agent
Cloud jobs do not load local plugins, user hooks, MDM files, or policy hooks. They load hooks committed under.github/hooks/*.json. Configure them as follows:
- Commit a Copilot hook file under
.github/hooks/. - Make the collector binary available in the job image, or use an HTTP hook endpoint that accepts Copilot’s event payload.
- Add the TrustGuard host to the cloud-agent firewall allowlist.
- Provide credentials through the approved GitHub environment mechanism.
Set up governed tool access (TrustGate)
Copilot treats TrustGate as a remote HTTP MCP server: oneurl per MCP
consumer, and Copilot Chat sees the merged toolkit that consumer is routed to.
Copy the endpoint from the consumer’s Connect tab:
.vscode/mcp.json in the workspace, or use the user MCP config your VS
Code version provides.
OAuth2 consumers (recommended). Use OAuth2 where Copilot can complete the
browser login. Omit headers:
ag_… consumer key as a header. Do not use a
TrustGuard tgk_… key:
headers:
The top-level key is
servers or mcpServers, depending on your VS Code and
Copilot version. If the file is ignored, paste the JSON tab from the
consumer’s Connect page into the MCP configuration UI instead.Verify
Hooks.- Run Copilot CLI, send a test prompt, then trigger a shell tool call.
- Confirm both events in TrustGuard Activity. They carry
source.application = copilot-plugin. The prompt is audit-only; enforcement applies at tool events.
- In Copilot Chat, list tools or invoke one bound on the consumer.
- Confirm the call in TrustGate telemetry. See Metrics.
Reference
Coverage
TrustGuard receives prompt submissions, tool calls, and tool results from
Copilot CLI, VS Code Agent mode, and cloud coding-agent jobs. Copilot discards
command-hook output at
userPromptSubmitted, so prompts are audit-only.
Block and Ask apply to tool calls; a Block on a tool result flags or replaces
the result after the call has run.
Ask. Copilot honors Ask on tool calls by displaying its approval prompt. There
is no user to prompt in the cloud coding agent, so Copilot treats the unresolved
approval as denied. Use a Block policy action for cloud jobs that must stop
the call.
Limits. Inline code completions (ghost text) expose no hooks. The hooks also
do not evaluate model responses or tool declarations. Use TrustGate to control
which tools are available.
Tool-result handling depends on the payload. For a native Copilot payload, a
Block verdict adds untrusted-result guidance to additionalContext and replaces
the entire tool output with [Tool result redacted by TrustGuard] through
modifiedResult. For a VS Code-compatible snake_case payload, it emits
decision: "block" with a reason and leaves the result intact. Neither behavior
can undo a tool call that has already run.
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, including tools served by
TrustGate.
Configuration
copilot.json (TrustGuard only). Keys: data_url, api_key, fail_mode,
plus optional consumer_id. The managed copy is deployed by MDM to the per-OS
path in the table above; the pilot copy lives at
~/.trustguard/copilot.json (chmod 600).
Environment variables override the user file:
disableAllHooks does not apply to them. That
ordering prevents developers from disabling the MDM-deployed hooks.
Failure behavior. Normal data-plane errors follow the configured
fail_mode. Two installation failures are handled separately, and only by the
policy-hook wrapper:
The marketplace plugin bootstrap does not make that distinction: it fails open
in both cases. If a personal install is incomplete it emits
{} and exits 0 on
purpose, because Copilot’s preToolUse command hooks fail closed on non-zero
exits. This prevents an incomplete plugin installation from blocking Copilot.
mcp.json (TrustGate only). Workspace file .vscode/mcp.json, or the user
MCP config your VS Code version uses. TrustGate is always "type": "http" with a
url. Auth is X-AG-API-Key with an ag_… consumer key, plus
X-AG-Gateway-Slug on a private (Hybrid) data plane; OAuth2 consumers send no
headers. The top-level key is servers or mcpServers depending on version.
Deployment ownership.
Attributes
attributes.source.application = "copilot-plugin"attributes.copilot.*, containing the full hook stdin JSONconsumer_idis sent only when configured explicitly, viaTRUSTGUARD_CONSUMER_IDorconsumer_idincopilot.json
source.application = copilot-plugin. Gate on source.application and the tool name or command. Set
consumer_id explicitly for per-developer attribution; this collector does not
infer one.
Troubleshooting
Related
- Policies: Gates: Ask and Block configuration
- Evaluate API: requests sent by the hooks
- MCP overview: consumers, catalog merging, and upstream authentication
- Microsoft Copilot Studio: Microsoft’s agent builder and its TrustGate MCP integration
- Coverage: comparison of Copilot with other collectors
- Plugin repository: source, releases, and the hook contract
- Enterprise deployment guide: full MDM deployment procedure
- VS Code MCP servers: VS Code reference