milvus-mcp-server
If you are the rightful owner of milvus-mcp-server and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to henry@mcphub.com.
A connector enabling Large Language Models to interface with Milvus vector databases through Anthropic's Model Context Protocol (MCP).
Milvus MCP Server
A connector enabling Large Language Models to interface with Milvus vector databases through Anthropic's Model Context Protocol (MCP).
Overview
This server implements Anthropic's Model Context Protocol (MCP), allowing AI assistants to directly query and manage vector databases in Milvus. It provides tools for vector search, text search, and collection management.
Features
- Vector Similarity Search: Find similar vectors using various distance metrics (COSINE, L2, IP)
- Full-Text Search: Perform text searches across collections
- Collection Management: Create, load, release, and query collections
- Data Manipulation: Insert, delete, and update vector data
- Database Operations: List and switch between databases
Installation
-
Clone this repository:
git clone <repository-url> cd mcp-server-milvus
-
Install dependencies:
pip install -r requirements.txt
-
Configure your environment:
cp example.env .env # Edit .env with your Milvus connection details
Usage
Starting the Server
python server.py --milvus-uri http://localhost:19530 --milvus-token <token> --milvus-db <db_name>
Or use environment variables defined in .env
.
Available MCP Tools
milvus_text_search
: Search for documents using full text searchmilvus_list_collections
: List all collections in the databasemilvus_query
: Query collection using filter expressionsmilvus_vector_search
: Perform vector similarity searchmilvus_create_collection
: Create a new collection with specified schemamilvus_insert_data
: Insert data into a collectionmilvus_delete_entities
: Delete entities from a collectionmilvus_load_collection
: Load a collection into memorymilvus_release_collection
: Release a collection from memorymilvus_list_databases
: List all databases in the Milvus instancemilvus_use_database
: Switch to a different database
Data Format
Collection Schema Format
When creating a collection, use this schema format:
{
"dimension": 128, # Vector dimension
"primary_field": "id", # Primary key field name
"id_type": "INT64", # Primary key data type (will be converted to DataType.INT64)
"vector_field": "vector", # Vector field name
"metric_type": "COSINE", # Distance metric
"auto_id": True, # Auto-generate IDs
"enable_dynamic_field": True, # Enable dynamic fields
"other_fields": [ # Additional fields
{
"name": "description",
"type": "VARCHAR",
"max_length": 65535
}
]
}
Vector Data Format
When inserting vectors:
# Insert data
data = {
"vector": [[0.1, 0.2, ...], [0.3, 0.4, ...], ...], # List of vectors
"description": ["First item", "Second item", ...] # Optional field values
}
Known Issues and Workarounds
See CLAUDE.md for known issues and best practices when working with this codebase.
License
This project is licensed under the MIT License - see the file for details.