Cover image
Try Now
2025-04-09

模型上下文协议(MCP)服务器实现,可为Chroma提供数据库功能

3 years

Works with Finder

4

Github Watches

11

Github Forks

83

Github Stars

Chroma logo

Chroma - the open-source embedding database.
The fastest way to build Python or JavaScript LLM apps with memory!

Discord | License | Docs | Homepage

Chroma MCP Server

smithery badge

The Model Context Protocol (MCP) is an open protocol designed for effortless integration between LLM applications and external data sources or tools, offering a standardized framework to seamlessly provide LLMs with the context they require.

This server provides data retrieval capabilities powered by Chroma, enabling AI models to create collections over generated data and user inputs, and retrieve that data using vector search, full text search, metadata filtering, and more.

Features

  • Flexible Client Types

    • Ephemeral (in-memory) for testing and development
    • Persistent for file-based storage
    • HTTP client for self-hosted Chroma instances
    • Cloud client for Chroma Cloud integration (automatically connects to api.trychroma.com)
  • Collection Management

    • Create, modify, and delete collections
    • List all collections with pagination support
    • Get collection information and statistics
    • Configure HNSW parameters for optimized vector search
    • Select embedding functions when creating collections
  • Document Operations

    • Add documents with optional metadata and custom IDs
    • Query documents using semantic search
    • Advanced filtering using metadata and document content
    • Retrieve documents by IDs or filters
    • Full text search capabilities

Supported Tools

  • chroma_list_collections - List all collections with pagination support
  • chroma_create_collection - Create a new collection with optional HNSW configuration
  • chroma_peek_collection - View a sample of documents in a collection
  • chroma_get_collection_info - Get detailed information about a collection
  • chroma_get_collection_count - Get the number of documents in a collection
  • chroma_modify_collection - Update a collection's name or metadata
  • chroma_delete_collection - Delete a collection
  • chroma_add_documents - Add documents with optional metadata and custom IDs
  • chroma_query_documents - Query documents using semantic search with advanced filtering
  • chroma_get_documents - Retrieve documents by IDs or filters with pagination
  • chroma_update_documents - Update existing documents' content, metadata, or embeddings
  • chroma_delete_documents - Delete specific documents from a collection

Embedding Functions

Chroma MCP supports several embedding functions: default, cohere, openai, jina, voyageai, and roboflow.

The embedding functions utilize Chroma's collection configuration, which persists the selected embedding function of a collection for retrieval. Once a collection is created using the collection configuration, on retrieval for future queries and inserts, the same embedding function will be used, without needing to specify the embedding function again. Embedding function persistance was added in v1.0.0 of Chroma, so if you created a collection using version <=0.6.3, this feature is not supported.

When accessing embedding functions that utilize external APIs, please be sure to add the environment variable for the API key with the correct format, found in Embedding Function Environment Variables

Usage with Claude Desktop

  1. To add an ephemeral client, add the following to your claude_desktop_config.json file:
"chroma": {
    "command": "uvx",
    "args": [
        "chroma-mcp"
    ]
}
  1. To add a persistent client, add the following to your claude_desktop_config.json file:
"chroma": {
    "command": "uvx",
    "args": [
        "chroma-mcp",
        "--client-type",
        "persistent",
        "--data-dir",
        "/full/path/to/your/data/directory"
    ]
}

This will create a persistent client that will use the data directory specified.

  1. To connect to Chroma Cloud, add the following to your claude_desktop_config.json file:
"chroma": {
    "command": "uvx",
    "args": [
        "chroma-mcp",
        "--client-type",
        "cloud",
        "--tenant",
        "your-tenant-id",
        "--database",
        "your-database-name",
        "--api-key",
        "your-api-key"
    ]
}

This will create a cloud client that automatically connects to api.trychroma.com using SSL.

