Sourcegraph
Lets an agent search and read code across every repository connected to your Sourcegraph instance: run code searches with the full search syntax, fetch file content, look up repository metadata, walk commit history, and find symbols. Works against Sourcegraph Cloud (sourcegraph.com) or your own self-hosted instance.
What it can do
| Method | What it does |
|---|---|
sourcegraph_search | Search code across all repositories with the full Sourcegraph search syntax; supports literal, regexp, structural, and keyword pattern types. |
sourcegraph_get_file_content | Get the content of a single file at a revision. |
sourcegraph_repository | Get repository info: url, description, language, stars, default branch, and flags. |
sourcegraph_commits | List commit / blame history for a repo or a file path. |
sourcegraph_find_symbols | Find symbols (functions, classes, etc.) in a repository, with their source location. |
sourcegraph_graphql | Generic passthrough: run any Sourcegraph GraphQL query or mutation for full API coverage. |
How to get your token
Sourcegraph authenticates API calls with an access token sent as Authorization: token <TOKEN>.
- Sign in to your Sourcegraph instance (or sourcegraph.com).
- Open Settings -> Access tokens (create a token).
- Click Generate new token, give it a name, and copy the value - it is shown once.
- Paste it into FlyMyAI.
- If you run a self-hosted Sourcegraph, also paste your instance URL (e.g.
https://sourcegraph.example.com).
Fields to fill
| FlyMyAI field | Where it comes from |
|---|---|
SOURCEGRAPH_TOKEN | Sourcegraph -> Settings -> Access tokens |
SOURCEGRAPH_URL | Optional - your self-hosted instance base URL; defaults to https://sourcegraph.com |
Troubleshooting
401 Unauthorized- the token is wrong, revoked, or for a different instance. Generate a new one and re-paste it.- No results from
sourcegraph_search- check the query syntax andrepo:filter. The repository must be indexed by your Sourcegraph instance. repository not found- use the canonical repo name (e.g.github.com/org/repo, no protocol) and make sure the repo is added to Sourcegraph.- Self-hosted instance unreachable - confirm
SOURCEGRAPH_URLis the correct base URL and the instance is reachable from the internet.
Links
We love our partners - FlyMy.AI builds with the best. Thanks, Sourcegraph!