能力标签
🔌
MCP工具

代码搜索工具

基于 Python · 让 AI 助手直接操作你的系统与工具
英文名:coco-search
⭐ 32 Stars 🍴 6 Forks 💻 Python 📄 MIT 🏷 AI 8.0分
8.0AI 综合评分
代码搜索语义搜索PostgreSQL
✦ AI Skill Hub 推荐

经 AI Skill Hub 精选评估,代码搜索工具 获评「强烈推荐」。这款MCP工具在功能完整性、社区活跃度和易用性方面表现出色,AI 评分 8.0 分,适合有一定技术背景的用户使用。

📚 深度解析

代码搜索工具 是一款基于 MCP(Model Context Protocol)标准协议的 AI 工具扩展。MCP 协议由 Anthropic 开发并开源,旨在建立 AI 模型与外部工具之间的标准化通信接口,目前已被 Claude Desktop、Claude Code、Cursor 等主流 AI 工具采纳。

通过安装 代码搜索工具,你的 AI 助手将获得额外的工具调用能力,可以用自然语言直接操控该工具的功能,无需学习复杂的命令行语法。MCP 工具的核心价值在于"一次配置,永久增强"——配置完成后,每次与 AI 对话时都可以无缝调用这些工具。

在技术实现上,MCP 工具通过标准的 JSON-RPC 协议与 AI 客户端通信,工具的功能以"工具列表"的形式暴露给 AI 模型,AI 可以按需调用。代码搜索工具 提供了结构化的工具调用接口,使 AI 模型能够精确地理解和使用每个功能点,显著降低 AI 在工具使用上的错误率。

与传统的 API 集成相比,MCP 工具的优势在于无需编写代码——用户只需在配置文件中添加几行 JSON,即可让 AI 获得全新能力。AI Skill Hub 将 代码搜索工具 评为 AI 评分 8.0 分,属于同类工具中的优质选择。

📋 工具概览

本地优先的混合语义代码搜索工具,支持PostgreSQL索引

代码搜索工具 是一款遵循 MCP(Model Context Protocol)标准协议的 AI 工具扩展。通过 MCP 协议,它可以让 Claude、Cursor 等主流 AI 客户端直接访问和操作外部工具、数据源和服务,实现 AI 能力的无缝扩展。无论是文件操作、数据库查询还是 API 调用,都可以通过自然语言在 AI 对话中直接触发,极大提升生产效率。

GitHub Stars
⭐ 32
开发语言
Python
支持平台
Windows / macOS / Linux
维护状态
轻量级项目,按需更新
开源协议
MIT
AI 综合评分
8.0 分
工具类型
MCP工具
Forks
6

📖 中文文档

以下内容由 AI Skill Hub 根据项目信息自动整理,如需查看完整原始文档请访问底部「原始来源」。

本地优先的混合语义代码搜索工具,支持PostgreSQL索引

代码搜索工具 是一款遵循 MCP(Model Context Protocol)标准协议的 AI 工具扩展。通过 MCP 协议,它可以让 Claude、Cursor 等主流 AI 客户端直接访问和操作外部工具、数据源和服务,实现 AI 能力的无缝扩展。无论是文件操作、数据库查询还是 API 调用,都可以通过自然语言在 AI 对话中直接触发,极大提升生产效率。

📌 核心特色
  • 通过标准 MCP 协议与 Claude、Cursor 等主流 AI 客户端深度集成
  • 提供结构化工具调用接口,显著降低 AI 集成复杂度
  • 支持 Claude Desktop 和 Claude Code 无缝接入,开箱即用
  • 可与其他 MCP 工具组合叠加,构建完整 AI 工作站
  • 轻量无侵入设计,不影响现有系统架构
🎯 主要使用场景
  • 在 Claude Desktop 对话中直接调用本地工具,实现 AI 与系统的深度联动
  • 通过自然语言驱动复杂的多步骤自动化任务,代替繁琐手动操作
  • 将多个 MCP 工具组合使用,构建个人专属 AI 工作站
以下安装命令基于项目开发语言和类型自动生成,实际以官方 README 为准。
安装命令
# 方式一:通过 Claude Code CLI 一键安装
claude skill install https://github.com/VioletCranberry/coco-search

# 方式二:手动配置 claude_desktop_config.json
{
  "mcpServers": {
    "------": {
      "command": "npx",
      "args": ["-y", "coco-search"]
    }
  }
}

