Sourcegraph for AI agents

Sourcegraph is a code search and intelligence platform that lets developers search, browse, and compare code across many repositories at once. Connect it once through Arc0, and your agent, or Claude, ChatGPT and Cursor, can use it through one MCP endpoint, limited to what each user approved.

Developer toolsAPI keyMCP + RESTsourcegraph.com
AUDIT LOG · SOURCEGRAPHPOLICY: acme-support
09:41:07 · claude · u_8f2read
sourcegraph.list_repositories
List Repositories✓ allowed · 212ms
09:41:08 · claude · u_8f2read
sourcegraph.compare_commits
Compare Commits✓ allowed · 164ms
EVERY SOURCEGRAPH CALL, ON THE RECORD
01 · USE CASES

What agents do in Sourcegraph.

01

Search across every repository

Search repository files for a function or pattern across every codebase indexed, not just one repo.

02

Compare two commits before merging

Compare two commits to see exactly what changed before an agent recommends approving a pull request.

03

Pull file contents for review

Get the contents of a specific file at a commit, read-only, to answer a question about the code.

02 · ACTIONS

8 Sourcegraph actions, graded by risk.

Every Sourcegraph action is tagged read, write or destructive, so one policy covers the whole app and new actions inherit the right default.

read

8

Look things up. Allowed by default.

  • sourcegraph.get_current_user
    Get Current User
  • sourcegraph.get_file_contents
    Get File Contents
  • sourcegraph.list_repositories
    List Repositories
  • sourcegraph.get_commit_details
    Get Commit Details
  • sourcegraph.list_repository_files
    List Repository Files
  • sourcegraph.list_repository_languages
    List repository languages
  • sourcegraph.compare_commits
    Compare Commits
  • sourcegraph.check_site_settings_edit_permission
    Check Site Settings Edit Permission

write

0

Create and change things. Allow, or ask the user first.

  • No write actions.

destructive

0

Delete, cancel or archive. Ask first, or deny outright.

  • No destructive actions.
03 · HOW IT WORKS

Sourcegraph in three steps.

  1. 01Your users connect SourcegraphThey add their Sourcegraph api key on Arc0 Connect, under your brand. It goes straight into the vault.
  2. 02You set the rulesReads run, and writes like “updates” can wait for the user to approve.
  3. 03Any agent can actYour agent calls Sourcegraph through the Arc0 SDK or MCP, and so can Claude, ChatGPT and Cursor. Every call lands on the audit log.
POLICY.TS
await arc0.policies.set('sourcegraph', {
  read: 'allow',
  write: 'ask',        
  destructive: 'deny',  
})

# Claude Code: the same connection, one URL
$ claude mcp add --transport http arc0 \
    https://mcp.arc0.ai/u/u_8f2
04 · AUTH AND DATA

How Sourcegraph connects.

Users add their Sourcegraph api key on Arc0 Connect. It is encrypted in the vault, never shown to the model, and each user can rotate or revoke it at any time.

The same Sourcegraph connection serves your agent over MCP and your own backend over REST and the proxy, so a user connects once. How Arc0 handles credentials →

AUTH
API key
CREDENTIALS
Per-tenant encrypted vault
MODEL SEES
Results only, never credentials
AUDIT LOG
Every call, on every plan
05 · WORKS WITH

Use Sourcegraph from any agent.

Claude
ChatGPT
Cursor
Codex
VS Code
OpenAI Agents SDK
Claude Agent SDK
Vercel AI SDK
Mastra
LangGraph
07 · FAQ

Sourcegraph and Arc0, answered.

Q01

Can I use Sourcegraph with Claude, ChatGPT or Cursor?

Yes. Connect Sourcegraph to Arc0 once, then add your Arc0 MCP URL to Claude, ChatGPT, Cursor, Claude Code or any other remote-MCP client. Each assistant only gets the Sourcegraph actions you allow.

Q02

How do users connect Sourcegraph?

Users add their Sourcegraph api key on Arc0 Connect. It is encrypted in the vault, never shown to the model, and each user can rotate or revoke it at any time.

Q03

Which Sourcegraph actions can my agent take?

8 in total: 8 read, 0 write and 0 destructive. Your policies decide which of them each agent may call.

Q04

Can I make my agent read-only in Sourcegraph?

Yes. Allow read actions and deny writes in the Sourcegraph policy. Your agent can still look things up, and any write it attempts is blocked and logged.

Q05

Can my own backend call Sourcegraph too?

Yes. The same Sourcegraph connection is available over REST and through the Arc0 proxy, so your product and your agent share one connection per user.

Get started

Plug Sourcegraph into your agent.

Your users connect Sourcegraph once, under your brand. Your agent gets 8 actions behind your policies, with every call on the record.

Free to build · MCP + REST · Audit log on every plan