Note: Adding API keys in arguments is fine on local devices, but for safety, you can also specify a custom path for your environment configuration file using the --dotenv-path argument within the args list, for example: "args": ["chroma-mcp", "--dotenv-path", "/custom/path/.env"].

  1. To connect to a [self-hosted Chroma instance on your own cloud provider](https://docs.trychroma.com/ production/deployment), add the following to your claude_desktop_config.json file:
"chroma": {
    "command": "uvx",
    "args": [
      "chroma-mcp", 
      "--client-type", 
      "http", 
      "--host", 
      "your-host", 
      "--port", 
      "your-port", 
      "--custom-auth-credentials",
      "your-custom-auth-credentials",
      "--ssl",
      "true"
    ]
}

This will create an HTTP client that connects to your self-hosted Chroma instance.

Demos

Find reference usages, such as shared knowledge bases & adding memory to context windows in the Chroma MCP Docs

Using Environment Variables

You can also use environment variables to configure the client. The server will automatically load variables from a .env file located at the path specified by --dotenv-path (defaults to .chroma_env in the working directory) or from system environment variables. Command-line arguments take precedence over environment variables.

# 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" 

Embedding Function Environment Variables

When using external embedding functions that access an API key, follow the naming convention CHROMA_<>_API_KEY="<key>". So to set a Cohere API key, set the environment variable CHROMA_COHERE_API_KEY="". We recommend adding this to a .env file somewhere and using the CHROMA_DOTENV_PATH environment variable or --dotenv-path flag to set that location for safekeeping.

相关推荐

  • Joshua Armstrong
  • Confidential guide on numerology and astrology, based of GG33 Public information

  • https://suefel.com
  • Latest advice and best practices for custom GPT development.

  • Emmet Halm
  • Converts Figma frames into front-end code for various mobile frameworks.

  • Elijah Ng Shi Yi
  • Advanced software engineer GPT that excels through nailing the basics.

  • Alexandru Strujac
  • Efficient thumbnail creator for YouTube videos

  • https://maiplestudio.com
  • Find Exhibitors, Speakers and more

  • Yusuf Emre Yeşilyurt
  • I find academic articles and books for research and literature reviews.

  • Carlos Ferrin
  • Encuentra películas y series en plataformas de streaming.

  • https://zenepic.net
  • Embark on a thrilling diplomatic quest across a galaxy on the brink of war. Navigate complex politics and alien cultures to forge peace and avert catastrophe in this immersive interstellar adventure.

  • lumpenspace
  • Take an adjectivised noun, and create images making it progressively more adjective!

  • 林乔安妮
  • A fashion stylist GPT offering outfit suggestions for various scenarios.

  • apappascs
  • 发现市场上最全面,最新的MCP服务器集合。该存储库充当集中式枢纽,提供了广泛的开源和专有MCP服务器目录,并提供功能,文档链接和贡献者。

  • ShrimpingIt
  • MCP系列GPIO Expander的基于Micropython I2C的操作,源自ADAFRUIT_MCP230XX

  • pontusab
  • 光标与风浪冲浪社区,查找规则和MCP

  • av
  • 毫不费力地使用一个命令运行LLM后端,API,前端和服务。

  • ravitemer
  • 一个功能强大的Neovim插件,用于管理MCP(模型上下文协议)服务器

  • jae-jae
  • MCP服务器使用剧作《无头浏览器》获取网页内容。

  • 1Panel-dev
  • 🔥1Panel提供了直观的Web接口和MCP服务器,用于在Linux服务器上管理网站,文件,容器,数据库和LLMS。

  • patruff
  • Ollama和MCP服务器之间的桥梁,使本地LLMS可以使用模型上下文协议工具

  • Mintplex-Labs
  • 带有内置抹布,AI代理,无代理构建器,MCP兼容性等的多合一桌面和Docker AI应用程序。

  • GeyserMC
  • 与Minecraft客户端/服务器通信的库。

    Reviews

    3 (1)
    Avatar
    user_tIR7VdYn
    2025-04-17

    Chroma-mcp by chroma-core is an exceptional tool designed for managing various applications efficiently. The interface is very user-friendly, making it simple to navigate and utilize even for beginners. The robust functionalities and seamless integration truly set it apart from other management tools. Highly recommended for developers and tech enthusiasts looking to streamline their workflows. Check it out at https://github.com/chroma-core/chroma-mcp.