# 配置文件位置
# macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
# Windows: %APPDATA%/Claude/claude_desktop_config.json
📋 安装步骤说明
  1. 确认已安装 Node.js(v18 或以上版本)
  2. 打开 Claude Desktop 或 Claude Code 的 MCP 配置文件
  3. 按「交给 Agent 安装 → Claude Desktop」标签中的 JSON 配置填入 mcpServers 字段
  4. 保存配置文件并重启 Claude 客户端
  5. 重启后,在对话中即可使用本工具
以下用法示例由 AI Skill Hub 整理,涵盖最常见的使用场景。
常用命令 / 代码示例
# 安装后在 Claude 对话中直接使用
# 示例:
用户: 请帮我用 代码搜索工具 执行以下任务...
Claude: [自动调用 代码搜索工具 MCP 工具处理请求]

# 查看可用工具列表
# 在 Claude 中输入:"列出所有可用的 MCP 工具"
以下配置示例基于典型使用场景生成,具体参数请参照官方文档调整。
配置示例
// claude_desktop_config.json 配置示例
{
  "mcpServers": {
    "______": {
      "command": "npx",
      "args": ["-y", "coco-search"],
      "env": {
        // "API_KEY": "your-api-key-here"
      }
    }
  }
}

// 保存后重启 Claude Desktop 生效
📑 README 深度解析 真实文档 完整度 84/100 查看 GitHub 原文 →
以下内容由系统直接从 GitHub README 解析整理,保留代码块、表格与列表结构。

简介

<p align="center"> <img src="./docs/banner-terminal.svg" alt="Coco[-S]earch — Local-first hybrid semantic code search" width="960"> </p>

<p align="center"> <a href="https://pypi.org/project/cocosearch/"><img src="https://img.shields.io/pypi/v/cocosearch?color=blue&logo=pypi&logoColor=white" alt="PyPI"></a> <a href="https://www.python.org/"><img src="https://img.shields.io/badge/python-%3E%3D3.11-blue?logo=python&logoColor=white" alt="Python >= 3.11"></a> <a href="LICENSE"><img src="https://img.shields.io/badge/license-MIT-green" alt="License: MIT"></a> <a href="https://github.com/astral-sh/ruff"><img src="https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json" alt="Ruff"></a> <a href="https://github.com/astral-sh/uv"><img src="https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/uv/main/assets/badge/v0.json" alt="uv"></a> <a href="https://docs.pytest.org/"><img src="https://img.shields.io/badge/tests-pytest-blue?logo=pytest&logoColor=white" alt="pytest"></a> <a href="https://modelcontextprotocol.io/"><img src="https://img.shields.io/badge/MCP-compatible-8A2BE2?logo=anthropic&logoColor=white" alt="MCP"></a> </p>

