phanithlim/chroma-mcp-server
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.
server.py
Server logic for FastMCP
model.py
Response models for FastMCP
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