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/cocoindexOptional settings:
Variable | Default | Description |
|
| Embedding model for indexing and search |
|
| Cross-encoder model for result re-ranking |
|
| Postgres table name |
|
| Path to CocoIndex incremental state store |
4. 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 — returns condensed summaries and a |
| Retrieve full details for specific results from a previous search |
Two-stage search
To keep context lean, search writes full results to a temporary JSON file
and returns only condensed summaries (~80-char excerpts) inline. The caller
triages from the summary, then uses read_search_results to fetch full
details for the results it actually needs.
By default, read_search_results re-ranks the selected results using a
cross-encoder model (cross-encoder/ms-marco-MiniLM-L-6-v2) for more
accurate relevance ordering. Disable with rerank=false. The model is
configurable via the RERANK_MODEL environment variable.
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 ruffAvailable Tools
3 toolsindex_documentsIndex DocumentsC
Index a document collection (markdown, text, PDF, ...).
| Name | Required | Description | Default |
|---|---|---|---|
| path | Yes |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
No annotations are provided, so the description must carry the full burden. It only says 'Index a document collection', with no details on side effects (e.g., destructive vs. read-only), required permissions, or rate limits. This is insufficient for safe tool invocation.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is extremely concise (one sentence) and front-loaded with the action. However, it sacrifices necessary detail; conciseness is good but should not come at the cost of completeness.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given the lack of annotations, output schema, and parameter descriptions, the description is severely incomplete. It does not explain what 'index' means, the process, or what the tool returns, making it inadequate for an agent to select and invoke correctly.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema coverage is 0%, meaning the 'path' parameter has no description. The description implies 'path' points to a collection of files but does not clarify whether it expects a directory, a file, or how to specify file types. It adds minimal value beyond the parameter name.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the action ('Index') and the resource ('document collection'), with specific file types (markdown, text, PDF). It implicitly distinguishes from sibling 'index_repo' (likely for code repos) and 'search' (a different operation).
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
No guidance on when to use this tool versus alternatives like 'index_repo' or 'search'. The description does not mention context or exclusions.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
index_repoIndex RepositoryB
Index a code repository (code-aware chunking, vendored dirs skipped).
| Name | Required | Description | Default |
|---|---|---|---|
| path | Yes |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations provided, the description carries full responsibility for behavioral disclosure. It mentions code-aware chunking and skipping vendored dirs, which are useful behaviors, but it does not indicate whether the operation is destructive, requires specific permissions, or any rate limits. Given that indexing likely involves writing to storage, more transparency is needed.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is a single sentence with no wasted words. It fronts the core action ('Index a code repository') immediately and adds the key differentiators in parentheses. Every word earns its place.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given the tool performs an operation with potential side effects (indexing), the description is too brief. It lacks information about the output or success/failure indicators, prerequisites like repository structure, and any associated side effects (e.g., overwriting existing index). With no output schema, the description should provide more context about what happens after indexing.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
The input schema has 0% description coverage, so the description must compensate. The single parameter 'path' is implicitly explained by the tool's purpose: it is the file system path to the repository. However, the description does not specify format (absolute/relative), constraints, or expected content. The added value is marginal but sufficient for a simple parameter.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the tool's purpose: 'Index a code repository'. It adds specific details like 'code-aware chunking' and 'vendored dirs skipped', which distinguishes it clearly from siblings like index_documents (likely for other file types) and search (querying). The verb 'index' and resource 'code repository' are specific.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description implies usage when you need to index a repository with code-aware chunking and skip vendored directories, but it does not explicitly state when to use this tool versus alternatives like index_documents. There is no mention of prerequisites or conditions for use, nor when not to use it.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
searchSearch IndexA
Semantic search over indexed repos/documents. Optionally filter by source_kind ('repo' or 'document').
| Name | Required | Description | Default |
|---|---|---|---|
| limit | No | ||
| query | Yes | ||
| source_kind | No |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
No annotations are provided, so the description carries full burden. It only mentions 'semantic search' and filtering, but fails to disclose behavioral traits such as read-only nature, latency, pagination, or what happens with no results.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
Two sentences with no wasted words, front-loaded with the main action. Easy to scan.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
For a 3-parameter search tool with no output schema, the description is minimal but covers the core functionality. Lacks information on result format, pagination, or how to interpret 'semantic search', leaving some gaps.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
The description adds meaning for the source_kind parameter by specifying possible values ('repo' or 'document'). However, with 0% schema coverage, it does not compensate for missing descriptions of query and limit parameters beyond what the schema provides.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the verb 'search' and the resource 'indexed repos/documents', distinguishing it from sibling tools (indexing tools). It also mentions the type of search (semantic).
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description implies when to use the tool (after indexing) and narrows usage with optional filtering by source_kind. However, it does not explicitly state when not to use it or provide alternatives, but no other search tools exist as siblings.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
TDQS
Each tool has a clear and distinct purpose: indexing documents, indexing repos, and searching. There is no overlap or ambiguity.
Tool names follow a consistent snake_case pattern, with two using verb_noun (index_documents, index_repo) and one using a simple verb (search). This is mostly consistent with a minor deviation.
Three tools is a reasonable count for a focused indexing and search server. It covers the core functionality without being too sparse or excessive.
The tool surface covers the primary operations: indexing two types of content and searching across them. While there are no delete or update operations, the server appears to be scoped for basic indexing and retrieval, which is adequately covered.
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Connectors
Remote ChromaDB vector database MCP server with streamable HTTP transport
An MCP server that gives your AI access to the source code and docs of all public github repos
MCP server for querying Forkast documentation
Related MCP Servers
- FlicenseNot gradedqualityDmaintenanceLocal MCP server that provides semantic search (RAG) over code repositories, enabling AI clients like Claude and Gemini to access project context without manual re-upload.
- AlicenseAqualityDmaintenanceLocal-first RAG indexing and semantic search MCP server. Enables document retrieval and context-aware queries using local embedding models.314MIT
- AlicenseNot gradedqualityDmaintenanceAn MCP server that indexes documents and serves relevant context to LLMs via Retrieval Augmented Generation (RAG).4837MIT
- AlicenseAqualityFmaintenanceMCP server for semantic code search that indexes your codebase and allows AI editors to search using natural language queries.911253MIT
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
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