VS Code and GitHub Copilot with Keeptrusts
Port 41002 is an LLM API endpoint, not a forward HTTP proxy. Do not place it
in http.proxy, HTTP_PROXY, or HTTPS_PROXY. Those settings make Copilot
expect CONNECT/forward-proxy behavior that the Keeptrusts gateway does not
implement.
VS Code offers two supported Keeptrusts connection paths.
Add Keeptrusts MCP tools
Create .vscode/mcp.json. VS Code uses servers, not Cursor's mcpServers
shape, and can store the token through a password input:
{
"inputs": [
{
"type": "promptString",
"id": "keeptrusts-token",
"description": "Keeptrusts MCP client token",
"password": true
}
],
"servers": {
"keeptrusts": {
"type": "http",
"url": "https://<published-hostname>/mcp",
"headers": {
"Authorization": "Bearer ${input:keeptrusts-token}"
}
}
}
}
Run MCP: List Servers to start the server and inspect its output. See the VS Code MCP guide for current trust and organization controls.
Route VS Code chat through a custom endpoint
VS Code's current Custom Endpoint model provider can present Chat Completions, Responses, or Messages API choices. For a governed Keeptrusts IDE path, select Chat Completions or Responses: those routes execute the documented input and output policy chain. The public Messages route has a weaker auth/billing/routing-only governance boundary, and the native Anthropic provider adapter is not adoption-ready.
Open Chat: Manage Language Models, choose Add Models → Custom Endpoint, and configure the Keeptrusts URL, client token, model ID, API type, and capabilities.
For an OpenAI-compatible model, use the exact gateway route required by the editor's configuration UI, such as:
http://127.0.0.1:41002/v1/chat/completions
VS Code's BYOK custom models apply to chat and utility tasks. GitHub documents that semantic search, inline suggestions, and some embedding-backed features still require GitHub services. See the VS Code language-model guide for the current boundary.
What is not governed
MCP does not reroute GitHub-hosted Copilot model traffic, and adding a custom chat model does not imply that inline suggestions use it. Keeptrusts can govern only requests that actually target its endpoint.
Verify with kt events tail --since 10m --follow while the intended custom
model is selected.