<p align="center"> <a href="#supported-languages"><img src="https://img.shields.io/badge/Bash-4EAA25?logo=gnubash&logoColor=white" alt="Bash"></a> <a href="#supported-languages"><img src="https://img.shields.io/badge/C-A8B9CC?logo=c&logoColor=white" alt="C"></a> <a href="#supported-languages"><img src="https://img.shields.io/badge/C%2B%2B-00599C?logo=cplusplus&logoColor=white" alt="C++"></a> <a href="#supported-languages"><img src="https://img.shields.io/badge/C%23-512BD4?logo=csharp&logoColor=white" alt="C#"></a> <a href="#supported-languages"><img src="https://img.shields.io/badge/CSS-1572B6?logo=css3&logoColor=white" alt="CSS"></a> <a href="#supported-languages"><img src="https://img.shields.io/badge/Dockerfile-2496ED?logo=docker&logoColor=white" alt="Dockerfile"></a> <a href="#supported-languages"><img src="https://img.shields.io/badge/DTD-7A7A7A" alt="DTD"></a> <a href="#supported-languages"><img src="https://img.shields.io/badge/Fortran-734F96?logo=fortran&logoColor=white" alt="Fortran"></a> <a href="#supported-languages"><img src="https://img.shields.io/badge/Go-00ADD8?logo=go&logoColor=white" alt="Go"></a> <a href="#supported-languages"><img src="https://img.shields.io/badge/Groovy-4298B8?logo=apachegroovy&logoColor=white" alt="Groovy"></a> <a href="#supported-languages"><img src="https://img.shields.io/badge/HCL-844FBA?logo=terraform&logoColor=white" alt="HCL"></a> <a href="#supported-languages"><img src="https://img.shields.io/badge/HTML-E34F26?logo=html5&logoColor=white" alt="HTML"></a> <a href="#supported-languages"><img src="https://img.shields.io/badge/Java-ED8B00?logo=openjdk&logoColor=white" alt="Java"></a> <a href="#supported-languages"><img src="https://img.shields.io/badge/JavaScript-F7DF1E?logo=javascript&logoColor=black" alt="JavaScript"></a> <a href="#supported-languages"><img src="https://img.shields.io/badge/JSON-000000?logo=json&logoColor=white" alt="JSON"></a> <a href="#supported-languages"><img src="https://img.shields.io/badge/Kotlin-7F52FF?logo=kotlin&logoColor=white" alt="Kotlin"></a> <a href="#supported-languages"><img src="https://img.shields.io/badge/Markdown-000000?logo=markdown&logoColor=white" alt="Markdown"></a> <a href="#supported-languages"><img src="https://img.shields.io/badge/Pascal-0364B8" alt="Pascal"></a> <a href="#supported-languages"><img src="https://img.shields.io/badge/PHP-777BB4?logo=php&logoColor=white" alt="PHP"></a> <a href="#supported-languages"><img src="https://img.shields.io/badge/Python-3776AB?logo=python&logoColor=white" alt="Python"></a> <a href="#supported-languages"><img src="https://img.shields.io/badge/R-276DC3?logo=r&logoColor=white" alt="R"></a> <a href="#supported-languages"><img src="https://img.shields.io/badge/Ruby-CC342D?logo=ruby&logoColor=white" alt="Ruby"></a> <a href="#supported-languages"><img src="https://img.shields.io/badge/Rust-000000?logo=rust&logoColor=white" alt="Rust"></a> <a href="#supported-languages"><img src="https://img.shields.io/badge/Scala-DC322F?logo=scala&logoColor=white" alt="Scala"></a> <a href="#supported-languages"><img src="https://img.shields.io/badge/Solidity-363636?logo=solidity&logoColor=white" alt="Solidity"></a> <a href="#supported-languages"><img src="https://img.shields.io/badge/SQL-336791" alt="SQL"></a> <a href="#supported-languages"><img src="https://img.shields.io/badge/Swift-F05138?logo=swift&logoColor=white" alt="Swift"></a> <a href="#supported-languages"><img src="https://img.shields.io/badge/TOML-9C4121?logo=toml&logoColor=white" alt="TOML"></a> <a href="#supported-languages"><img src="https://img.shields.io/badge/TypeScript-3178C6?logo=typescript&logoColor=white" alt="TypeScript"></a> <a href="#supported-languages"><img src="https://img.shields.io/badge/XML-0060AC" alt="XML"></a> <a href="#supported-languages"><img src="https://img.shields.io/badge/YAML-CB171E?logo=yaml&logoColor=white" alt="YAML"></a> </p>

<p align="center"> <a href="#supported-grammars"><img src="https://img.shields.io/badge/ArgoCD-EF7B4D?logo=argo&logoColor=white" alt="ArgoCD"></a> <a href="#supported-grammars"><img src="https://img.shields.io/badge/Docker_Compose-2496ED?logo=docker&logoColor=white" alt="Docker Compose"></a> <a href="#supported-grammars"><img src="https://img.shields.io/badge/GitHub_Actions-2088FF?logo=githubactions&logoColor=white" alt="GitHub Actions"></a> <a href="#supported-grammars"><img src="https://img.shields.io/badge/GitLab_CI-FC6D26?logo=gitlab&logoColor=white" alt="GitLab CI"></a> <a href="#supported-grammars"><img src="https://img.shields.io/badge/Helm_Chart-0F1689?logo=helm&logoColor=white" alt="Helm Chart"></a> <a href="#supported-grammars"><img src="https://img.shields.io/badge/Helm_Template-0F1689?logo=helm&logoColor=white" alt="Helm Template"></a> <a href="#supported-grammars"><img src="https://img.shields.io/badge/Helm_Values-0F1689?logo=helm&logoColor=white" alt="Helm Values"></a> <a href="#supported-grammars"><img src="https://img.shields.io/badge/Kubernetes-326CE5?logo=kubernetes&logoColor=white" alt="Kubernetes"></a> <a href="#supported-grammars"><img src="https://img.shields.io/badge/Terraform-844FBA?logo=terraform&logoColor=white" alt="Terraform"></a> </p>

