cocoindex MCP
Uses Hugging Face sentence-transformers models to generate embeddings for documents and queries, enabling similarity search.
Provides semantic search over indexed repositories and documents stored in a PostgreSQL database with the pgvector extension.
Click on "Install 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., "@cocoindex MCPsearch for error handling patterns in the codebase"
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.
cocoindex MCP
An MCP server that incrementally indexes repositories and documents into a Postgres + pgvector store using CocoIndex, and exposes semantic search over them.
The pipeline is source → extract (format registry) → chunk → embed → store:
Sources (
src/mcp_coco/sources.py) — local filesystem today, as two profiles:repo(code-aware, vendored dirs excluded) anddocument(markdown/text/pdf, prose chunking).Formats (
src/mcp_coco/formats.py) — a registry mapping a file to normalized text. PDF (viapymupdf) is just one handler; add a format by registering one.Indexer (
src/mcp_coco/indexer.py) — the CocoIndex app: chunk + embed (sentence-transformers) and declare rows into onedoc_embeddingstable.Search (
src/mcp_coco/db.py) — embeds the query and runs a pgvector similarity search.
CocoIndex tracks its incremental state in a local LMDB file (COCOINDEX_DB), so
re-indexing only reprocesses what changed and removes rows for deleted files.
Prerequisites
uv (Python package manager)
just (task runner, optional but convenient)
A Postgres instance with pgvector
Docker (if you want to run pgvector via the included compose file)
Related MCP server: ragi
Quick start (local)
1. Start a pgvector database
If you already have a Postgres instance with pgvector, skip this step and set
DATABASE_URL accordingly.
Otherwise, use the included compose file:
docker compose up -dThis starts pgvector on localhost:5432 with user/password/db all set to cocoindex.
2. Install dependencies
uv sync3. Configure
cp .env.example .envEdit .env and set DATABASE_URL to point at your Postgres instance. For the
Docker-based database:
DATABASE_URL=postgresql://cocoindex:cocoindex@localhost:5432/cocoindex4. Verify the database connection
just init5. Index something
just index ./path/to/repo repo
just index ./path/to/docs documentThe first run downloads the embedding model (~80 MB) from Hugging Face.
6. Search
just search "how does authentication work"Using with Coding Agents
Add the MCP server to your Claude Code settings
(~/.claude/settings.json for global, or .claude/settings.json in a project):
{
"mcpServers": {
"cocoindex": {
"command": "uv",
"args": ["run", "--directory", "/absolute/path/to/cocoindex-mcp", "mcp-coco-server"],
"env": {
"DATABASE_URL": "postgresql://cocoindex:cocoindex@localhost:5432/cocoindex",
"COCOINDEX_DB": "/absolute/path/to/cocoindex-mcp/.cocoindex/state.db"
}
}
}
}Replace /absolute/path/to/cocoindex-mcp with the actual path to this repository.
If your Postgres instance is elsewhere (e.g. a cloud-hosted database), adjust
DATABASE_URL accordingly. It is highly encouraged to pass your authentication information through env vars, do NOT hardcode into the connection string!
Once configured, Claude Code can use these tools:
Tool | Description |
| Index a code repository |
| Index a document collection |
| Semantic search over indexed content |
Development (devcontainer)
Open this folder in VS Code and Reopen in Container (Dev Containers). The
dbservice starts automatically alongside the app container.Run the preflight check:
just install just initCopy
.env.exampleto.envto customize settings. Inside the devcontainer the database hostname isdb(the default).
just recipes
just index <path> [repo|document|auto] # index a path
just index-repo <path> # index as code repository
just index-docs <path> # index as document collection
just search "query" [limit] # semantic search
just drop <path> [repo|document|auto] # remove a source from the index
just visualize_index # show a map of what's indexed
just serve # run the MCP server over stdio
just test # run tests
just lint # run ruffMaintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Tools
Latest Blog Posts
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/datarian/mcp-coco'
If you have feedback or need assistance with the MCP directory API, please join our Discord server