All tools
GitHubG

by GitHub

Search code

Returns files, and the repositories they live in, whose code matches a query such as an import of a package.

View on GitHub
Updated Sep 26, 2026Available asMCPCLIAPI

Description

Qualifiers such as `org:`, `language:`, `filename:` and `extension:` narrow the match. The REST endpoint requires authentication and allows 10 requests per minute.

search-code.md

Search code

Returns files, and the repositories they live in, whose code matches a query such as an import of a package.

Qualifiers such as org:, language:, filename: and extension: narrow the match. The REST endpoint requires authentication and allows 10 requests per minute.

Set up

Use the first option your agent supports.

MCP (official, remote)

Add this server to your agent's MCP settings, then sign in when asked.

{ "mcpServers": { "github": { "url": "https://api.githubcopilot.com/mcp/" } } }

Call the MCP tool search_code.

Server URL: https://api.githubcopilot.com/mcp/

CLI (official)

Install the command, then confirm it runs.

brew install gh
gh --version

Run gh search code.

API (official)

Before doing anything else, make one read-only call to confirm access.

Rules

  • Ask the user before anything that sends messages, costs money, or changes data.
  • Never print API keys.

Built from these files in the repository

The layout and the rules come from lib/catalog/render-markdown.ts, the set-up wording from lib/catalog/render-access.ts.

Ways in

RouteSourceCallRequiredDocs
MCPOfficial · remotesearch_codeOAuthDocs
CLIOfficialgh search codeOAuthDocs
APIOfficialGET /search/codeAPI key in $GITHUB_TOKENDocs

Workflows using Search code

No workflows yet
No published workflow uses Search code yet.