<p align="center"><em>Give your AI assistant a search engine instead of a thousand grep calls — 32 languages, 9 grammars, dependency graphs, cross-repo search, fewer tokens, less hallucination.</em></p>

Typical code RAG splits files into chunks that break across function and class boundaries, losing the structure that makes code meaningful. CocoSearch preserves it — CocoIndex and Tree-sitter provide syntax-aware chunking that keeps functions, classes, and config blocks intact; search results expand to enclosing scope boundaries via Tree-sitter AST; grammar handlers split infrastructure configs at domain-aware boundaries (Terraform resources, CI/CD jobs, Compose services); and a dependency graph maps how files connect across code, config, and documentation.
That structure is also what cuts agent round-trips and context burn: because each hit comes back as a complete, scope-expanded unit, the agent doesn't grep → read file → grep again → read again to rebuild a function that got sliced mid-body. One call returns ranked, symbol-aware results plus their dependency edges — so the loop converges in fewer steps and less wasted context. It's not about beating grep on raw latency (grep is milliseconds); it's fewer steps and capabilities grep doesn't have — transitive impact across resolved imports.

Coco[-S]earch is a local-first hybrid semantic code search tool. It combines vector similarity and keyword matching (via RRF fusion) to find code by meaning, not just text. Powered by CocoIndex for indexing, Tree-sitter for syntax-aware chunking and symbol extraction, PostgreSQL with pgvector for storage, and Ollama for local embeddings by default. Optional remote embedding providers (OpenAI, OpenRouter) available for teams that prefer managed infrastructure — your code still never leaves your machine, only chunk text is sent for embedding.

Available as a WEB dashboard, CLI, MCP server, or interactive REPL. Incremental indexing, .gitignore-aware. Supports 32 languages with symbol-level filtering for 15+, plus domain-specific grammars for structured config files. Since 0.1.22: dependency graph extraction with forward trees (deps tree), reverse impact analysis (deps impact), and dependency-enriched search — for Python, JavaScript/TypeScript, Go, Docker Compose, GitHub Actions, Terraform, and Helm.

