MCP ExplorerExplorer

Chroma Mcp Server

@phanithlimon 22 days ago
1 MIT
FreeCommunity
AI Systems
Template for a FastAPI application that serves as a server inspector for ChromaDB, providing endpoints to interact with collections and documents.

Overview

What is Chroma Mcp Server

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

Use cases

Use cases include developing applications that require database interactions, performing data analysis, and building data-driven solutions that leverage ChromaDB for efficient document handling.

How to use

To use Chroma MCP Server, ensure you have ChromaDB running in Docker or on a cloud provider. Install the necessary dependencies and run the server using the provided commands in the README.

Key features

Key features include retrieving all collections, getting specific collection information, fetching items from collections, counting items in collections, and querying documents with optional filters.

Where to use

Chroma MCP Server can be used in data management, application development, and any scenario requiring interaction with ChromaDB for document and collection management.

Content

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

Tools

No tools

Comments