Chroma Mcp Serveur
Une implémentation de serveur de Protocole de Contexte de Modèle (MCP) qui fournit des capacités de base de données pour Chroma.
Aperçu
Qu'est-ce que Chroma MCP ?
Chroma MCP (Model Context Protocol) est une implémentation serveur conçue pour fournir des capacités de base de données robustes pour le cadre Chroma. Il sert de pont entre diverses sources de données et applications, permettant une gestion et une récupération efficaces des données. L'objectif principal de Chroma MCP est d'améliorer la fonctionnalité des applications en permettant une intégration transparente avec les bases de données, améliorant ainsi la gestion et le traitement des données.
Fonctionnalités de Chroma MCP
- Intégration de base de données : Chroma MCP prend en charge divers systèmes de bases de données, permettant aux développeurs de se connecter et de gérer des données provenant de plusieurs sources sans effort.
- Scalabilité : Conçu pour gérer de grands volumes de données, Chroma MCP peut évoluer en fonction des besoins de l'application, garantissant que les performances restent optimales même sous de lourdes charges.
- API conviviale : L'API fournie par Chroma MCP est intuitive et facile à utiliser, la rendant accessible aux développeurs de tous niveaux de compétence.
- Open Source : Chroma MCP est un projet open-source, permettant aux développeurs de contribuer, modifier et améliorer le logiciel selon leurs besoins.
- Support communautaire : Faisant partie de l'écosystème Chroma, les utilisateurs peuvent bénéficier d'une communauté dynamique qui offre soutien, ressources et partage de connaissances.
Comment utiliser Chroma MCP
- Installation : Commencez par télécharger Chroma MCP depuis son dépôt officiel. Suivez les instructions d'installation fournies dans la documentation.
- Configuration : Configurez les paramètres du serveur pour vous connecter à votre base de données souhaitée. Cela inclut la spécification des identifiants de la base de données et des paramètres de connexion.
- Intégration API : Utilisez l'API fournie pour interagir avec la base de données. Cela inclut la création, la lecture, la mise à jour et la suppression de données selon les besoins de votre application.
- Test : Effectuez des tests approfondis pour vous assurer que l'intégration fonctionne comme prévu et que les données sont gérées correctement.
- Déploiement : Une fois les tests terminés, déployez votre application avec Chroma MCP intégré, en vous assurant qu'elle répond à vos exigences de performance et de scalabilité.
Questions Fréquemment Posées
Quelles bases de données sont prises en charge par Chroma MCP ?
Chroma MCP prend en charge une variété de bases de données, y compris les systèmes SQL et NoSQL. Consultez la documentation officielle pour une liste complète des bases de données prises en charge.
Chroma MCP est-il adapté aux applications à grande échelle ?
Oui, Chroma MCP est conçu pour être évolutif et peut gérer de grands volumes de données, ce qui le rend adapté aux applications de petite et grande échelle.
Comment puis-je contribuer à Chroma MCP ?
En tant que projet open-source, les contributions sont les bienvenues ! Vous pouvez contribuer en signalant des problèmes, en soumettant des demandes de tirage ou en améliorant la documentation.
Où puis-je trouver plus d'informations sur Chroma MCP ?
Pour plus de détails, visitez le dépôt GitHub officiel de Chroma MCP, où vous pouvez trouver de la documentation, des guides d'installation et des discussions communautaires.
Détail
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.
Configuration du serveur
{
"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"
}
}
}
}