chroma-mcp-server

phanithlim/chroma-mcp-server

3.3

If you are the rightful owner of chroma-mcp-server and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to henry@mcphub.com.

The Chroma MCP Server is a FastAPI application designed to serve as a server inspector for ChromaDB, providing endpoints to interact with collections and documents.

Tools
  1. server.py

    Server logic for FastMCP

  2. model.py

    Response models for FastMCP

  3. helpers.py

    Helper functions for FastMCP

Chroma MCP Server

Template for a FastAPI application that serves as a server inspector for ChromaDB, providing endpoints to interact with collections and documents.

Prerequisites

Assume that you have ChromaDB in docker or host on any Cloud provider. If you don't have it, you can run it locally using Docker:

docker run -v ./chroma-data:/data -p 8000:8000 chromadb/chroma

And for text embedding, we use nomic-embed-text from Ollama. But can be replaced with any other embedding model from any provider. If you don't have Ollama installed, you can install and pull text embedding model with the following commands:

ollama pull nomic-embed-text

Installation

Install UV package manager:

curl -LsSf https://astral.sh/uv/install.sh | sh

or pipx

pip install uv

Install Dependencies

uv sync

Usage

Run MCP Server Inspector:

make mcp-dev

Run the FastAPI application:

make dev

Project Structure

ā”œā”€ā”€ app.py            # FastAPI application entry point
ā”œā”€ā”€ Dockerfile        # Containerization support
ā”œā”€ā”€ pyproject.toml    # Project metadata and dependencies
ā”œā”€ā”€ uv.lock           # uv dependency lock file
ā”œā”€ā”€ resource/
│   ā”œā”€ā”€ __init__.py  # Resource contain static files
ā”œā”€ā”€ tools/
│   ā”œā”€ā”€ server.py     # Server logic for FastMCP
│   ā”œā”€ā”€ model.py      # Response models for FastMCP
│   ā”œā”€ā”€ helpers.py    # Helper functions for FastMCP
│   └── __init__.py
└── README.md          # Project documentation

Features

  • get_all_collections: Retrieve all collections from the database.
  • get_collection_info: Get information about a specific collection.
  • get_collection_items: Fetch items from a specific collection.
  • get_collection_count: Count items in a specific collection.
  • query_documents: Query documents across collections with optional filters.

Deployment

Docker

Build the Docker image:

docker build -t mcp-server .

Run the Docker container:

docker run -d -p 8000:8000 mcp-server
  • MCP server url: http://localhost:8000/mcp-server/mcp

Gradio UI

To run the Gradio UI, you can use the following command:

uv run gradio_ui.py