Web dashboard
Open http://localhost:5173, type owner/repo, and watch the repository index. Search it, reprocess it or delete it. The dashboard adds GitHub repositories only. See the dashboard guide.
Claude can’t see your codebase. You can paste a file into a chat, but it can’t search a repository, list the functions in a directory or open the file a stack trace points at. CodeSage closes that gap. It reads a repository once, breaks it into searchable pieces and stores them in Algolia. After that, Claude Desktop (or any other MCP client) can search the code, read files, list definitions and count things, all through seven tools.
CodeSage is a self-hosted tool. You run it on your own machine or server, with your own Algolia account. There is no hosted demo and no CodeSage service to sign up for. It was built for the Algolia MCP Server Challenge.
Both end at the same FastAPI backend.
Web dashboard
Open http://localhost:5173, type owner/repo, and watch the repository index. Search it, reprocess it or delete it. The dashboard adds GitHub repositories only. See the dashboard guide.
Claude Desktop (MCP)
Run make install-claude, restart Claude Desktop and ask about your code. Claude can also add public repositories from GitLab, Bitbucket and self-hosted servers. See the Claude Desktop guide.
flowchart TB
you(["You"]) --> browser["Web dashboard<br/>React + Vite"]
you --> claude["Claude Desktop"]
claude -- "tools/call over stdio" --> bridge["MCP bridge"]
browser -- "REST and WebSocket" --> nginx["nginx, prod only<br/>HTTPS, login, adds the API key"]
bridge -- "HTTP with the API key" --> nginx
nginx --> api["CodeSage backend<br/>FastAPI: REST, WebSocket, MCP tools"]
api -- "starts" --> job["Indexing job"]
job -- "fetch files" --> github["GitHub API,<br/>or git clone"]
job -- "store" --> db[("SQLite<br/>files and entities")]
job -- "index" --> algolia[("Algolia<br/>search index")]
api -- "search" --> algolia
api -- "read files" --> dbIn development there is no nginx: the dashboard and the bridge call the backend directly.
| Component | What it is | Where |
|---|---|---|
| Backend | FastAPI app with the REST API, the /ws WebSocket, the MCP tool endpoints and the indexing jobs. One process, one worker. |
backend/app |
| MCP bridge | A stdio MCP server that Claude Desktop starts through mcp_launcher.sh. It holds no data. It checks tool arguments and forwards them to the backend. |
backend/codesage_mcp |
| Dashboard | React and Vite single-page app. | frontend/src |
| nginx | Prod stack only. Terminates HTTPS, asks for a login and adds the API key to each request. | deployment/ |
| Algolia | The search index. Holds one record per entity. | Your Algolia account |
| SQLite | The local database with repositories, full file contents and entities. | backend/codesage.db |
GitHub API or git clone |
Where files come from. github.com uses its REST API. Every other host is read with a shallow git clone. |
Network |
For the full picture see Architecture.
Once a repository has status completed, ask questions in plain words. Claude picks the tools.
owner/repo under src/auth/.”src/server.py, then explain the retry logic.”TODO|FIXME in the docs/ folder.”Example prompts for each tool are in Claude Desktop. The tool arguments are in the MCP tools reference.
| Kind | Languages | Entities |
|---|---|---|
| Source code | Python, JavaScript, TypeScript, Java, Go, Rust, C, C++, C#, PHP, Ruby | functions, classes, methods, imports |
| Markdown | .md |
a doc_section per heading |
| Terraform and HCL | .tf, .tfvars, .hcl |
a terraform_block per top-level block |
| Stored, no entities | CSS, SCSS, HTML, SQL, JSON, YAML, XML | none. The files are stored and readable with get_file and find_patterns |
Details, including which file extensions are picked up, are in Languages.
add_repository is the one tool that changes state: it creates a repository record and starts indexing.| Term | Meaning |
|---|---|
| Repository | A git repository you added to CodeSage, with a numeric ID and a name. GitHub repositories are named owner/repo. Others are named <host>/<path>. |
| Entity | One searchable piece of code: a function, class, import, Markdown doc section or Terraform block. Each entity becomes one Algolia record. |
| Index | The Algolia index (default name codesage_code_entities) that holds the entity records. Indexing is the act of filling it. |
| MCP | Model Context Protocol, the standard way for an AI client such as Claude Desktop to call tools on a server. |
| Bridge | The small stdio program (python -m codesage_mcp) that Claude Desktop runs. It speaks MCP to Claude and HTTP to the backend. |
| Tool | One of the seven MCP operations: list_repositories, search_code, get_file, list_definitions, analyze_repository, find_patterns and add_repository. |
| Run (or job) | One background indexing pass over a repository. At most one run per repository and at most two runs at once. A run ends as completed or failed. |
| Partial index | A run that ended completed but left something out, such as files over the 1000-file or 100 MB limit. The repository’s error_message begins with Partially indexed: and the dashboard shows an amber card. |