Features

  • 🔍 Hybrid search -- combines semantic similarity (pgvector cosine) and keyword matching (PostgreSQL tsvector) via Reciprocal Rank Fusion. Auto-detects code identifiers (camelCase, snake_case, PascalCase) and enables hybrid mode automatically — or force it with --hybrid. Definition symbols (functions, classes) get a 2x score boost. RRF constant k=60.
  • 🧠 Query-rewrite controller (optional, default-off) -- an LLM expands vague natural-language queries into better search terms before retrieval (e.g. "how does login work""authentication session credential login user token"). Disabled by default — when off, search is byte-for-byte identical and no generative model runs. Configured like the embedding provider (ollama/openai/openrouter), defaults to local Ollama (qwen2.5:3b). Never breaks search: falls back to the original query on any error, timeout, or disabled state. Opt out per call with --no-rewrite (CLI/analyze) or rewrite_query=False (MCP). See Query Rewrite.
  • 🏷️ Symbol filtering -- narrow results to function, class, method, or interface with --symbol-type; match symbol names with glob patterns (User*, *Handler) via --symbol-name. Supported for 15 languages with Tree-sitter .scm queries. Filters apply before RRF fusion for better ranking quality.
  • 📐 Context expansion -- results automatically expand to enclosing function/class boundaries using Tree-sitter AST traversal, so you see complete units of code instead of arbitrary line ranges. Supports Python, JavaScript, TypeScript, Go, Rust, Scala, HCL/Terraform, and Dockerfile. Hard-capped at 50 lines per result, centered on the match. Disable with --no-smart or set explicit line counts with -B/-A/-C.
  • 🔗 Dependency graphs -- file-level dependency extraction with 11 pluggable extractors (Python, JS/TS, Go, Terraform, Helm, GitHub Actions, GitLab CI, Docker Compose, ArgoCD, Markdown) and 5 module resolvers. Forward trees (deps tree), reverse impact analysis (deps impact), batch queries, and dependency-enriched search results (include_deps). Incremental extraction with SHA-256 tracking. Add extractors for new languages by copying a template.
  • 🌐 Cross-index search -- search across multiple codebases in a single query via --indexes or linkedIndexes config. Query embedding computed once, parallel per-index search, results merged by score. Linked indexes auto-expand single-index searches — missing indexes are skipped gracefully.
  • 📝 Grammar handlers -- 9 domain-specific handlers (ArgoCD, GitHub Actions, GitLab CI, Docker Compose, Helm Chart/Template/Values, Kubernetes, Terraform) that chunk infrastructure configs at meaningful boundaries — jobs/steps, resources, services — instead of splitting YAML on whitespace. Autodiscovered, extensible via template.
  • 🔄 Incremental indexing -- SHA-256 content hashing tracks file changes so only new or modified files are re-embedded on subsequent runs. Each file commits atomically. .gitignore-aware by default.
  • 🖥️ Web dashboard -- browser UI with multi-project management, code search with filters, index lifecycle (create/reindex/delete), dependency graph visualization, syntax-highlighted file viewer, open-in-editor, real-time log streaming, and observability charts. Light and dark themes.
  • Query caching -- two-level LRU cache (500 entries, 24h TTL): exact-match via SHA-256 hash of all search parameters, plus semantic fallback that finds paraphrased queries by cosine similarity (threshold 0.92, scanning last 50 entries). Cache auto-invalidates on reindex. Bypass with --no-cache.
  • 🩺 Parse health tracking -- tracks per-file parse status across four categories: ok, partial (Tree-sitter produced a tree with ERROR nodes), error (parse failure), and no_grammar. Detects index staleness by comparing the indexed commit hash and branch against your current HEAD — the dashboard and CLI show warnings when the index drifts behind. View with cocosearch stats --pretty.
  • 🔬 Pipeline analysis -- cocosearch analyze runs the search pipeline with full diagnostics: see identifier detection, mode selection, RRF fusion breakdown, definition boost effects, and per-stage timings. Available as CLI and MCP tool. Cross-index analysis with per-index breakdowns.
  • 🤖 Workflow skills -- reusable Claude SKILLS that drive structured workflows on top of the MCP tools: onboarding, exploration, debugging, dependency analysis, refactoring, feature scaffolding, smart commits, and PR/MR review. The review skill goes beyond reading the diff — it adds blast-radius and dependency analysis, and can optionally push findings back as inline GitHub/GitLab comments on the exact lines that need changes (interactive, comment-only, always previews before posting). See Skills.
  • 🔒 Privacy-first -- runs entirely on your machine by default — Ollama generates embeddings locally, PostgreSQL stores vectors locally, no telemetry. Optional remote embedding providers (OpenAI, OpenRouter) send only chunk text for embedding; all indexing, storage, and search remain local. Your code never leaves your machine.

Docker volumes are bind-mounted to ./docker_data/ inside the repository,

Running in Docker

Run CocoSearch as a centralized service — the host CLI forwards commands transparently over HTTP. Both the app and ollama services are opt-in via profiles; docker compose up -d starts only PostgreSQL.

```bash

MCP with Docker

The Docker container runs an SSE-based MCP server. Connect your AI assistant directly to it instead of spawning a local process:

Claude Code:

claude mcp add --scope user cocosearch --url http://localhost:3000/sse

Claude Desktop (claude_desktop_config.json):

{
  "mcpServers": {
    "cocosearch": {
      "url": "http://localhost:3000/sse"
    }
  }
}

OpenCode (opencode.json):

{
  "mcp": {
    "cocosearch": {
      "type": "remote",
      "url": "http://localhost:3000/sse",
      "enabled": true
    }
  }
}
Note: Replace 3000 with your COCOSEARCH_MCP_PORT if customized.

Quick Start

  • Services (local embeddings with Ollama — default):

```bash

2. Configure your embedding provider and API key:

export COCOSEARCH_EMBEDDING_PROVIDER=openai # or openrouter export COCOSEARCH_EMBEDDING_API_KEY=sk-...

Generate cocosearch.yaml config and optionally add

All skills + MCP server configured automatically


> **Tip:** If using a remote embedding provider (OpenAI, OpenRouter), export the environment variables in your shell profile (`~/.zshrc`, `~/.bashrc`) before starting Claude Code — the plugin's MCP server inherits them from your shell. Alternatively, use manual MCP registration with `--env` flags (see [MCP Configuration](./docs/mcp-configuration.md#remote-embedding-providers)).

**Option B — Manual MCP registration:**
bash claude mcp add --scope user cocosearch -- uvx cocosearch mcp --project-from-cwd

