Skip to main content
Sourcegraph logo

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

MethodWhat it does
sourcegraph_searchSearch code across all repositories with the full Sourcegraph search syntax; supports literal, regexp, structural, and keyword pattern types.
sourcegraph_get_file_contentGet the content of a single file at a revision.
sourcegraph_repositoryGet repository info: url, description, language, stars, default branch, and flags.
sourcegraph_commitsList commit / blame history for a repo or a file path.
sourcegraph_find_symbolsFind symbols (functions, classes, etc.) in a repository, with their source location.
sourcegraph_graphqlGeneric 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>.

  1. Sign in to your Sourcegraph instance (or sourcegraph.com).
  2. Open Settings -> Access tokens (create a token).
  3. Click Generate new token, give it a name, and copy the value - it is shown once.
  4. Paste it into FlyMyAI.
  5. If you run a self-hosted Sourcegraph, also paste your instance URL (e.g. https://sourcegraph.example.com).

Fields to fill

FlyMyAI fieldWhere it comes from
SOURCEGRAPH_TOKENSourcegraph -> Settings -> Access tokens
SOURCEGRAPH_URLOptional - 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 and repo: 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_URL is the correct base URL and the instance is reachable from the internet.
We love our partners - FlyMy.AI builds with the best. Thanks, Sourcegraph!