# Sourcegraph — MCP server on mcp.ai > Connect your Sourcegraph account and use 8 tools for developer tools straight from your AI agent. Connect with your own API key. Sourcegraph is a code intelligence platform that enables developers to search, understand, and manage code across large codebases. By: mcp.ai · official Page: https://mcp.ai/sourcegraph ## Connect (MCP protocol) Remote MCP endpoint (HTTP, streamable): https://api.mcp.ai/p_sourcegraph?ms=1787295720000 Add it as a custom/remote MCP connector, then authenticate when prompted. ## REST API (no MCP client required) Every tool is also a REST endpoint, authed with a workspace API key. Discover: GET https://api.mcp.ai/api/sourcegraph/_endpoints # public; lists every endpoint Call: POST https://api.mcp.ai/api/sourcegraph/ Authorization: Bearer sk_live_… # create one at https://mcp.ai/settings/api-keys Content-Type: application/json Body: { …args } → { "ok": true, "tool": "", "result": { … } } ## Developer docs How to use (MCP or REST), markdown: https://mcp.ai/sourcegraph/skill.md Postman collection (v2.1): https://mcp.ai/sourcegraph/postman.json ## Tools - sourcegraph_check_site_settings_edit_permission() — Tool to check whether site settings can be edited through the API. Use when you need to confirm the API allows site settings edits before attempting configuration changes. - sourcegraph_compare_commits(base: string, head: string, repo: string) — Tool to compare two commits in a repository and retrieve their file diffs. Use after confirming the repository name and commit SHAs to inspect differences. - sourcegraph_get_commit_details(rev: string, repo: string) — Get detailed information about a specific commit in a repository. - sourcegraph_get_current_user() — Tool to retrieve information about the currently authenticated user. Use when needing confirmation of identity via Sourcegraph GraphQL API. - sourcegraph_get_file_contents(file_path: string, repo_name: string) — Tool to fetch the contents of a specified file on the default branch. Use when you need raw file text without cloning the repo or using a slower code-host API. - sourcegraph_list_repositories(after?: string, first: integer) — Tool to list repositories on the Sourcegraph instance. Use when you need to paginate through all available repositories. - sourcegraph_list_repository_files(rev?: string, path?: string, recursive?: boolean, repo_name: string) — Tool to list all files and directories in a repository path. Use when you need to enumerate files in a repository without cloning. - sourcegraph_list_repository_languages(repoName: string) — Tool to list languages used in a repository. Use when you need to determine the primary and all languages of a given repository; call after you have the repository name. ## Example prompts - "What can I do in Sourcegraph?" - "Show me a summary of my Sourcegraph account" ## Links Docs: https://mcp.ai/docs/mcps/sourcegraph Website: https://mcp.ai/mcps/sourcegraph