> **Note:** The MCP server automatically opens a web dashboard in your browser on a random port. Set `COCOSEARCH_DASHBOARD_PORT=8080` to pin it to a fixed port, or `COCOSEARCH_NO_DASHBOARD=1` to disable it.

**Option C — OpenCode:**

Add to `~/.config/opencode/opencode.json` (global) or `opencode.json` (project):
json { "$schema": "https://opencode.ai/config.json", "mcp": { "cocosearch": { "type": "local", "command": ["uvx", "--from", "cocosearch", "cocosearch", "mcp", "--project-from-cwd"], "enabled": true } } } ```

Note: OpenCode uses AGENTS.md for project instructions (equivalent to CLAUDE.md). Run uvx cocosearch init to generate it, or create a symlink: ln -s CLAUDE.md AGENTS.md. Skills are compatible — see Skills README for installation.

Configuration

Run cocosearch init to generate a starter config file and optionally set up CLAUDE.md tool routing for Claude Code integration:

uv run cocosearch init

init also offers to install an optional nudge hook for Claude Code — a non-blocking PreToolUse hook that reminds the agent to prefer search_code over raw Grep/Glob/grep/find when CocoSearch is running, and stays completely silent when it isn't (so your normal grep fallback is never blocked). It's an opt-in prompt; skip it with --no-claude-hook.

Or create cocosearch.yaml in your project root manually to customize indexing:

```yaml indexing: # See also https://cocoindex.io/docs/ops/functions#supported-languages include_patterns: - ".py" - ".js" - ".ts" - ".go" - "*.rs" exclude_patterns: - "_test.go" - ".min.js" chunk_size: 1000 # bytes chunk_overlap: 300 # bytes

embedding: provider: ollama # ollama (default), openai, openrouter model: nomic-embed-text # default depends on provider # baseUrl: http://localhost:8080 # custom OpenAI-compatible endpoint

Optional query-rewrite controller (default: disabled)

controller: enabled: false # when false, search is byte-for-byte unchanged provider: ollama # ollama (default), openai, openrouter model: qwen2.5:3b # default depends on provider # baseUrl: http://localhost:11434 # timeout: 5.0 # seconds; on timeout, falls back to the original query

Optional file logging (default: disabled)

logging: file: false # true -> ~/.cocosearch/logs/cocosearch.log (10MB rotation) ```

Verify config

uv run cocosearch config check


| Provider | Default Model | API Key Required |
|----------|--------------|-----------------|
| `ollama` | `nomic-embed-text` | No (local) |
| `openai` | `text-embedding-3-small` | Yes (optional with `baseUrl`) |
| `openrouter` | `openai/text-embedding-3-small` | Yes (optional with `baseUrl`) |

Switching providers on an existing index requires `--fresh` to reindex with the new embedding model.

#### Custom Endpoints

