Chroma Mcp 伺服器
概覽
什麼是 Chroma MCP?
Chroma MCP(模型上下文協議)是一個伺服器實現,旨在為 Chroma 框架提供強大的數據庫功能。它作為各種數據來源和應用程序之間的橋樑,允許高效的數據管理和檢索。Chroma MCP 的主要目標是通過實現與數據庫的無縫集成來增強應用程序的功能,從而改善數據處理和處理。
Chroma MCP 的特點
- 數據庫集成:Chroma MCP 支持多種數據庫系統,允許開發人員輕鬆連接和管理來自多個來源的數據。
- 可擴展性:設計用於處理大量數據,Chroma MCP 可以根據應用程序的需求進行擴展,確保即使在高負載下性能仍然保持最佳。
- 用戶友好的 API:Chroma MCP 提供的 API 直觀且易於使用,使所有技能水平的開發人員都能輕鬆訪問。
- 開源:Chroma MCP 是一個開源項目,允許開發人員根據需要貢獻、修改和增強軟件。
- 社區支持:作為 Chroma 生態系統的一部分,用戶可以受益於充滿活力的社區,該社區提供支持、資源和共享知識。
如何使用 Chroma MCP
- 安裝:首先從其官方庫下載 Chroma MCP。按照文檔中提供的安裝說明進行操作。
- 配置:配置伺服器設置以連接到所需的數據庫。這包括指定數據庫憑據和連接參數。
- API 集成:利用提供的 API 與數據庫進行交互。這包括根據應用程序的需要創建、讀取、更新和刪除數據。
- 測試:進行徹底測試,以確保集成按預期工作,並且數據處理正確。
- 部署:測試完成後,部署集成了 Chroma MCP 的應用程序,確保其滿足性能和可擴展性要求。
常見問題
Chroma MCP 支持哪些數據庫?
Chroma MCP 支持多種數據庫,包括 SQL 和 NoSQL 系統。請查看官方文檔以獲取支持的數據庫完整列表。
Chroma MCP 適合大型應用程序嗎?
是的,Chroma MCP 設計為可擴展,能夠處理大量數據,適合小型和大型應用程序。
我如何能夠為 Chroma MCP 做出貢獻?
作為一個開源項目,歡迎貢獻!您可以通過報告問題、提交拉取請求或改善文檔來貢獻。
我在哪裡可以找到有關 Chroma MCP 的更多信息?
有關更多詳細信息,請訪問 Chroma MCP 的官方 GitHub 倉庫,您可以在那裡找到文檔、安裝指南和社區討論。
詳細
Chroma MCP Server
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 supportchroma_create_collection
- Create a new collection with optional HNSW configurationchroma_peek_collection
- View a sample of documents in a collectionchroma_get_collection_info
- Get detailed information about a collectionchroma_get_collection_count
- Get the number of documents in a collectionchroma_modify_collection
- Update a collection's name or metadatachroma_delete_collection
- Delete a collectionchroma_add_documents
- Add documents with optional metadata and custom IDschroma_query_documents
- Query documents using semantic search with advanced filteringchroma_get_documents
- Retrieve documents by IDs or filters with paginationchroma_update_documents
- Update existing documents' content, metadata, or embeddingschroma_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
- To add an ephemeral client, add the following to your
claude_desktop_config.json
file:
"chroma": {
"command": "uvx",
"args": [
"chroma-mcp"
]
}
- 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.
- 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"]
.
- 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.
伺服器配置
{
"mcpServers": {
"chroma-mcp": {
"command": "docker",
"args": [
"run",
"-i",
"--rm",
"ghcr.io/metorial/mcp-container--chroma-core--chroma-mcp--chroma-mcp",
"chroma-mcp --client-type chroma-client-type --data-dir chroma-data-dir --tenant chroma-tenant --database chroma-database --api-key chroma-api-key --host chroma-host --port chroma-port --custom-auth-credentials chroma-custom-auth-credentials --ssl chroma-ssl --dotenv-path chroma-dotenv-path"
],
"env": {
"CHROMA_CLIENT_TYPE": "chroma-client-type",
"CHROMA_DATA_DIR": "chroma-data-dir",
"CHROMA_TENANT": "chroma-tenant",
"CHROMA_DATABASE": "chroma-database",
"CHROMA_API_KEY": "chroma-api-key",
"CHROMA_HOST": "chroma-host",
"CHROMA_PORT": "chroma-port",
"CHROMA_CUSTOM_AUTH_CREDENTIALS": "chroma-custom-auth-credentials",
"CHROMA_SSL": "chroma-ssl",
"CHROMA_DOTENV_PATH": "chroma-dotenv-path",
"CHROMA_COHERE_API_KEY": "chroma-cohere-api-key"
}
}
}
}