Skip to main content
Glama
Chroma MCP Server

Chroma MCP Server

Official
by chroma-core

Chroma MCP 服务器

铁匠徽章

模型上下文协议 (MCP)是一种开放协议,旨在实现 LLM 应用程序与外部数据源或工具之间的轻松集成,提供标准化框架,无缝地为 LLM 提供所需的上下文。

该服务器提供由 Chroma 提供支持的数据检索功能,使 AI 模型能够基于生成的数据和用户输入创建集合,并使用矢量搜索、全文搜索、元数据过滤等检索该数据。

特征

  • 灵活的客户类型

    • 用于测试和开发的临时(内存中)

    • 基于文件的持久存储

    • 用于自托管 Chroma 实例的 HTTP 客户端

    • 用于 Chroma Cloud 集成的云客户端(自动连接到 api.trychroma.com)

  • 收藏管理

    • 创建、修改和删除集合

    • 列出所有支持分页的集合

    • 获取收集信息和统计数据

    • 配置 HNSW 参数以优化矢量搜索

    • 创建集合时选择嵌入函数

  • 文档操作

    • 添加具有可选元数据和自定义 ID 的文档

    • 使用语义搜索查询文档

    • 使用元数据和文档内容进行高级过滤

    • 通过 ID 或过滤器检索文档

    • 全文搜索功能

支持的工具

  • chroma_list_collections - 列出所有支持分页的集合

  • chroma_create_collection - 使用可选的 HNSW 配置创建新集合

  • chroma_peek_collection - 查看集合中的文档样本

  • chroma_get_collection_info - 获取有关集合的详细信息

  • chroma_get_collection_count - 获取集合中的文档数量

  • chroma_modify_collection - 更新集合的名称或元数据

  • chroma_delete_collection - 删除收藏集

  • chroma_add_documents - 添加带有可选元数据和自定义 ID 的文档

  • chroma_query_documents - 使用带有高级过滤功能的语义搜索查询文档

  • chroma_get_documents - 通过 ID 或分页过滤器检索文档

  • chroma_update_documents - 更新现有文档的内容、元数据或嵌入

  • chroma_delete_documents - 从集合中删除特定文档

嵌入函数

Chroma MCP 支持多种嵌入功能: default 、 cohere 、 openai 、 jina 、 voyageai和roboflow 。

嵌入函数利用 Chroma 的集合配置,该配置会持久化集合中选定的嵌入函数以供检索。使用该集合配置创建集合后,在以后的查询和插入操作中,将使用相同的嵌入函数,而无需再次指定嵌入函数。嵌入函数持久化功能是在 Chroma v1.0.0 版本中添加的,因此如果您使用低于 0.6.3 的版本创建集合,则不支持此功能。

访问使用外部 API 的嵌入函数时,请务必添加格式正确的 API 密钥环境变量,该环境变量可在嵌入函数环境变量中找到

Related MCP server: PDF Knowledgebase MCP Server

与 Claude Desktop 一起使用

  1. 要添加临时客户端,请将以下内容添加到您的claude_desktop_config.json文件中:

"chroma": {
    "command": "uvx",
    "args": [
        "chroma-mcp"
    ]
}
  1. 要添加持久客户端,请将以下内容添加到claude_desktop_config.json文件中:

"chroma": {
    "command": "uvx",
    "args": [
        "chroma-mcp",
        "--client-type",
        "persistent",
        "--data-dir",
        "/full/path/to/your/data/directory"
    ]
}

这将创建一个使用指定数据目录的持久客户端。

  1. 要连接到 Chroma Cloud,请将以下内容添加到您的claude_desktop_config.json文件中:

"chroma": {
    "command": "uvx",
    "args": [
        "chroma-mcp",
        "--client-type",
        "cloud",
        "--tenant",
        "your-tenant-id",
        "--database",
        "your-database-name",
        "--api-key",
        "your-api-key"
    ]
}

这将创建一个使用 SSL 自动连接到 api.trychroma.com 的云客户端。

