socraticode
Enterprise-grade (40m+ LOC) codebase intelligence, zero-setup, local & private Plugin/Skill/Extension or MCP: hybrid semantic search, polygl
Open source Open in the app JSON README (API)
About
Enterprise-grade (40m+ LOC) codebase intelligence, zero-setup, local & private Plugin/Skill/Extension or MCP: hybrid semantic search, polyglot dependency graphs, symbol-level impact analysis & call-flow, interactive HTML viewer, cross-project & branch-aware search, DB/API/infra knowledge. 61% less tokens, 84% fewer calls, 37x faster. Cloud in beta.
Details
- Kind
- Plugins
- Topic
- AI, RAG & memory
- Publisher
- giancarloerra
- Origin
- gemini
- Category
- ferramentas
- Version
- 1.13.1
- Stars
- 3,291
- Forks
- 419
- Open pull requests
- 2
- Last push
- 2026-09-09T22:41:40Z
- Repository state
- ativo
- Language
- TypeScript
- License
- AGPL-3.0
- Added
- 2026-08-30 14:13:39
- Updated
- 2026-09-07 21:05:29
- Origin id
giancarloerra/socraticode
README
<p align="center">
<img src="./socraticode_logo_thumbnail.png" alt="SocratiCode logo" />
</p>
# SocratiCode
<p align="center">
<a href="https://github.com/giancarloerra/socraticode/actions/workflows/ci.yml"><img src="https://github.com/giancarloerra/socraticode/actions/workflows/ci.yml/badge.svg" alt="CI"></a>
<a href="LICENSE"><img src="https://img.shields.io/badge/License-AGPL--3.0-blue.svg" alt="License: AGPL-3.0"></a>
<a href="https://www.npmjs.com/package/socraticode"><img src="https://img.shields.io/npm/v/socraticode.svg" alt="npm version"></a>
<a href="https://nodejs.org/"><img src="https://img.shields.io/badge/node-%3E%3D18.17-brightgreen.svg" alt="Node.js >= 18.17"></a>
<a href="https://github.com/giancarloerra/socraticode"><img src="https://img.shields.io/github/stars/giancarloerra/socraticode?style=social" alt="GitHub stars"></a>
<a href="https://mcptoplist.com/server/io.github.giancarloerra%2Fsocraticode"><img src="https://mcptoplist.com/badge/io.github.giancarloerra%2Fsocraticode.svg" alt="MCP Toplist rank"></a>
<a href="https://discord.gg/dHNMKVY2J2"><img src="https://img.shields.io/badge/Discord-Join-5865F2?logo=discord&logoColor=white" alt="Discord"></a>
</p>
<p align="center">
<a href="#claude-code-plugin-recommended-for-claude-code-users"><img src="https://img.shields.io/badge/Claude_Code-Install_Plugin-CC785C?style=flat-square&logoColor=white" alt="Install Claude Code Plugin"></a>
<a href="https://marketplace.visualstudio.com/items?itemName=giancarloerra.socraticode"><img src="https://vsmarketplacebadges.dev/version-short/giancarloerra.socraticode.svg?style=flat-square&label=VS%20Code%20Marketplace&logo=visualstudiocode&color=0098FF" alt="VS Code Marketplace"></a>
<a href="https://open-vsx.org/extension/giancarloerra/socraticode"><img src="https://img.shields.io/open-vsx/v/giancarloerra/socraticode?style=flat-square&label=Open%20VSX&color=A52A2A" alt="Open VSX"></a>
<a href="https://vscode.dev/redirect/mcp/install?name=socraticode&config=%7B%22command%22%3A%22npx%22%2C%22args%22%3A%5B%22-y%22%2C%22--prefer-online%22%2C%22socraticode%40latest%22%5D%7D"><img src="https://img.shields.io/badge/VS_Code-Install_MCP_Server-0098FF?style=flat-square&logo=visualstudiocode&logoColor=white" alt="Install in VS Code"></a>
<a href="https://insiders.vscode.dev/redirect/mcp/install?name=socraticode&config=%7B%22command%22%3A%22npx%22%2C%22args%22%3A%5B%22-y%22%2C%22--prefer-online%22%2C%22socraticode%40latest%22%5D%7D&quality=insiders"><img src="https://img.shields.io/badge/VS_Code_Insiders-Install_MCP_Server-24bfa5?style=flat-square&logo=visualstudiocode&logoColor=white" alt="Install in VS Code Insiders"></a>
<a href="cursor://anysphere.cursor-deeplink/mcp/install?name=socraticode&config=eyJjb21tYW5kIjoibnB4IiwiYXJncyI6WyIteSIsIi0tcHJlZmVyLW9ubGluZSIsInNvY3JhdGljb2RlQGxhdGVzdCJdfQ=="><img src="https://img.shields.io/badge/Cursor-Install_MCP_Server-F14C28?style=flat-square&logo=cursor&logoColor=white" alt="Install in Cursor"></a>
</p>
> *"There is only one good, knowledge, and one evil, ignorance."* — Socrates
**Your AI reads code. SocratiCode understands it.**
**The open-source codebase context engine: give any AI instant automated knowledge of your entire codebase (and infrastructure) — at scale, zero configuration, fully private, completely free.**
<p align="center">
Kindly sponsored by <a href="https://altaire.com">Altaire Limited</a>
</p>
> 🛡️ **Need MCP governance together with codebase context?** See our sibling project [**JanuScope**](https://github.com/giancarloerra/januscope) — the local-first MCP policy proxy: tool blocking, SQL-mutation gate, PII redaction, audit, rate-limit.
> If SocratiCode has been useful to you, please ⭐ **star this repo** — it helps others discover it — and share it with your dev team and fellow developers!
>
> 💬 Questions or just want to chat? Join us on [Discord](https://discord.gg/dHNMKVY2J2).
> **☁️ SocratiCode Cloud (private beta)** — Hosted, shared team index built on the same engine as the open-source version, plus SSO, audit logs, branch-aware indexing, and VPC / air-gapped deployment options. The open-source core remains free forever. [Request early access →](https://socraticode.cloud)
**One thing, done well: deep codebase intelligence with zero setup, no bloat, and full automation.** SocratiCode gives AI assistants deep semantic understanding of your codebase: **hybrid search, cross-project search, polyglot code dependency graphs, symbol-level impact analysis and flow, interactive HTML graph explorer for visual navigation, and searchable context artifacts (database schemas, API specs, infra configs, architecture docs)**. Zero configuration: add it to an **MCP host that supports local stdio servers**, or use a supported plugin or extension. It manages everything automatically.
**Production-ready**, battle-tested on **enterprise-level** large repositories (up to and over **~40 million lines of code**). **Batched**, automatic **resumable** indexing checkpoints progress — pauses, crashes, restarts, and interruptions don't lose work. The file watcher keeps the **index automatically updated** at every file change and across sessions. **Multi-branch, multi-repo** and **multi-agent ready** — multiple AI agents can work on the same codebase simultaneously, sharing a single index with automatic coordination and zero configuration.
**Private and local by default** — Docker handles everything, no API keys required, no data leaves your machine. **Cloud ready** for embeddings (OpenAI, Google Gemini) and Qdrant, and a **full suite of configuration options** are all available when you need them.
**Code intelligence that belongs to you, AI and host agnostic** — your codebase's understanding lives with the code, not locked to any one assistant, IDE or model. And because SocratiCode pre-computes the hard parts (blast radius, call-flow, dependency traversal), **smaller models can handle architectural complex tasks that would otherwise need top-tier reasoning**, saving even more on token cost.
The first Qdrant‑based MCP/Claude Plugin/Skill that pairs auto‑managed, zero‑config local Docker deployment with **AST‑aware code chunking, hybrid semantic + BM25 (RRF‑fused) code search**, polyglot dependency **graphs** with circular‑dependency visualisation, **symbol‑level Impact Analysis** (blast‑radius & call‑flow tracing across 18 languages), and searchable **infra/API/database artifacts** in a single focused, zero-config and easy to use code intelligence engine.
> **Benchmarked on VS Code (2.45M lines):** SocratiCode uses **61% less context**, **84% fewer tool calls**, and is **37x faster** than grep‑based exploration — tested live with Claude Opus 4.6. [See the full benchmark →](#real-world-benchmark-vs-code-245m-lines-of-code-with-claude-opus-46)
## Contents
- [Quick Start](#quick-start)
- [Plugins and host integrations](#plugins-and-host-integrations)
- [Why SocratiCode](#why-socraticode)
- [Features](#features)
- [Prerequisites](#prerequisites)
- [Example Workflow](#example-workflow)
- [Agent Instructions](#agent-instructions)
- [Configuration](#configuration)
- [Language Support](#language-support)
- [Ignore Rules](#ignore-rules)
- [Context Artifacts](#context-artifacts)
- [Environment Variables](#environment-variables)
- [Docker Resources](#docker-resources)
- [Testing](#testing)
- [Why Not Just Grep?](#why-not-just-grep)
- [FAQ](#faq)
- [Community](#community)
- [SocratiCode Cloud](#socraticode-cloud)
- [License](#license)
---
## Quick Start
> **Requirements:** [Node.js 18.17 or newer](https://nodejs.org/) with `npx` on `PATH`, plus [Docker](https://www.docker.com/products/docker-desktop/) running for the default local Qdrant and Ollama stack.
**Quick install guidance for Claude Code, VS Code, and Cursor:**
[](#claude-code-plugin-recommended-for-claude-code-users)
[](https://vscode.dev/redirect/mcp/install?name=socraticode&config=%7B%22command%22%3A%22npx%22%2C%22args%22%3A%5B%22-y%22%2C%22--prefer-online%22%2C%22socraticode%40latest%22%5D%7D) [](https://insiders.vscode.dev/redirect/mcp/install?name=socraticode&config=%7B%22command%22%3A%22npx%22%2C%22args%22%3A%5B%22-y%22%2C%22--prefer-online%22%2C%22socraticode%40latest%22%5D%7D&quality=insiders) [](cursor://anysphere.cursor-deeplink/mcp/install?name=socraticode&config=eyJjb21tYW5kIjoibnB4IiwiYXJncyI6WyIteSIsIi0tcHJlZmVyLW9ubGluZSIsInNvY3JhdGljb2RlQGxhdGVzdCJdfQ==)
**MCP hosts with a JSON `mcpServers` object** can use this complete configuration:
```json
{
"mcpServers": {
"socraticode": {
"command": "npx",
"args": ["-y", "--prefer-online", "socraticode@latest"]
}
}
}
```
Configuration schemas are host-specific. Continue, VS Code, Zed, OpenCode, Gemini CLI, Cline, and Roo Code have dedicated examples in [Plugins and host integrations](#plugins-and-host-integrations).
### Keeping SocratiCode up to date
SocratiCode has two independent update paths. The **MCP engine** is the `socraticode` package published to npm. Every npm-backed configuration below uses `npx -y --prefer-online socraticode@latest`, which checks npm for the current `latest` release whenever the MCP server starts. A running server cannot replace itself, and a newly published version can only be downloaded while the npm registry is reachable, so restart or reconnect the server after a release.
Native plugins and extensions also contain **skills, instructions, manifests, or UI files**. Update those through the host as shown below, then start a new session so the new plugin files load. Direct MCP installations contain only the engine and do not install SocratiCode's plugin skills.
| Integration | Update plugin, skills, and integration files |
|:------------|:---------------------------------------------|
| Claude Code plugin | Enable marketplace auto-update, or run `claude plugin marketplace update socraticode` followed by `claude plugin update --scope user socraticode@socraticode` |
| OpenAI Codex plugin | Run `codex plugin marketplace upgrade socraticode`, then `codex plugin add socraticode@socraticode` and start a new task |
| VS Code Agent Plugin | Leave `extensions.autoUpdate` enabled for daily checks, or run **Extensions: Check for Extension Updates**, then start a new Chat |
| VS Code editor extension | Update it through the Extensions view or **Extensions: Check for Extension Updates**, then reload the window |
| Cursor local plugin | Update to the latest GitHub release tag using the commands in the [Cursor section](#cursor), then reload Cursor |
| Gemini CLI extension | Install with `--auto-update`, or run `gemini extensions update socraticode`, then restart Gemini |
| Direct MCP only | No separate plugin files are installed; restart or reconnect the MCP server to resolve the current npm release |
`@latest` refers to npm's published `latest` distribution tag; it does not refer to a Git branch. `--prefer-online` forces npm to check for updated package metadata even when its cache is still fresh. If the same registry is temporarily unavailable, npm can still use an already populated cache; a first installation still requires registry access. See the [npm exec cache documentation](https://docs.npmjs.com/cli/npm-exec/#a-note-on-caching) and [npm distribution-tag documentation](https://docs.npmjs.com/adding-dist-tags-to-packages/).
Restart your host. With the default local configuration, first use pulls the required Docker images and starts managed Qdrant. `OLLAMA_MODE=auto` reuses a detected native Ollama instance or starts managed Ollama, then downloads the local embedding model if it is not already available. Cloud and external embedding providers do not download a local model. Initial setup usually takes about five minutes, depending on the connection; later starts take seconds.
**First time on a project:** ask your AI: **"Index this codebase"**. Indexing runs in the background; ask **"What is the codebase index status?"** to monitor progress. Depending on codebase size and whether you're using GPU-accelerated Ollama or cloud embeddings, first-time indexing can take anywhere from a few seconds to a few minutes (it takes under 10 minutes to first-index +3 million lines of code on a Macbook Pro M4). Once complete it doesn't need to be run again, you can search, explore the dependency graph, and query context artifacts.
**Every time after that:** just use the tools (search, graph, etc.). By default, server startup resumes the indexed project represented by the MCP process's working directory: a complete index gets its watcher and an incremental catch-up update, while interrupted indexing resumes from the last checkpoint. `SOCRATICODE_AUTO_RESUME_PROJECTS` and `SOCRATICODE_AUTO_RESUME=all` can select additional projects. A completed indexed project not handled at startup gets a fallback watcher start on its first search, status, or graph interaction. You can also explicitly start or restart the watcher with `codebase_watch { action: "start" }`.
**Prefer a deliberate index snapshot?** Set `SOCRATICODE_WATCHER=off` and `SOCRATICODE_AUTO_RESUME=off` for every MCP process that uses the checkout, then run `codebase_update` only when you want to refresh it. Existing indexes remain usable without rebuilding. Use `SOCRATICODE_WATCHER=manual` instead if explicit `codebase_watch { action: "start" }` should remain available. See [Indexing Behaviour](#indexing-behaviour) and [Passing env vars by host](#passing-env-vars-by-host).
> **macOS / Windows on large codebases**: Docker containers can't use the GPU. For medium-to-large repos, [install native Ollama](https://ollama.com/download) (auto-detected, no config change needed) for Metal/CUDA acceleration, or use [OpenAI embeddings](#openai-embeddings) for speed without a local install. [Full details.](#embedding-performance-on-macos--windows)
>
> **Recommended**: For best results, add the [Agent Instructions](#agent-instructions) to your AI assistant's system prompt or project instructions file (`CLAUDE.md`, `AGENTS.md`, etc.). The key principle, **search before reading**, helps your AI use SocratiCode's tools effectively and avoid unnecessary file reads.
>
> **Claude Code users**: If you installed the SocratiCode plugin, the Agent Instructions are included automatically as skills, so there is no need to add them to your `CLAUDE.md`. The plugin also bundles the MCP server, so you don't need a separate `claude mcp add`.
>
> **Advanced**: cloud embeddings (OpenAI / Google), external Qdrant, remote Ollama, native Ollama, and dozens of tuning options are all available. See [Configuration](#configuration) below.
## Plugins and host integrations
SocratiCode can be installed as a native agent plugin, a VS Code editor extension, a Gemini CLI extension, or a directly configured local stdio MCP server. These are separate integration types and use different configuration and update paths.
Every path below requires Node.js 18.17 or newer with `npx` on `PATH`. The default local stack also requires Docker to be running. Docker is optional when Qdrant is external and embeddings use either a detected native Ollama instance or a cloud or external provider.
| Host | Recommended integration | Scope |
|:-----|:------------------------|:------|
| Claude Code | Native plugin | User |
| OpenAI Codex | Native plugin | User |
| VS Code | Agent Plugin or editor extension | Current VS Code profile |
| Cursor | Local Cursor plugin or direct MCP | User or project |
| Gemini CLI | Gemini extension | User |
| Continue | Direct MCP | Project or user config |
| Cline | Direct MCP | Project or user config |
| Roo Code | Direct MCP | Project or user config |
| Zed | Direct MCP | User or project settings |
| OpenCode | Direct MCP | Project or user config |
### Claude Code plugin (recommended for Claude Code users)
The native plugin bundles the MCP server, workflow skills, and agent instructions. Install it for the current user:
```bash
claude plugin marketplace add giancarloerra/socraticode
claude plugin install --scope user socraticode@socraticode
claude plugin list
```
Start a new Claude Code session after installation. Existing sessions do not load a newly installed plugin. To enable automatic updates, open `/plugin`, select **Marketplaces**, select `socraticode`, and enable auto-update. To update manually:
```bash
claude plugin marketplace update socraticode
claude plugin update --scope user socraticode@socraticode
```
Run `/reload-plugins` or start a new session after updating. If SocratiCode was previously added as a standalone MCP server, remove that duplicate with `claude mcp remove socraticode`; the plugin already provides the server.
For custom providers or external Qdrant, put inherited variables in Claude Code's user settings and restart the session:
```json
{
"env": {
"EMBEDDING_PROVIDER": "openai",
"OPENAI_API_KEY": "<your key>"
}
}
```
Keep this user-scoped file private, or provide secrets through the process environment. Never commit secret values.
See the [Claude Code plugin documentation](https://code.claude.com/docs/en/discover-plugins).
#### Claude Code MCP-only installation
For a user-scoped installation without the bundled skills:
```bash
claude mcp add --scope user socraticode -- npx -y --prefer-online socraticode@latest
claude mcp list
```
Start a new session, or run `/mcp` and select **Reconnect**. The explicit `@latest` command checks for the latest published engine each time the server starts. `claude mcp add` defaults to project-local scope when `--scope user` is omitted. See the [Claude Code MCP documentation](https://code.claude.com/docs/en/mcp).
### OpenAI Codex plugin
The Codex plugin bundles SocratiCode's MCP server, skills, and instructions. Add the Git marketplace and install the plugin for the current user:
```bash
codex plugin marketplace add giancarloerra/socraticode --ref main
codex plugin add socraticode@socraticode
codex plugin list --available --json
```
Start a new Codex task or CLI session after installation. Reopening an existing task does not load newly installed skills or MCP tools. Update and verify with:
```bash
codex plugin marketplace upgrade socraticode
codex plugin add socraticode@socraticode
codex plugin list --available --json
```
Codex has a public plugin directory, but SocratiCode is not currently published there. Plugins are supported in the ChatGPT desktop Codex environment and Codex CLI. The Codex IDE extension supports shared MCP configuration, not plugin discovery. See the [OpenAI plugin documentation](https://learn.chatgpt.com/docs/plugins).
Codex currently exposes enablement and tool policy for a plugin's bundled MCP server, but not a documented per-user environment override for that bundled definition. To keep the plugin skills while using custom SocratiCode variables, disable only the bundled server and add one top-level server in `~/.codex/config.toml`:
```toml
[plugins."socraticode@socraticode".mcp_servers.socraticode]
enabled = false
[mcp_servers.socraticode]
command = "npx"
args = ["-y", "--prefer-online", "socraticode@latest"]
[mcp_servers.socraticode.env]
QDRANT_MODE = "external"
QDRANT_URL = "https://xyz.qdrant.io"
```
Restart Codex, confirm that the plugin skills remain available, and use `/mcp` or `codex mcp list` to verify that exactly one SocratiCode server is active. See [bundled MCP server policy](https://developers.openai.com/plugins/build/plugins#bundled-mcp-servers-and-lifecycle-hooks) and the [Codex configuration reference](https://learn.chatgpt.com/docs/config-file/config-reference).
#### OpenAI Codex MCP-only installation
`codex mcp add` writes the user configuration in `~/.codex/config.toml`:
```bash
codex mcp add socraticode -- npx -y --prefer-online socraticode@latest
codex mcp list
```
Start a new task or CLI session after installation. The equivalent TOML is:
```toml
[mcp_servers.socraticode]
command = "npx"
args = ["-y", "--prefer-online", "socraticode@latest"]
```
Both inline `env = { ... }` and a nested `[mcp_servers.socraticode.env]` table are valid. The CLI `--env KEY=value` option is usually clearer. See the [OpenAI Codex MCP documentation](https://learn.chatgpt.com/docs/extend/mcp?surface=cli).
### VS Code Agent Plugin
This plugin bundles the MCP server, skills, and agent instructions for VS Code's native agent. It is separate from the SocratiCode editor extension.
1. Add this complete setting to the current VS Code profile before installation:
```json
{
"chat.plugins.enabled": true
}
```
2. Run **Chat: Install Plugin From Source** from the Command Palette and enter `https://github.com/giancarloerra/socraticode`.
3. Start a new Chat session.
4. Verify SocratiCode under **Agent Plugins - Installed**, then run **MCP: List Servers** and confirm that its server is running.
Run **Extensions: Check for Extension Updates** to refresh installed agent plugins, then start a new Chat session. See [VS Code Agent Plugins](https://code.visualstudio.com/docs/agent-customization/agent-plugins).
VS Code does not document a per-user environment overlay for a plugin-bundled MCP definition. To keep the plugin skills while applying custom variables, run **MCP: List Servers**, disable the bundled SocratiCode server, and add this user-scoped direct server through **MCP: Open User Configuration**:
```json
{
"servers": {
"socraticode-configured": {
"type": "stdio",
"command": "npx",
"args": ["-y", "--prefer-online", "socraticode@latest"],
"env": {
"QDRANT_MODE": "external",
"QDRANT_URL": "https://xyz.qdrant.io"
}
}
}
}
```
Start a new Chat and use **MCP: List Servers** to confirm that only `socraticode-configured` is active. Use `envFile` instead of `env` when variables should come from a separate local file. Server enablement is stored separately from the shared plugin definition. See [VS Code MCP server management](https://code.visualstudio.com/docs/agent-customization/mcp-servers) and the [`env` / `envFile` reference](https://code.visualstudio.com/docs/agents/reference/mcp-configuration).
### VS Code editor extension
The separately published editor extension adds the SocratiCode sidebar, status item, commands, walkthrough, and interactive graph webview. Install **SocratiCode** from the [Visual Studio Marketplace](https://marketplace.visualstudio.com/items?itemName=giancarloerra.socraticode) in the current VS Code profile.
On Microsoft VS Code 1.99+ and compatible editors that implement the VS Code MCP provider API, the extension registers SocratiCode with the editor's native MCP registry. It does not configure independent clients such as Cline, Continue, or Roo Code.
Reload the window and start a new Chat session after installation. Run **MCP: List Servers** to confirm that `SocratiCode` is running, and open the SocratiCode sidebar to verify the editor UI. Update it through the Extensions view or **Extensions: Check for Extension Updates**.
The [Open VSX package](https://open-vsx.org/extension/giancarloerra/socraticode) can be installed in VS Code-derived editors, but native MCP registration requires that editor to implement `vscode.lm.registerMcpServerDefinitionProvider`. See the [VS Code MCP extension API](https://code.visualstudio.com/api/extension-guides/ai/mcp).
#### VS Code direct MCP installation
Use the Stable or Insiders badge above, choose user or workspace scope in VS Code, then start a new Chat session. A project-scoped `.vscode/mcp.json` uses this complete object:
```json
{
"servers": {
"socraticode": {
"type": "stdio",
"command": "npx",
"args": ["-y", "--prefer-online", "socraticode@latest"]
}
}
}
```
Verify with **MCP: List Servers**. Restart the server from that command and start a new Chat session after a release.
### Cursor
The repository includes a Cursor-format plugin with the MCP server, skills, and instructions. SocratiCode is not currently published in the Cursor Marketplace, so use Cursor's documented user-scoped local-plugin directory. Clone the repository, then check out the stable version shown on the [latest SocratiCode release](https://github.com/giancarloerra/socraticode/releases/latest):
```bash
mkdir -p ~/.cursor/plugins/local
git clone https://github.com/giancarloerra/socraticode.git ~/.cursor/plugins/local/socraticode
git -C ~/.cursor/plugins/local/socraticode checkout <latest-release-tag>
```
Replace `<latest-release-tag>` with the release tag shown on that page, for example `vX.Y.Z`. Restart Cursor or run **Developer: Reload Window**, then verify the plugin under **Customize**. To update to a later public release:
```bash
git -C ~/.cursor/plugins/local/socraticode fetch --tags
git -C ~/.cursor/plugins/local/socraticode checkout <latest-release-tag>
```
Reload Cursor after updating. These commands intentionally follow release tags rather than unreleased commits on `main`. See [Cursor plugins](https://prod.cursor.com/docs/plugins).
For direct MCP configuration, use the Cursor badge above and select the intended user or project scope in Cursor. Start a new Agent chat, then verify `socraticode` under **Cursor Settings → Tools & MCP**. The installation link already uses the latest-release engine command. See [Cursor MCP install links](https://prod.cursor.com/docs/mcp/install-links).
The current local plugin does not declare user-configurable variables. To keep its skills while applying custom variables, open **Customize**, disable the plugin-provided SocratiCode MCP server, and add one direct server to the user or project `mcp.json`:
```json
{
"mcpServers": {
"socraticode-configured": {
"command": "npx",
"args": ["-y", "--prefer-online", "socraticode@latest"],
"env": {
"QDRANT_MODE": "external",
"QDRANT_URL": "https://xyz.qdrant.io"
}
}
}
}
```
Reload Cursor and verify under **Customize** that only `socraticode-configured` is active. See [Cursor plugin variables](https://prod.cursor.com/docs/reference/plugins#variables) and [MCP server management](https://prod.cursor.com/docs/mcp).
The SocratiCode package on Open VSX is a VS Code-style editor extension, not a Cursor plugin. Installing that extension does not establish that Cursor implements VS Code's native MCP provider API. Use the local plugin or direct MCP path when MCP availability is required.
### Gemini CLI extension
Install the user-scoped Gemini extension with automatic updates, verify it, then restart any active Gemini CLI session:
```bash
gemini extensions install https://github.com/giancarloerra/socraticode --auto-update
gemini extensions list
```
If it was installed without `--auto-update`, update it manually and restart Gemini:
```bash
gemini extensions update socraticode
gemini extensions list
```
Gemini limits which inherited environment variables are passed to extension MCP servers. For advanced configuration, define a server with the same name in user scope (`~/.gemini/settings.json`) or workspace scope (`.gemini/settings.json`). That definition overrides the extension server and explicitly forwards only the variables named in `env`:
```json
{
"mcpServers": {
"socraticode": {
"command": "npx",
"args": ["-y", "--prefer-online", "socraticode@latest"],
"env": {
"EMBEDDING_PROVIDER": "openai",
"OPENAI_API_KEY": "${OPENAI_API_KEY}",
"QDRANT_MODE": "external",
"QDRANT_URL": "${QDRANT_URL}",
"QDRANT_API_KEY": "${QDRANT_API_KEY}"
}
}
}
}
```
Keep secret values in the process environment rather than committing them. Restart Gemini and run `gemini mcp list` to verify the overridden server. See the [Gemini extension reference](https://geminicli.com/docs/extensions/reference/) and [Gemini MCP configuration](https://geminicli.com/docs/tools/mcp-server/).
### Continue
Continue uses a YAML `mcpServers` list. For project scope, create `.continue/mcpServers/socraticode.yaml`:
```yaml
name: SocratiCode MCP
version: 1.0.0
schema: v1
mcpServers:
- name: SocratiCode
type: stdio
command: npx
args:
- "-y"
- "--prefer-online"
- socraticode@latest
```
Continue refreshes saved configuration automatically. Open a new Continue Agent session and confirm the SocratiCode tools are listed. For user scope, add the same `mcpServers` list to `~/.continue/config.yaml`. Continue can also import complete JSON MCP files placed in `.continue/mcpServers/`. See [Continue MCP configuration](https://docs.continue.dev/customize/deep-dives/mcp) and the [Continue YAML reference](https://docs.continue.dev/reference).
### Cline
For project scope, save this complete object as `.cline/mcp.json`. For user scope, add the same server to `~/.cline/data/settings/cline_mcp_settings.json` through Cline's MCP settings interface:
```json
{
"mcpServers": {
"socraticode": {
"command": "npx",
"args": ["-y", "--prefer-online", "socraticode@latest"],
"disabled": false,
"autoApprove": []
}
}
}
```
Start a new Cline task and verify that `socraticode` and its tools appear in the MCP Servers view. Reconnect the server after a release. See the [Cline MCP documentation](https://docs.cline.bot/mcp/mcp-overview).
### Roo Code
For project scope, save this complete object as `.roo/mcp.json`. For user scope, open Roo Code's MCP Servers view and select **Edit Global MCP**:
```json
{
"mcpServers": {
"socraticode": {
"command": "npx",
"args": ["-y", "--prefer-online", "socraticode@latest"],
"disabled": false
}
}
}
```
Start a new Roo Code task and verify that `socraticode` is connected in the MCP Servers view. Restart the server after a release. Project configuration takes precedence over a global server with the same name. See [Using MCP in Roo Code](https://github.com/RooCodeInc/Roo-Code-Docs/blob/main/docs/features/mcp/using-mcp-in-roo.mdx).
### Zed
Open **Settings → AI → MCP Servers → Add Server → Add Local Server**. The UI writes user-scoped settings. Use this complete server definition, either there or in project-scoped `.zed/settings.json`:
```json
{
"context_servers": {
"socraticode": {
"command": "npx",
"args": ["-y", "--prefer-online", "socraticode@latest"],
"env": {}
}
}
}
```
Verify that the indicator beside SocratiCode is green and its tooltip says **Server is active**, then start a new Agent conversation. Restart the server from the MCP Servers page after a release.
Zed uses `~/.config/zed/AGENTS.md` for personal instructions. For project instructions it uses the first matching supported file, which can be `AGENTS.md`, `CLAUDE.md`, `GEMINI.md`, or another supported compatibility file. Zed Rules were replaced by Skills and Instructions. See [Zed MCP servers](https://zed.dev/docs/ai/mcp) and [Zed Instructions](https://zed.dev/docs/ai/instructions).
### OpenCode
Use project-root `opencode.json` or `opencode.jsonc` for project scope. Use `~/.config/opencode/opencode.json` or `opencode.jsonc` for user scope:
```jsonc
{
"$schema": "https://opencode.ai/config.json",
"mcp": {
"socraticode": {
"type": "local",
"command": ["npx", "-y", "--prefer-online", "socraticode@latest"],
"enabled": true
}
}
}
```
Restart OpenCode and verify the server with `opencode mcp list`. Restart OpenCode after a release so npm can check for the current engine. This is the OpenCode 1.x schema.
OpenCode V2 nests server names under `mcp.servers` and uses `disabled` instead of `enabled`; its local server definition is otherwise equivalent:
```jsonc
{
"$schema": "https://opencode.ai/config.json",
"mcp": {
"servers": {
"socraticode": {
"type": "local",
"command": ["npx", "-y", "--prefer-online", "socraticode@latest"],
"disabled": false,
"environment": {}
}
}
}
}
```
See [OpenCode 1.x MCP servers](https://opencode.ai/docs/mcp-servers/), [OpenCode V2 MCP servers](https://opencode.ai/v2/docs/mcp-servers), and [OpenCode configuration](https://opencode.ai/docs/config/).
### Other local stdio MCP hosts
The complete JSON object in [Quick Start](#quick-start) applies only to hosts whose documentation specifies an `mcpServers` object. Add it at the user or project scope documented by that host, restart the MCP server or start a new session, and verify SocratiCode in the host's MCP server and tool list. The example already checks for the latest published engine whenever the server starts. Hosts that support only remote HTTP MCP servers cannot launch SocratiCode directly.
## Why SocratiCode
I built SocratiCode because I regularly work on existing, large, and complex codebases across different languages and need to quickly understand them and act. Existing solutions were either too limited, insufficiently tested for production use, or bloated with unnecessary complexity. I wanted a single focused tool that does deep codebase intelligence well — zero setup, no bloat, fully automatic — and gets out of the way.
### Built-in Code Search vs SocratiCode
| Feature | Claude Code | Cursor | VS Code Copilot | + SocratiCode |
|:--------|:-----------:|:------:|:---------------:|:-------------:|
| Text / grep search | ✅ | ✅ | ✅ | ✅ |
| Semantic search | — | ✅ | ✅¹ | ✅ |
| Hybrid search (fused) | — | — | — | ✅ |
| Code dependency graph | — | — | ✅² | ✅ |
| Symbol-level impact / blast radius | — | — | — | ✅ |
| Call-flow tracing (entry point → callees) | — | — | — | ✅ |
| Interactive visual graph explorer | — | — | — | ✅ |
| Circular dependency detection | — | — | — | ✅ |
| Non-code knowledge (schemas, API specs) | — | — | — | ✅ |
| Cross-project search | — | — | — | ✅ |
| Branch-aware indexing | — | — | — | ✅ |
| Multi-agent shared index | — | — | — | ✅ |
| Tool-independent (survives switching AI) | — | — | — | ✅ |
| Fully local / private | ✅ | —³ | —⁴ | ✅ |
| Resumable indexing | — | — | — | ✅ |
| Live file watching | — | ✅ | — | ✅ |
<sub>¹ VS Code Copilot: remote index via GitHub / Azure DevOps; local "External Ingest" gradually rolling out. ² LSP-based Find References / Go to Definition (Usages tool), not a full dependency graph. ³ Cursor: embeddings processed on Cursor servers (encrypted in transit and at rest). ⁴ VS Code Copilot: remote index hosted on GitHub / Azure DevOps. Sources: [Cursor docs](https://docs.cursor.com/context/codebase-indexing), [Claude Code docs](https://docs.anthropic.com/en/docs/claude-code/overview), [VS Code Copilot docs](https://code.visualstudio.com/docs/copilot/chat/codebase-context).</sub>
> **🔌 The context lives with your codebase, not with the assistant.** Built-in indexes (Cursor's, Copilot's) are tied to that one tool — switch assistants and you start from scratch. SocratiCode is independent: index once, then plug it into Claude Code, Cursor, Copilot, Windsurf, your own private model, or all of them at once. They share the same understanding of your code.
On VS Code's 2.45M‑line codebase, SocratiCode answers architectural questions with **61% less data**, **84% fewer steps**, and **37× faster** response than a grep‑based AI agent. [Full benchmark →](#real-world-benchmark-vs-code-245m-lines-of-code-with-claude-opus-46)
## Features
- **Hybrid code search** — Built on Qdrant, a purpose-built vector database with HNSW indexing, concurrent read/write, and payload filtering. Each chunk stores both a dense vector and a BM25 sparse vector; the Query API runs both sub-queries in a single round-trip and fuses results with Reciprocal Rank Fusion (RRF). Semantic search handles conceptual queries like "authentication middleware" even when those exact words don't appear in the code. BM25 handles exact identifier and keyword lookups. You get the best of both in every query with no tuning required.
- **Configurable Qdrant** — Use the built-in Docker Qdrant (default, zero config) or connect to your own instance (self-hosted, remote server, or Qdrant Cloud). Configure via `QDRANT_MODE`, `QDRANT_URL`, and `QDRANT_API_KEY` environment variables.
- **Configurable Ollama** — Use the built-in Docker Ollama (default, zero config) or point to your own Ollama instance (native install -GPU access-, remote server, etc.). Configure via `OLLAMA_MODE`, `OLLAMA_URL`, `EMBEDDING_MODEL` and `EMBEDDING_DIMENSIONS` environment variables.
- **Multi-provider embeddings** — Switch between Local Ollama (private, GPU access), Docker Ollama (zero-config), OpenAI (`text-embedding-3-small`, fastest), Google Gemini (`gemini-embedding-001`, free tier), LM Studio (local OpenAI-compatible server), or LiteLLM (proxy gateway in front of 100+ providers) with a single environment variable. No provider-specific configuration files.
- **Private & secure** — Everything runs on your machine — your code never leaves your network. The default Docker setup includes Ollama (embeddings) and Qdrant (vector storage) with no external API calls. No API costs, no token limits. Suitable for air-gapped and on-premises environments. Optional cloud providers (OpenAI, Google Gemini, Qdrant Cloud) are available but never required.
- **AST-aware chunking** — Files are split at function/class boundaries using AST parsing (ast-grep), not arbitrary line counts. This produces higher-quality search results. Falls back to line-based chunking for unsupported languages.
- **Polyglot code dependency graph** — Static analysis of import/require/use/include statements using ast-grep for 19+ languages. No external tools like dependency-cruiser required. Detects circular dependencies and generates visual Mermaid diagrams.
- **Broad language support** — Works with every [supported file type](#language-support) out of the box. Fully supported languages bundle their grammars. GDScript uses an optional native parser when compatible and a syntax-aware fallback otherwise. For non-standard extensions, configure [`EXTRA_EXTENSIONS`](#environment-variables). If your AI can read it, SocratiCode can index it.
- **Incremental indexing** — After the first full index, only changed files are re-processed. Content hashes are persisted in Qdrant so state survives server restarts.
- **Batched & resumable indexing** — Files are processed in batches of 50, with progress checkpointed to Qdrant after each batch. If the process crashes or is interrupted, the next run automatically resumes from where it left off — already-indexed files are skipped via hash comparison. This keeps peak memory low and makes indexing reliable even for very large codebases.
- **Live file watching** — Optionally watch for file changes and keep the index updated in real time (debounced 2s). Watcher also invalidates the code graph cache.
- **Parallel processing** — Files are scanned and chunked in parallel batches (50 at a time) for fast I/O, while embedding generation and upserts are batched separately for optimal throughput.
- **Multi-project** — Index multiple projects simultaneously. Each gets its own isolated collection with full project path tracking.
- **Cross-project search** — Search across multiple related projects in a single query. Link projects via `.socraticode.json` or the `SOCRATICODE_LINKED_PROJECTS` env var, then set `includeLinked: true` on `codebase_search`. Results are tagged with project labels and ranked by cosine similarity, which is comparable across projects of very different sizes (falling back to rank fusion when a cosine is unavailable for any hit).
- **Branch-aware indexing** — Maintain separate indexes per git branch by setting `SOCRATICODE_BRANCH_AWARE=true`. Each branch gets its own Qdrant collections, so switching branches instantly switches to the correct index. Ideal for CI/CD pipelines and PR review workflows.
- **Respects ignore rules** — Honors all `.gitignore` files (root + nested), plus an optional `.socraticodeignore` for additional exclusions. Includes sensible built-in defaults. `.gitignore` processing can be disabled via `RESPECT_GITIGNORE=false`. Dot-directories (e.g. `.agent`) can be included via `INCLUDE_DOT_FILES=true`.
- **Custom file extensions** — Projects with non-standard extensions (e.g. `.tpl`, `.blade`) can be included via `EXTRA_EXTENSIONS` env var or `extraExtensions` tool parameter. Such files are indexed as plaintext and appear as leaf nodes in the code graph (no AST chunking or symbols). To instead treat a custom extension as a real language (full AST chunking, symbols, call graph), map it with `EXTENSION_LANGUAGE_MAP` (e.g. `.inc:php`).
- **Configurable infrastructure** — All ports, hosts, and API keys are configurable via environment variables. Qdrant API key support for enterprise deployments.
- **Enterprise-ready simplicity** — No agent coordination tuning, no memory limit environment variables, no coordinator/conductor capacity knobs, no backpressure configuration. SocratiCode scales by relying on production-grade infrastructure (Qdrant, proven embedding APIs) rather than complex in-process orchestration.
- **Auto-setup & zero configuration** — Just install the Claude Plugin/Skill or add the MCP server to your AI host config. On first use, the server automatically checks Docker, pulls images, starts Qdrant and Ollama containers, and downloads the embedding model. No config files, YAML, environment variables, or required native compilation. The optional GDScript parser falls back safely when no compatible native build is available. Works everywhere Docker runs.
- **Session resume** — By default, server startup resumes the indexed project represented by the MCP process's working directory. Complete indexes get a watcher plus an incremental catch-up update; interrupted indexes resume from the last checkpoint. Explicit project lists and `SOCRATICODE_AUTO_RESUME=all` extend this to other indexed projects.
- **Auto-start watcher** — In the default `SOCRATICODE_WATCHER=auto` mode, the file watcher starts during startup resume and after `codebase_index` or `codebase_update`. A completed indexed project not selected at startup gets a fallback watcher start on its first search, status, or graph interaction. `manual` permits only an explicit `codebase_watch { action: "start" }`; `off` disables watcher startup completely.
- **Manual index snapshots** — `SOCRATICODE_WATCHER=off` plus `SOCRATICODE_AUTO_RESUME=off` prevents implicit code-index updates, embeddings, and graph creation. Existing code indexes and graphs stay readable; refresh them explicitly with `codebase_index`, `codebase_update`, or `codebase_graph_build`.
- **Auto-build code graph** — The code dependency graph is automatically built after indexing and rebuilt when watched files change. No need to call `codebase_graph_build` manually unless you want to force a rebuild.
- **Multi-agent collaboration** — Multiple AI agents (each running their own MCP instance) can work on the same codebase simultaneously and share a single index. One agent triggers indexing, all agents search against the same data. Only one watcher runs per project — every agent benefits from real-time updates. Cross-process file locking coordinates indexing and watching automatically. Ideal for workflows like one agent writing tests while another fixes code, or a planning agent and an implementation agent working in parallel.
- **Cross-process safety** — File-based locking (`proper-lockfile`) prevents multiple MCP instances from simultaneously indexing or watching the same project. Stale locks from crashed processes are automatically reclaimed. When another MCP process is already watching a project, `codebase_status` reports "active (watched by another process)" instead of incorrectly showing "inactive."
- **Concurrency guards** — Duplicate indexing and graph-build operations are prevented. If you call `codebase_index` while indexing is already running, it returns the current progress instead of starting a second operation.
- **Graceful stop** — Long-running indexing operations can be stopped safely with `codebase_stop`. The current batch finishes and checkpoints, preserving all progress. Re-run `codebase_index` to resume from where it left off.
- **Graceful shutdown** — On server shutdown, active indexing operations are given up to 60 seconds to complete, all file watchers are stopped cleanly, and the everything closes gracefully.
- **Structured logging** — All operations are logged with structured context for observability. Log level configurable via `SOCRATICODE_LOG_LEVEL`.
- **Graceful degradation** — If infrastructure goes down during watch, the watcher backs off and retries instead of crashing.
## Prerequisites
| Dependency | Purpose | Install |
|------------|---------|---------|
| [Docker](https://www.docker.com/products/docker-desktop/) | Runs Qdrant (vector DB) and by default Ollama (embeddings) | [docker.com](https://www.docker.com/products/docker-desktop/) |
| Node.js 18.17+ with `npx` on `PATH` | Runs the MCP server | [nodejs.org](https://nodejs.org/) |
Docker must be **running** when you use the server in the default `managed` mode.
The Qdrant container is managed automatically. If you set `QDRANT_MODE=external` and point `QDRANT_URL` at a remote or cloud Qdrant instance, Docker is only needed for Ollama (embeddings) in that case.
The Ollama container (embeddings) is also managed automatically in the default `auto` mode. SocratiCode first checks if Ollama is already running natively — if so it uses it. Otherwise it manages a Docker container for you. First-time download of the docker images or embedding models may take a few minutes, depending on your internet speed, and is required only at first launch.
### Embedding performance on macOS / Windows
Docker containers on macOS and Windows cannot access the GPU (no Metal or CUDA passthrough). For small projects this is fine, but for medium-to-large codebases the CPU-only container is noticeably slower.
**For best performance, install native Ollama:** download and run the installer from [ollama.com/download](https://ollama.com/download). Once Ollama is running, SocratiCode will automatically detect and use it — no extra configuration needed (first-time download of the embedding model, if not present, might take a few minutes). This gives you Metal GPU acceleration on macOS and CUDA on Windows/Linux.
If you prefer speed without a local install, see [OpenAI Embeddings](#openai-embeddings) and [Google Generative AI Embeddings](#google-generative-ai-embeddings) below for cloud-based options. OpenAI is very fast with no local setup required. Google’s free tier is functional but rate-limited. See [Environment Variables](#environment-variables) for configuration details.
## Example Workflow
All tools default `projectPath` to the current working directory, so you never need to specify a path for the active project.
```
User: "Index this project"
→ codebase_index {}
⚡ Indexing started in the background — call codebase_status to check progress
→ codebase_status {}
⚠ Full index in progress — Phase: generating embeddings (batch 1/1)
Progress: 247/1847 chunks embedded (13%) — Elapsed: 12s
→ codebase_status {}
✓ Indexing complete: 342 files, 1,847 chunks (took 115.2s)
File watcher: active (auto-updating on changes)
User: "Search for how authentication is handled"
→ codebase_search { query: "authentication handling" }
Runs dense semantic search + BM25 keyword search in parallel, fuses results with RRF
Returns top 10 results ranked by combined relevance
User: "What files depend on the auth middleware?"
→ codebase_graph_query { filePath: "src/middleware/auth.ts" }
Returns imports and dependents
(graph was auto-built after indexing — no manual build needed)
User: "Show me the dependency graph"
→ codebase_graph_visualize {}
Returns a Mermaid diagram colour-coded by language
User: "Are there any circular dependencies?"
→ codebase_graph_circular {}
Found 2 cycles: src/a.ts → src/b.ts → src/a.ts
User: "What breaks if I rename validateUser?"
→ codebase_impact { target: "validateUser" }
Blast radius for symbol: validateUser
Hop 1 (3 files): src/auth/login.ts, src/api/users.ts, tests/auth.test.ts
Hop 2 (5 files): ...
User: "What does the server entry point actually do?"
→ codebase_flow {}
Detected 4 entry point(s):
main (cmd/server.go:10) — well-known-name:main
healthz (src/api/routes.ts:42) — framework:get
...
→ codebase_flow { entrypoint: "main" }
└── main (cmd/server.go:10)
├── loadConfig (cmd/server.go:15)
└── startServer (src/server.ts:8)
└── ...
User: "Who calls bcryptCompare and what does it call?"
→ codebase_symbol { name: "bcryptCompare" }
Symbol: bcryptCompare (function)
Defined: src/auth/hash.ts:42–58
Callers (3): ← src/auth/login.ts:12, ← src/auth/reset.ts:30 ...
Callees (1): → compare [unique, 1 candidate]
```
## Agent Instructions
> **Claude Code plugin users**: These instructions are included automatically as skills in the SocratiCode plugin. You don't need to copy them into `CLAUDE.md`. The section below is for non-Claude Code hosts (VS Code, Cursor, Claude Desktop, etc.).
For best results, add instructions like the following to your AI assistant's project-level instructions file. The core principle: **search before reading**. The index gives you a map of the codebase in milliseconds; raw file reading is expensive and context-consuming.
**Where to place these instructions** (per IDE):
| IDE / Tool | Instructions file |
|:-----------|:-----------------|
| Claude Code | `CLAUDE.md` at project root (auto-loaded). Plugin users get this via skills automatically. |
| Cursor | `AGENTS.md` at project root, or `.cursor/rules/socraticode.mdc` for a dedicated rule file |
| VS Code Copilot | `.github/copilot-instructions.md`, or a custom instructions file in your VS Code User prompts folder |
| Zed | `AGENTS.md` at project root, or `~/.config/zed/AGENTS.md` for personal instructions. Zed uses the first matching supported project instruction file. |
| Windsurf | `.windsurfrules` at project root |
| Claude Desktop / Cline / Roo Code | Add directly to your system prompt configuration |
> **Why this matters**: Installing the MCP server alone gives your agent access to SocratiCode tools, but the agent still decides when to use them. Adding these instructions to your project ensures the agent consistently prefers SocratiCode search over raw file reads, uses the graph for dependency-aware tasks, and follows the search-before-reading workflow.
```markdown
## Codebase Search (SocratiCode)
This project is indexed with SocratiCode. Always use its MCP tools to explore the codebase
before reading any files directly.
### Workflow
1. **Start most explorations with `codebase_search`.**
Hybrid semantic + keyword search (vector + BM25, RRF-fused) runs in a single call.
- Use broad, conceptual queries for orientation: "how is authentication handled",
"database connection setup", "error handling patterns".
- Use precise queries for symbol lookups: exact function names, constants, type names.
- Prefer search results to infer which files to read — do not speculatively open files.
- **When to use grep instead**: If you already know the exact identifier, error string,
or regex pattern, grep/ripgrep is faster and more precise — no semantic gap to bridge.
Use `codebase_search` when you're exploring, asking conceptual questions, or don't
know which files to look in.
2. **Follow the graph before following imports.**
Use `codebase_graph_query` to see what a file imports and what depends on it before
diving into its contents. This prevents unnecessary reading of transitive dependencies.
- **Before modifying or deleting a file**, check its dependents with `codebase_graph_query`
to understand the blast radius.
- **When planning a refactor**, use the graph to identify all affected files before
making changes.
3. **Use Impact Analysis BEFORE refactoring, renaming, or deleting code.**
The symbol-level call graph (`codebase_impact`, `codebase_flow`, `codebase_symbol`,
`codebase_symbols`) goes one step deeper than the file graph: it knows which
functions and methods call which.
- `codebase_impact` answers "what breaks if I change X?" (blast radius — every file
that transitively calls into the target).
- `codebase_flow` answers "what does this code do?" by tracing forward from an entry
point. Call with no `entrypoint` to discover candidate entry points (auto-detected
via orphans, conventional names like `main()`, framework routes, tests).
- `codebase_symbol` gives a 360° view of one function: definition, callers, callees.
- `codebase_symbols` lists symbols in a file or searches by name.
- Always prefer these over reading multiple files when the question is about
dependencies between functions, not concepts.
4. **Read files only after narrowing down via search.**
Once search results clearly point to 1–3 files, read only the relevant sections.
Never read a file just to find out if it's relevant — search first.
5. **Use `codebase_graph_circular` when debugging unexpected behaviour.**
Circular dependencies cause subtle runtime issues; check for them proactively.
Also run `codebase_graph_circular` when you notice import-related errors or unexpected
initialisation order.
6. **Check `codebase_status` if search returns no results.**
The project may not be indexed yet. Run `codebase_index` if needed, then wait for
`codebase_status` to confirm completion before searching.
7. **Leverage context artifacts for non-code knowledge.**
Projects can define a `.socraticodecontextartifacts.json` config to expose database
schemas, API specs, infrastructure configs, architecture docs, and other project
knowledge that lives outside source code. These artifacts are auto-indexed alongside
code during `codebase_index` and `codebase_update`.
- Run `codebase_context` early to see what artifacts are available.
- Use `codebase_context_search` to find specific schemas, endpoints, or configs
before asking about database structure or API contracts.
- If `codebase_status` shows artifacts are stale, run `codebase_context_index` to
refresh them.
### When to use each tool
| Goal | Tool |
|------|------|
| Understand what a codebase does / where a feature lives | `codebase_search` (broad query) |
| Find a specific function, constant, or type | `codebase_search` (exact name) or grep if you know already the exact string |
| Find exact error messages, log strings, or regex patterns | grep / ripgrep |
| See what a file imports or what depends on it | `codebase_graph_query` |
| Check blast radius before modifying or deleting a file | `codebase_impact` (symbol-level) or `codebase_graph_query` (file-level) |
| **What breaks if I change function X?** | `codebase_impact target=X` |
| **What does this entry point actually do?** | `codebase_flow entrypoint=X` |
| **List entry points in this codebase** | `codebase_flow` (no args) |
| **Who calls this function and what does it call?** | `codebase_symbol name=X` |
| **What functions/classes exist in this file?** | `codebase_symbols file=path` |
| **Search for symbols by name across the project** | `codebase_symbols query=X` |
| Spot architectural problems | `codebase_graph_circular`, `codebase_graph_stats` |
| Visualise module structure | `codebase_graph_visualize` |
| Verify index is up to date | `codebase_status` |
| Discover what project knowledge (schemas, specs, configs) is available | `codebase_context` |
| Find database tables, API endpoints, infra configs | `codebase_context_search` |
```
> **Why semantic search first?** A single `codebase_search` call returns ranked, deduplicated snippets from across the entire codebase in milliseconds. This gives you a broad map at negligible token cost — far cheaper than opening files speculatively. Once you know which files matter, targeted reading is both faster and more accurate. That said, grep remains the right tool when you have an exact string or pattern — use whichever fits the query.
> **Keep the connection alive during indexing.** Indexing runs in the background — the MCP server continues working even when not actively responding to tool calls. However, some MCP hosts might disconnect an idle MCP connection after a period of inactivity, which might cut off the background process. Instruct your AI to call `codebase_status` roughly every 60 seconds after starting `codebase_index` until it completes. This keeps the host connection active and provides real-time progress.
## Configuration
### Install
Use the host-specific steps in [Plugins and host integrations](#plugins-and-host-integrations). They cover installation scope, activation, verification, updates, and each host's actual configuration schema.
#### From source (for contributors)
```bash
git clone https://github.com/giancarloerra/socraticode.git
cd socraticode
npm install
npm run build
```
Register `node /absolute/path/to/socraticode/dist/index.js` in the user or project scope supported by your MCP host, then restart the server or start a new session. Verify SocratiCode in the host's MCP server list. To update, run `git pull --ff-only`, `npm install`, and `npm run build` in the clone, then restart the MCP server and verify it again.
### MCP host config variants
The examples below use the conventional JSON `mcpServers` shape to show SocratiCode settings. Apply the same command and environment values through the host-specific schema documented in [Plugins and host integrations](#plugins-and-host-integrations). Continue, Gemini CLI, VS Code, Zed, and OpenCode use different configuration paths or wrappers.
#### Default (zero config, from source)
> Using **npx**? Replace the `node` command and source path below with `"command": "npx"` and `"args": ["-y", "--prefer-online", "socraticode@latest"]`.
```json
{
"mcpServers": {
"socraticode": {
"command": "node",
"args": ["/absolute/path/to/socraticode/dist/index.js"]
}
}
}
```
> **Tip**: The default `OLLAMA_MODE=auto` detects native Ollama (port 11434) on startup and uses it if available, otherwise falls back to a managed Docker container. To make your config self-documenting, add an `"env"` block with explicit values. See [Environment Variables](#environment-variables) for all options.
#### External Ollama (native install)
If you have [Ollama](https://ollama.com) installed natively, set `OLLAMA_MODE=external` and point to your instance:
```json
{
"mcpServers": {
"socraticode": {
"command": "node",
"args": ["/absolute/path/to/socraticode/dist/index.js"],
"env": {
"OLLAMA_MODE": "external",
"OLLAMA_URL": "http://localhost:11434"
}
}
}
}
```
The embedding model is pulled automatically on first use. To pre-download: `ollama pull nomic-embed-text`
#### Remote Ollama server
```json
{
"mcpServers": {
"socraticode": {
"command": "node",
"args": ["/absolute/path/to/socraticode/dist/index.js"],
"env": {
"OLLAMA_MODE": "external",
"OLLAMA_URL": "http://gpu-server.local:11434"
}
}
}
}
```
#### OpenAI Embeddings
Use OpenAI's cloud embedding API instead of local Ollama. Requires an [API key](https://platform.openai.com/api-keys).
```json
{
"mcpServers": {
"socraticode": {
"command": "node",
"args": [