Connect Sourcegraph to Claude Code
Give Claude Code governed access to Sourcegraph through Runlayer, with identity, policy, scanning, and audit on every call.
Set up
Add Sourcegraph to Claude Code in four steps
Admins approve the server once. Everyone in Claude Code then gets it through the same governed connection.
- 1
Approve Sourcegraph in Runlayer
Add Sourcegraph from the catalog and choose who can use it and which of its tools are allowed.
- 2
Connect Claude Code to Runlayer
Runlayer’s CLI installs the Runlayer Plugin natively in Claude Code, and an Anthropic org install also reaches Claude Code. With direct tool listing turned on for your deployment, Sourcegraph’s tools show up in Claude Code’s own tool list (supported Claude Code versions).
Claude Code setup guide - 3
Sign in to Sourcegraph
Each user signs in to Sourcegraph with OAuth. Runlayer keeps the tokens out of the client’s configuration.
- 4
Use Sourcegraph from Claude Code
Sourcegraph’s approved tools appear in Claude Code. Every call is checked against policy and recorded.
Tools
Sourcegraph tools in Claude Code
Sourcegraph reports its tools when your organization connects it, so the list depends on your deployment.
Control
What Runlayer can see and stop in Claude Code
Some controls apply to every client at the gateway. Others depend on what Claude Code exposes to Runlayer.
Gateway policy (available)
Every Sourcegraph call from Claude Code passes through Runlayer, where your policies can allow, alert, mask, or block it.
Audit trail (available)
Each call is recorded with the user, Claude Code as the client, the tool, and the policy and scanner decisions.
Client hooks (available)
Capture supported prompts, reasoning, local and MCP tool calls, responses, and scanner decisions in real time.
Anthropic inference hooks (available)
With Claude Enterprise, Anthropic sends each governed Claude Code prompt to Runlayer before inference, with nothing installed on devices (Anthropic beta).
OTLP telemetry (available)
Claude Code can export OpenTelemetry logs to Runlayer for observe-only session reconstruction.
Stop a call before it runs (available)
Runlayer can deny a tool call before Claude Code runs it.
Block output after it runs (available)
Runlayer can block a tool’s output before Claude Code’s model sees it.
Redact output in place (available)
Runlayer can mask sensitive parts of a tool’s output in Claude Code and pass the rest through.
In Claude Code
- When a tool fails, Runlayer records the error but cannot hide it.
Frequently asked questions
Connect more
