code-index-pg
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@code-index-pg find all callers of the function validate_token and show their files"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
code-index-pg
Unified code index for Hermes: exact + semantic + call graph search over the TGT One monorepo, persisted in postgres. Replaces the code-index fork, cocoindex and CodeGraphContext with one lightweight MCP server.
Stack
postgres-local (port 5432, DB
codeindex) + pgvector 0.8.3Ollama
bge-m3(1024 dims) for embeddings — no torch in this venvtree-sitter-language-pack (21 languages) for symbol extraction
fastmcp — single MCP process, no extra daemons
Related MCP server: Tree-Sitter MCP
Install
git clone https://github.com/tgt-technology/code-index-pg.git
cd code-index-pg
uv sync
uv tool install --editable .DB: la infraestructura (postgres + pgvector, ollama + bge-m3, base codeindex) se
levanta con deploy/ — ver Deploy. El esquema de tablas lo
aplica el server al arrancar.
Deploy (entorno desde cero)
El índice vive en postgres, no en archivos: reproducir el entorno es levantar la infra, no
copiar datos. Todo está en deploy/.
Windows (Docker Desktop + uv):
powershell -NoProfile -File deploy\setup.ps1 # -Gpu si hay GPU NVIDIALinux / WSL:
deploy/setup.sh # --gpu si hay GPU NVIDIAEl script levanta postgres (pgvector) + ollama, crea la base codeindex con la extensión
vector, descarga bge-m3, instala el server como uv tool y verifica cada punto al final
(falla con mensaje claro si algo quedó a medias).
Después, una sola vez, el índice inicial (~30 min para ~7K archivos):
uv run python -c "from code_index_pg.indexer_pipeline import index_project; print(index_project('/ruta/a/tu/codigo'))"Registro en Hermes — el wrapper espera a que postgres acepte conexiones antes de lanzar el server (sin eso, el server muere si la BD no está lista):
# Linux / WSL
hermes mcp add codeindex --command /ruta/al/repo/deploy/mcp-wrapper.sh
# Windows
hermes mcp add codeindex --command powershell --args -NoProfile -File C:\ruta\al\repo\deploy\mcp-wrapper.ps1Solo los servicios van en Docker: el server MCP es stdio y corre en el host, usando los
defaults del código (127.0.0.1:5432/codeindex, http://localhost:11434).
Run
# MCP server (stdio — used by the proxy wrapper)
code-index-pg --project-path ~/develop
# Full index (one-time, ~10 min for ~7K files)
python -m code_index_pg.indexer_pipeline # via test harness, or:
uv run python -c "from code_index_pg.indexer_pipeline import index_project; print(index_project('/home/jam/develop'))"MCP tools
Tool | Description |
| Index a project and start the incremental watcher |
| Incremental re-index: add missing files, drop deleted ones (no re-embed) |
| Literal/regex search over symbol names + file paths (paginated) |
| Embedding similarity search (bge-m3, pgvector cosine) |
| Symbols that call the given symbol |
| Symbols called by the given symbol |
| 2-level recursive callers + affected files |
| Glob search over indexed files |
| Signature, docstring, location of a symbol |
| Language, line count, symbols of a file |
| Indexed projects + counts + active project |
| Remove an indexed project and all its data in cascade (rejects the active project) |
Hermes integration
Proxy: port 3104 in
~/.hermes/scripts/mcp-proxies.sh(supervisor systemd)Wrapper:
~/.hermes/scripts/mcp-codeindex-wrapper.shRegister:
hermes mcp add codeindex --url http://127.0.0.1:3104/mcp
Environment
Var | Default | Notes |
|
| local tool |
|
| embeddings |
|
| must match pgvector dims (1024) |
| unset | active project (set via |
Tests
uv run pytest tests/ -q # unit + contract (in-memory MCP client)Spec / OpenSpec
Living spec: openspec/specs/code-index/spec.md — archived changes in
openspec/changes/archive/ (unified-code-index, project-directory-management).
License
MIT — free to use, modify and redistribute. See LICENSE.
Available Tools
12 toolscallees_ofA
List symbols called by the given symbol.
Inputs: symbol (required). Returns: object
callers_ofB
List symbols that call the given symbol.
Inputs: symbol (required). Returns: object
find_filesC
Find files by glob pattern.
Inputs: glob (required). Returns: object
get_file_summaryB
Summarize a file: language, line count, symbols.
Inputs: path (required). Returns: object
get_statusA
Show indexed projects and counts.
Inputs: no named parameters. Returns: object
get_symbol_bodyA
Get the signature, docstring and location of a symbol.
Inputs: symbol (required). Returns: object
impact_analysisB
2-level recursive callers and affected files for a symbol.
Inputs: symbol (required). Returns: object
remove_projectA
Remove an indexed project and all its data (cascade).
Inputs: path (required). Returns: object
search_codeB
Search symbols and files by literal, regex, or fuzzy match.
Inputs: pattern (required), page, fuzzy, regex, +1 more. Returns: object
search_semanticA
Search code by meaning using embeddings (bge-m3 via Ollama).
Inputs: query (required), limit. Returns: object
set_project_pathC
Index a project directory and make it the active project.
Inputs: path (required). Returns: object
update_indexA
Incremental update: index missing files, drop deleted ones (no re-embed).
Inputs: no named parameters. Returns: object
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 12 tools
Each tool targets a distinct operation: indexing, searching (literal vs semantic), graph queries (callers/callees), file operations, and project management. No two tools appear to overlap in purpose.
Most tool names follow a clear verb_noun pattern (set_project_path, search_code, get_status). Minor exception: 'callers_of' and 'callees_of' use a different prepositional style, but still readable and predictable.
12 tools is well within the ideal range for a code indexing/search server. Each tool serves a distinct function needed for code navigation and project management, with no redundancy.
The surface covers the full lifecycle: project setup, incremental updates, multiple search modes, symbol graph queries, file and symbol detail, and project removal. Missing features like batch re-index or cross-project search are minor and not essential.
Related MCP Connectors
Ask a codebase what calls what: search, blast radius, paths between symbols, and diffs.
Code intelligence for coding agents: semantic, AST, graph, and full-text search. 279+ languages.
Search indexed code, trace dependencies, assess change impact, and recall repository memory.
Ask who calls a route, what a change breaks or who reads a field, across a system's repos.
Related MCP Servers
- AlicenseAqualityDmaintenanceEnables fast code analysis and navigation through hybrid semantic search, graph-based relationship tracking, and structure exploration across multiple programming languages with optimized indexing for large codebases.83MIT
- AlicenseNot gradedqualityDmaintenanceEnables fast semantic code search and analysis across 15+ programming languages. Supports searching for functions and classes, tracing code usage, detecting syntax errors, and analyzing code quality and structure.20 npm33GPL 3.0
- AlicenseNot gradedqualityDmaintenanceProvides knowledge extraction and cross-repo analysis tools for multi-repository organizations. It enables users to query type definitions, service dependencies, and infrastructure configurations across an entire organization's codebase.MIT
- AlicenseNot gradedqualityDmaintenanceProvides semantic code search and code insights via a knowledge graph, enabling AI to understand, navigate, and modify complex projects with deep dependency and architecture analysis.MIT