Install via npm:
npm install -g cog-mcp
Add to your opencode.json config file:
{
"mcpServers": {
"cog-mcp": {
"command": "cog-mcp",
"args": ["--path", "/path/to/your/codebase"]
}
}
}
Once configured, you can use semantic code search directly in your AI assistant conversations.
Semantic code search for AI assistants. Powered by Nomic embeddings on Apple Silicon.
git clone https://github.com/vitorcalvi/cog.git
cd cog
# Python engine
cd packages/core && uv sync
# MCP server
cd ../mcp && npm install && npm run build
cd packages/core
uv run cog-index ./your/project
Edit ~/.config/opencode/opencode.json:
{
"mcp": {
"cog": {
"type": "local",
"command": ["node", "/ABSOLUTE/PATH/TO/cog/packages/mcp/dist/index.js"],
"environment": {
"COG_CORE_DIR": "/ABSOLUTE/PATH/TO/cog/packages/core",
"COG_DB_PATH": "/ABSOLUTE/PATH/TO/cog/packages/core/cog_memory"
},
"enabled": true
}
}
}
Replace /ABSOLUTE/PATH/TO with your actual path.
> Search my codebase for user authentication
> Analyze the structure of src/api.py
> Find database connection functions
| Tool | Description |
|---|---|
search_code |
Semantic search - finds code by meaning |
analyze_structure |
Extract functions and classes from a file |
generate_embedding |
Get 768-dim vector for any text |
| Package | Tests | Coverage |
|---|---|---|
| Python Core | 60 | 100% |
| TypeScript MCP | 35 | 98.7% |
Run tests:
cd packages/core
uv run pytest
cd packages/mcp
npm test
MIT © Vitor Calvi
Sign in to leave a comment.