**注意:**在本地设备上,在参数中添加 API 密钥是可以的,但为了安全起见,您还可以使用args列表中的--dotenv-path参数为环境配置文件指定自定义路径,例如: "args": ["chroma-mcp", "--dotenv-path", "/custom/path/.env"] 。

  1. 要连接到[您自己的云提供商上的自托管 Chroma 实例]( https://docs.trychroma.com/production/deployment ),请将以下内容添加到您的claude_desktop_config.json文件中:

"chroma": {
    "command": "uvx",
    "args": [
      "chroma-mcp", 
      "--client-type", 
      "http", 
      "--host", 
      "your-host", 
      "--port", 
      "your-port", 
      "--custom-auth-credentials",
      "your-custom-auth-credentials",
      "--ssl",
      "true"
    ]
}

这将创建一个连接到您自托管的 Chroma 实例的 HTTP 客户端。

演示

在Chroma MCP 文档中查找参考用法,例如共享知识库和向上下文窗口添加内存

使用环境变量

您还可以使用环境变量来配置客户端。服务器将自动从--dotenv-path指定路径下的.env文件(默认为工作目录中的.chroma_env文件)或系统环境变量中加载变量。命令行参数的优先级高于环境变量。

# Common variables
export CHROMA_CLIENT_TYPE="http"  # or "cloud", "persistent", "ephemeral"

# For persistent client
export CHROMA_DATA_DIR="/full/path/to/your/data/directory"

# For cloud client (Chroma Cloud)
export CHROMA_TENANT="your-tenant-id"
export CHROMA_DATABASE="your-database-name"
export CHROMA_API_KEY="your-api-key"

# For HTTP client (self-hosted)
export CHROMA_HOST="your-host"
export CHROMA_PORT="your-port"
export CHROMA_CUSTOM_AUTH_CREDENTIALS="your-custom-auth-credentials"
export CHROMA_SSL="true"

# Optional: Specify path to .env file (defaults to .chroma_env)
export CHROMA_DOTENV_PATH="/path/to/your/.env" 

嵌入函数环境变量

使用访问 API 密钥的外部嵌入函数时,请遵循命名约定CHROMA_<>_API_KEY="<key>" 。因此,要设置 Cohere API 密钥,请设置环境变量CHROMA_COHERE_API_KEY="" 。我们建议将其添加到某个 .env 文件中,并使用CHROMA_DOTENV_PATH环境变量或--dotenv-path标志设置该位置以便妥善保管。

Available Tools

13 tools
chroma_add_documentsC

Add documents to a Chroma collection.

Args:
    collection_name: Name of the collection to add documents to
    documents: List of text documents to add
    ids: List of IDs for the documents (required)
    metadatas: Optional list of metadata dictionaries for each document

Inputs: collection_name (required), documents (required), ids (required), metadatas.

chroma_create_collectionB

Create a new Chroma collection with configurable HNSW parameters.

Args:
    collection_name: Name of the collection to create
    embedding_function_name: Name of the embedding function to use. Options: 'default', 'cohere', 'openai', 'jina', 'voyageai', 'ollama', 'roboflow'
    metadata: Optional metadata dict to add to the collection

Inputs: collection_name (required), embedding_function_name, metadata.

chroma_delete_collectionB

Delete a Chroma collection.

Args:
    collection_name: Name of the collection to delete

Inputs: collection_name (required).

chroma_delete_documentsA

Delete documents from a Chroma collection.

Args:
    collection_name: Name of the collection to delete documents from
    ids: List of document IDs to delete

Returns:
    A confirmation message indicating the number of documents deleted.

Raises:
    ValueError: If 'ids' is empty
    Exception: If the collection does not exist or if the delete operation fails.

Inputs: collection_name (required), ids (required).

chroma_fork_collectionC

Fork a Chroma collection.

Args:
    collection_name: Name of the collection to fork
    new_collection_name: Name of the new collection to create
    metadata: Optional metadata dict to add to the new collection

Inputs: collection_name (required), new_collection_name (required).

chroma_get_collection_countC

Get the number of documents in a Chroma collection.

Args:
    collection_name: Name of the collection to count

Inputs: collection_name (required).

chroma_get_collection_infoC

Get information about a Chroma collection.

Args:
    collection_name: Name of the collection to get info about

Inputs: collection_name (required).

chroma_get_documentsA

Get documents from a Chroma collection with optional filtering.

Args:
    collection_name: Name of the collection to get documents from
    ids: Optional list of document IDs to retrieve
    where: Optional metadata filters using Chroma's query operators
           Examples:
           - Simple equality: {"metadata_field": "value"}
           - Comparison: {"metadata_field": {"$gt": 5}}
           - Logical AND: {"$and": [{"field1": {"$eq": "value1"}}, {"field2": {"$gt": 5}}]}
           - Logical OR: {"$or": [{"field1": {"$eq": "value1"}}, {"field1": {"$eq": "value2"}}]}
    where_document: Optional document content filters
           Examples:
           - Contains: {"$contains": "value"}
           - Not contains: {"$not_contains": "value"}
           - Regex: {"$regex": "[a-z]+"}
           - Not regex: {"$not_regex": "[a-z]+"}
           - Logical AND: {"$and": [{"$contains": "value1"}, {"$not_regex": "[a-z]+"}]}
           - Logical OR: {"$or": [{"$regex": "[a-z]+"}, {"$not_contains": "value2"}]}
    include: List of what to include in response. By default, this will include documents, and metadatas.
    limit: Optional maximum number of documents to return
    offset: Optional number of documents to skip before returning results

Returns:
    Dictionary containing the matching documents, their IDs, and requested includes

Inputs: collection_name (required), ids, include, limit, +3 more.

chroma_list_collectionsA

List all collection names in the Chroma database with pagination support.

Args:
    limit: Optional maximum number of collections to return
    offset: Optional number of collections to skip before returning results

Returns:
    List of collection names or ["__NO_COLLECTIONS_FOUND__"] if database is empty

Inputs: limit, offset.

chroma_modify_collectionB

Modify a Chroma collection's name or metadata.

Args:
    collection_name: Name of the collection to modify
    new_name: Optional new name for the collection
    new_metadata: Optional new metadata for the collection

Inputs: collection_name (required), new_metadata, new_name.

chroma_peek_collectionB

Peek at documents in a Chroma collection.

Args:
    collection_name: Name of the collection to peek into
    limit: Number of documents to peek at

Inputs: collection_name (required), limit.

chroma_query_documentsA

Query documents from a Chroma collection with advanced filtering.

Args:
    collection_name: Name of the collection to query
    query_texts: List of query texts to search for
    n_results: Number of results to return per query
    where: Optional metadata filters using Chroma's query operators
           Examples:
           - Simple equality: {"metadata_field": "value"}
           - Comparison: {"metadata_field": {"$gt": 5}}
           - Logical AND: {"$and": [{"field1": {"$eq": "value1"}}, {"field2": {"$gt": 5}}]}
           - Logical OR: {"$or": [{"field1": {"$eq": "value1"}}, {"field1": {"$eq": "value2"}}]}
    where_document: Optional document content filters
           Examples:
           - Contains: {"$contains": "value"}
           - Not contains: {"$not_contains": "value"}
           - Regex: {"$regex": "[a-z]+"}
           - Not regex: {"$not_regex": "[a-z]+"}
           - Logical AND: {"$and": [{"$contains": "value1"}, {"$not_regex": "[a-z]+"}]}
           - Logical OR: {"$or": [{"$regex": "[a-z]+"}, {"$not_contains": "value2"}]}
    include: List of what to include in response. By default, this will include documents, metadatas, and distances.

Inputs: collection_name (required), query_texts (required), include, n_results, +2 more.

chroma_update_documentsA

Update documents in a Chroma collection.

Args:
    collection_name: Name of the collection to update documents in
    ids: List of document IDs to update (required)
    embeddings: Optional list of new embeddings for the documents.
                Must match length of ids if provided.
    metadatas: Optional list of new metadata dictionaries for the documents.
               Must match length of ids if provided.
    documents: Optional list of new text documents.
               Must match length of ids if provided.

Returns:
    A confirmation message indicating the number of documents updated.

Raises:
    ValueError: If 'ids' is empty or if none of 'embeddings', 'metadatas',
                or 'documents' are provided, or if the length of provided
                update lists does not match the length of 'ids'.
    Exception: If the collection does not exist or if the update operation fails.

Inputs: collection_name (required), ids (required), documents, embeddings, +1 more.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A3.8/5.0

    Scored across 13 tools

    Disambiguation5/5

    Each tool has a clearly distinct purpose targeting specific Chroma operations. For example, chroma_get_documents retrieves documents with filtering, while chroma_query_documents performs semantic search; chroma_peek_collection provides a quick preview, and chroma_get_collection_info returns metadata. No tools appear to overlap in functionality.

    Naming Consistency5/5

    All tools follow a consistent 'chroma_verb_noun' pattern with snake_case throughout. The naming convention is perfectly uniform, making it easy to predict tool names and understand their functions at a glance.

    Tool Count5/5

    With 13 tools, this server provides comprehensive coverage for Chroma vector database operations without being overwhelming. The count aligns well with the domain scope, offering complete collection management and document CRUD operations.

    Completeness5/5

    The toolset provides complete coverage for Chroma operations: collection lifecycle (create, list, get info, modify, fork, delete), document lifecycle (add, get, update, delete, query), and utility functions (count, peek). No obvious gaps exist for typical vector database workflows.

    Maintenance

    ActivityInactive
    ResponsivenessOutdated data

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      A
      quality
      D
      maintenance
      A Model Context Protocol server providing vector database capabilities through Chroma, enabling semantic document search, metadata filtering, and document management with persistent storage.
      6
      41
      MIT
    • A
      license
      Not graded
      quality
      D
      maintenance
      An MCP server that exposes ChromaDB vector database operations, enabling AI assistants to perform collection management and semantic document searches. It supports HTTP, persistent, and in-memory connection modes along with various embedding providers including OpenAI and HuggingFace.
      MIT
    • F
      license
      Not graded
      quality
      D
      maintenance
      A fully offline local RAG server that utilizes ChromaDB and Ollama to index and query PDF, text, and Markdown documents. It allows users to manage local knowledge bases and perform semantic searches with AI-generated responses.
      -