Use `embedding.baseUrl` (or `COCOSEARCH_EMBEDDING_BASE_URL`) to point any provider at a local OpenAI-compatible server such as [Infinity](https://github.com/michaelfeil/infinity), [text-embeddings-inference](https://github.com/huggingface/text-embeddings-inference), or [vLLM](https://github.com/vllm-project/vllm):
yaml embedding: provider: openai model: BAAI/bge-small-en-v1.5 baseUrl: http://localhost:8080 ```

When baseUrl is set, the API key is not required. For the ollama provider, baseUrl overrides COCOSEARCH_OLLAMA_URL.

Query Rewrite (optional)

CocoSearch retrieval is already adaptive without any LLM. Per query, it auto-selects hybrid vs. vector-only search from code-identifier patterns, sizes prefetch dynamically, applies a definition boost, caches at two levels (exact + semantic), and auto-expands to linked indexes — all deterministic, local, and fast. The query-rewrite controller below is an optional layer on top for vague natural-language queries (mainly the CLI/REPL, where there's no LLM in front). It is not required and not a fix for anything. When you use CocoSearch via MCP, the calling agent already reformulates queries, so leave the controller off or opt out per call.

When enabled, an LLM rewrites/expands a natural-language query into better search terms before retrieval:

"how does login work"  →  "authentication session credential login user token"

It is disabled by default — when off, search behaves exactly as before and no generative model is ever called. On any error, timeout, or empty output it falls back to the original query, so search never breaks. Configure it exactly like the embedding provider:

```yaml

Point the host CLI at the running server (no local Postgres/Ollama needed).

Interfaces

Search your code four ways — pick what fits your workflow:

InterfaceBest forHow to start
**CLI**One-off searches, scripting, CIcocosearch search "auth flow"
**Interactive REPL**Exploratory sessions — tweak filters, switch indexes, iterate on queries without restartingcocosearch search --interactive
**Web Dashboard**Visual search + index management in the browser — multi-project discovery, filters, syntax-highlighted results, charts, open-in-editor, retro terminal themecocosearch dashboard
**MCP Server**AI assistant integration ([Claude Code](https://claude.com/product/claude-code), [Claude Desktop](https://claude.com/download), [OpenCode](https://opencode.ai/))cocosearch mcp --project-from-cwd

Analyze search pipeline (debug why results rank the way they do)

uvx cocosearch analyze "getUserById"

Components

  • Embedding Provider -- generates vector embeddings. Default: Ollama (nomic-embed-text) running locally. Also supports OpenAI and OpenRouter for remote embeddings.
  • PostgreSQL + pgvector -- stores code chunks and their vector embeddings for similarity search.
  • CocoSearch -- CLI and MCP server that coordinates indexing and search.

Troubleshooting

Dashboard shows "Indexing" but CLI shows "Indexed"

The web dashboard and CLI now share a status sync mechanism: when the dashboard detects a live indexing thread, it corrects the database status so both interfaces agree. If you still see a discrepancy, check whether indexing is genuinely running (CPU usage, docker stats for Ollama activity).

Index appears stuck in "Indexing" status

After 1 hour with no progress updates, the status auto-recovers to "Indexed". You can also run cocosearch index . again to force a fresh index, which will reset the status.

High CPU after indexing appears complete

Ollama may still be processing embeddings in its queue. Check with docker stats or ps aux | grep ollama. CocoIndex may also perform background cleanup after the main indexing loop finishes.

🎯 aiskill88 AI 点评 A 级 2026-06-04

高质量的代码搜索工具,支持混合语义搜索

⚡ 核心功能

👥 适合人群

Claude Desktop / Claude Code 用户AI 工具开发者需要扩展 AI 能力的专业人士自动化工程师

🎯 使用场景

  • 在 Claude Desktop 对话中直接调用本地工具,实现 AI 与系统的深度联动
  • 通过自然语言驱动复杂的多步骤自动化任务,代替繁琐手动操作
  • 将多个 MCP 工具组合使用,构建个人专属 AI 工作站

⚖️ 优点与不足

✅ 优点
  • +MIT 协议,可免费商用
  • +标准化 MCP 协议,生态互联性强
  • +与 Claude 官方生态无缝对接
  • +即插即用,配置简单快捷
⚠️ 不足
  • 依赖 Claude 客户端,非 Claude 用户无法使用
  • MCP 协议仍在持续演进,接口可能变更
  • 需要一定的配置步骤
⚠️ 使用须知

AI Skill Hub 为第三方内容聚合平台,本页面信息基于公开数据整理,不对工具功能和质量作任何法律背书。

建议在沙箱或测试环境中充分验证后,再部署至生产环境,并做好必要的安全评估。

📄 License 说明

✅ MIT 协议 — 最宽松的开源协议之一,可自由商用、修改、分发,仅需保留版权声明。

🔗 相关工具推荐

🧩 你可能还需要
基于当前 Skill 的能力图谱,自动补全的工具组合

❓ 常见问题 FAQ

参考README.md文档
💡 AI Skill Hub 点评

AI Skill Hub 点评:代码搜索工具 的核心功能完整,质量优秀。对于Claude Desktop / Claude Code 用户来说,这是一个值得纳入个人工具库的选择。建议先在非生产环境试用,再逐步推广。

⬇️ 获取与下载
⬇ 下载源码 ZIP

✅ MIT 协议 · 可免费商用 · 直接从 aiskill88 服务器下载,无需跳转 GitHub

📚 深入学习 代码搜索工具
查看分步骤安装教程和完整使用指南,快速上手这款工具
🌐 原始信息
原始名称 coco-search
Topics 代码搜索语义搜索PostgreSQL
GitHub https://github.com/VioletCranberry/coco-search
License MIT
语言 Python
🔗 原始来源
🐙 GitHub 仓库  https://github.com/VioletCranberry/coco-search

收录时间:2026-06-04 · 更新时间:2026-06-04 · License:MIT · AI Skill Hub 不对第三方内容的准确性作法律背书。