ChromaDB MCP server

Integrates ChromaDB vector database capabilities for efficient semantic document search, storage, and retrieval in natural language processing and information retrieval applications.
Back to servers
Setup instructions
Provider
privetin
Release date
Dec 25, 2024
Language
Python
Stats
34 stars

This MCP server implements the Model Context Protocol to provide vector database capabilities through Chroma. It enables semantic document search, metadata filtering, and document management with persistent storage, allowing your applications to store, retrieve, and search documents based on their meaning.

Requirements

  • Python 3.8+
  • Chroma 0.4.0+
  • MCP SDK 0.1.0+

Installation

Install the required dependencies using the UV package manager:

uv venv
uv sync --dev --all-extras

Configuration

Claude Desktop Integration

Add the server configuration to your Claude Desktop config file:

Windows: C:\Users\<username>\AppData\Roaming\Claude\claude_desktop_config.json

MacOS: ~/Library/Application Support/Claude/claude_desktop_config.json

{
  "mcpServers": {
    "chroma": {
      "command": "uv",
      "args": [
        "--directory",
        "C:/MCP/server/community/chroma",
        "run",
        "chroma"
      ]
    }
  }
}

Data Storage

The server stores data persistently in the src/chroma/data directory on all platforms.

Usage

Starting the Server

Start the MCP server with the following command:

uv run chroma

Document Management

The server provides the following document operations:

Creating Documents

create_document({
    "document_id": "ml_paper1",
    "content": "Convolutional neural networks improve image recognition accuracy.",
    "metadata": {
        "year": 2020,
        "field": "computer vision",
        "complexity": "advanced"
    }
})

Required parameters:

  • document_id: Unique identifier for the document
  • content: Text content of the document

Optional parameters:

  • metadata: Key-value pairs for document metadata

Reading Documents

read_document({
    "document_id": "ml_paper1"
})

Required parameters:

  • document_id: Identifier of the document to retrieve

Updating Documents

update_document({
    "document_id": "ml_paper1",
    "content": "Updated content about convolutional neural networks.",
    "metadata": {
        "year": 2021,
        "field": "computer vision",
        "complexity": "intermediate"
    }
})

Required parameters:

  • document_id: Identifier of the document to update
  • content: New text content

Optional parameters:

  • metadata: Updated metadata fields

Deleting Documents

delete_document({
    "document_id": "ml_paper1"
})

Required parameters:

  • document_id: Identifier of the document to delete

Listing Documents

list_documents({
    "limit": 10,
    "offset": 0
})

Optional parameters:

  • limit: Maximum number of documents to return
  • offset: Number of documents to skip

Semantic Search

Find documents that are semantically similar to a query:

search_similar({
    "query": "machine learning models",
    "num_results": 2,
    "metadata_filter": {
        "year": 2020,
        "field": "computer vision"
    }
})

Required parameters:

  • query: Text to match semantically

Optional parameters:

  • num_results: Maximum number of results to return
  • metadata_filter: Filter results by metadata fields
  • content_filter: Additional filter for document content

Error Handling

The server provides detailed error messages for common scenarios:

  • Document already exists [id=X]
  • Document not found [id=X]
  • Invalid input: Missing document_id or content
  • Invalid filter
  • Operation failed: [details]

Interactive Testing

For interactive testing, you can use the MCP Inspector:

npx @modelcontextprotocol/inspector uv --directory C:/MCP/server/community/chroma run chroma

The inspector provides a web interface to test operations, verify functionality, and monitor server logs.

How to install this MCP server

For Claude Code

To add this MCP server to Claude Code, run this command in your terminal:

claude mcp add-json "chroma" '{"command":"uv","args":["--directory","C:/MCP/server/community/chroma","run","chroma"]}'

See the official Claude Code MCP documentation for more details.

For Cursor

There are two ways to add an MCP server to Cursor. The most common way is to add the server globally in the ~/.cursor/mcp.json file so that it is available in all of your projects.

If you only need the server in a single project, you can add it to the project instead by creating or adding it to the .cursor/mcp.json file.

Adding an MCP server to Cursor globally

To add a global MCP server go to Cursor Settings > Tools & Integrations and click "New MCP Server".

When you click that button the ~/.cursor/mcp.json file will be opened and you can add your server like this:

{
    "mcpServers": {
        "chroma": {
            "command": "uv",
            "args": [
                "--directory",
                "C:/MCP/server/community/chroma",
                "run",
                "chroma"
            ]
        }
    }
}

Adding an MCP server to a project

To add an MCP server to a project you can create a new .cursor/mcp.json file or add it to the existing one. This will look exactly the same as the global MCP server example above.

How to use the MCP server

Once the server is installed, you might need to head back to Settings > MCP and click the refresh button.

The Cursor agent will then be able to see the available tools the added MCP server has available and will call them when it needs to.

You can also explicitly ask the agent to use the tool by mentioning the tool name and describing what the function does.

For Claude Desktop

To add this MCP server to Claude Desktop:

1. Find your configuration file:

  • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
  • Windows: %APPDATA%\Claude\claude_desktop_config.json
  • Linux: ~/.config/Claude/claude_desktop_config.json

2. Add this to your configuration file:

{
    "mcpServers": {
        "chroma": {
            "command": "uv",
            "args": [
                "--directory",
                "C:/MCP/server/community/chroma",
                "run",
                "chroma"
            ]
        }
    }
}

3. Restart Claude Desktop for the changes to take effect

Want to 10x your AI skills?

Get a free account and learn to code + market your apps using AI (with or without vibes!).

Nah, maybe later