by zilliztech
Provides access to Milvus vector database functionality through the Model Context Protocol, enabling LLM applications to perform vector search, hybrid search, collection management, and data operations via stdio or Server‑Sent Events.
Enables seamless interaction between large language model (LLM) applications and a Milvus vector database. The server implements the Model Context Protocol (MCP) so tools like Claude Desktop or Cursor can invoke Milvus capabilities as native LLM tools.
uv
package manager (or any Python runner).uv run src/mcp_server_milvus/server.py --milvus-uri http://localhost:19530
--sse
and --port <port>
to start in Server‑Sent Events mode.MILVUS_URI
, MILVUS_TOKEN
, MILVUS_DB
) can override CLI flags.http://host:port/sse
in the client’s MCP config.Q: How do I switch between stdio and SSE?
A: Omit --sse
for stdio (default). Add --sse
and optionally --port
to launch the SSE server.
Q: Can I set the Milvus connection via environment variables?
A: Yes. Use MILVUS_URI
, MILVUS_TOKEN
, and MILVUS_DB
. These take precedence over CLI flags.
Q: What if the server fails to connect to Milvus? A: Verify the Milvus container is running, check the URI (use 127.0.0.1 if localhost fails), and ensure no firewall blocks the port.
Q: How do I add the server to Claude Desktop?
A: Edit claude_desktop_config.json
– for stdio provide the command/args, for SSE provide the HTTP URL under mcpServers
.
Q: How do I add the server to Cursor?
A: Open Cursor settings → MCP → add a global server, then edit the generated mcp.json
with either the stdio command block or the SSE URL block.
The Model Context Protocol (MCP) is an open protocol that enables seamless integration between LLM applications and external data sources and tools. Whether you're building an AI-powered IDE, enhancing a chat interface, or creating custom AI workflows, MCP provides a standardized way to connect LLMs with the context they need.
This repository contains a MCP server that provides access to Milvus vector database functionality.
Before using this MCP server, ensure you have:
The recommended way to use this MCP server is to run it directly with uv
without installation. This is how both Claude Desktop and Cursor are configured to use it in the examples below.
If you want to clone the repository:
git clone https://github.com/zilliztech/mcp-server-milvus.git
cd mcp-server-milvus
Then you can run the server directly:
uv run src/mcp_server_milvus/server.py --milvus-uri http://localhost:19530
Alternatively you can change the .env file in the src/mcp_server_milvus/
directory to set the environment variables and run the server with the following command:
uv run src/mcp_server_milvus/server.py
The server supports two running modes: stdio (default) and SSE (Server-Sent Events).
Description: Communicates with the client via standard input/output. This is the default mode if no mode is specified.
Usage:
uv run src/mcp_server_milvus/server.py --milvus-uri http://localhost:19530
Description: Uses HTTP Server-Sent Events for communication. This mode allows multiple clients to connect via HTTP and is suitable for web-based applications.
Usage:
uv run src/mcp_server_milvus/server.py --sse --milvus-uri http://localhost:19530 --port 8000
--sse
: Enables SSE mode.--port
: Specifies the port for the SSE server (default: 8000).Debugging in SSE Mode:
If you want to debug in SSE mode, after starting the SSE service, enter the following command:
mcp dev src/mcp_server_milvus/server.py
The output will be similar to:
% mcp dev src/mcp_server_milvus/merged_server.py
Starting MCP inspector...
⚙️ Proxy server listening on port 6277
🔍 MCP Inspector is up and running at http://127.0.0.1:6274 🚀
You can then access the MCP Inspector at http://127.0.0.1:6274
for testing.
This MCP server can be used with various LLM applications that support the Model Context Protocol:
Follow these steps to configure Claude Desktop for SSE mode:
~/Library/Application Support/Claude/claude_desktop_config.json
{
"mcpServers": {
"milvus-sse": {
"url": "http://your_sse_host:port/sse",
"disabled": false,
"autoApprove": []
}
}
}
For stdio mode, follow these steps:
~/Library/Application Support/Claude/claude_desktop_config.json
{
"mcpServers": {
"milvus": {
"command": "/PATH/TO/uv",
"args": [
"--directory",
"/path/to/mcp-server-milvus/src/mcp_server_milvus",
"run",
"server.py",
"--milvus-uri",
"http://localhost:19530"
]
}
}
}
Cursor also supports MCP tools. You can integrate your Milvus MCP server with Cursor by following these steps:
Cursor Settings
> MCP
Add new global MCP server
mcp.json
file, which will be created if it doesn’t existmcp.json
FileOverwrite the mcp.json
file with the following content:
{
"mcpServers": {
"milvus": {
"command": "/PATH/TO/uv",
"args": [
"--directory",
"/path/to/mcp-server-milvus/src/mcp_server_milvus",
"run",
"server.py",
"--milvus-uri",
"http://127.0.0.1:19530"
]
}
}
}
Start the service by running the following command:
uv run src/mcp_server_milvus/server.py --sse --milvus-uri http://your_sse_host --port port
Note: Replace
http://your_sse_host
with your actual SSE host address andport
with the specific port number you’re using.
Once the service is up and running, overwrite the mcp.json
file with the following content:
{
"mcpServers": {
"milvus-sse": {
"url": "http://your_sse_host:port/sse",
"disabled": false,
"autoApprove": []
}
}
}
After completing the above steps, restart Cursor or reload the window to ensure the configuration takes effect.
To verify that Cursor has successfully integrated with your Milvus MCP server:
Cursor Settings
> MCP
The server provides the following tools:
milvus_text_search
: Search for documents using full text search
collection_name
: Name of collection to searchquery_text
: Text to search forlimit
: The maximum number of results to return (default: 5)output_fields
: Fields to include in resultsdrop_ratio
: Proportion of low-frequency terms to ignore (0.0-1.0)milvus_vector_search
: Perform vector similarity search on a collection
collection_name
: Name of collection to searchvector
: Query vectorvector_field
: Field name for vector search (default: "vector")limit
: The maximum number of results to return (default: 5)output_fields
: Fields to include in resultsfilter_expr
: Filter expressionmetric_type
: Distance metric (COSINE, L2, IP) (default: "COSINE")milvus_hybrid_search
: Perform hybrid search on a collection
collection_name
: Name of collection to searchquery_text
: Text query for searchtext_field
: Field name for text searchvector
: Vector of the text queryvector_field
: Field name for vector searchlimit
: The maximum number of results to returnoutput_fields
: Fields to include in resultsfilter_expr
: Filter expressionmilvus_query
: Query collection using filter expressions
collection_name
: Name of collection to queryfilter_expr
: Filter expression (e.g. 'age > 20')output_fields
: Fields to include in resultslimit
: The maximum number of results to return (default: 10)milvus_list_collections
: List all collections in the database
milvus_create_collection
: Create a new collection with specified schema
collection_name
: Name for the new collectioncollection_schema
: Collection schema definitionindex_params
: Optional index parametersmilvus_load_collection
: Load a collection into memory for search and query
collection_name
: Name of collection to loadreplica_number
: Number of replicas (default: 1)milvus_release_collection
: Release a collection from memory
collection_name
: Name of collection to releasemilvus_get_collection_info
: Lists detailed information like schema, properties, collection ID, and other metadata of a specific collection.
collection_name
: Name of the collection to get detailed information aboutmilvus_insert_data
: Insert data into a collection
collection_name
: Name of collectiondata
: Dictionary mapping field names to lists of valuesmilvus_delete_entities
: Delete entities from a collection based on filter expression
collection_name
: Name of collectionfilter_expr
: Filter expression to select entities to deleteMILVUS_URI
: Milvus server URI (can be set instead of --milvus-uri)MILVUS_TOKEN
: Optional authentication tokenMILVUS_DB
: Database name (defaults to "default")To run the server directly:
uv run server.py --milvus-uri http://localhost:19530
What are the collections I have in my Milvus DB?
Claude will then use MCP to check this information on your Milvus DB.
I'll check what collections are available in your Milvus database.
Here are the collections in your Milvus database:
1. rag_demo
2. test
3. chat_messages
4. text_collection
5. image_collection
6. customized_setup
7. streaming_rag_demo
Find documents in my text_collection that mention "machine learning"
Claude will use the full-text search capabilities of Milvus to find relevant documents:
I'll search for documents about machine learning in your text_collection.
> View result from milvus-text-search from milvus (local)
Here are the documents I found that mention machine learning:
[Results will appear here based on your actual data]
In Cursor, you can ask:
Create a new collection called 'articles' in Milvus with fields for title (string), content (string), and a vector field (128 dimensions)
Cursor will use the MCP server to execute this operation:
I'll create a new collection called 'articles' with the specified fields.
Collection 'articles' has been created successfully with the following schema:
- title: string
- content: string
- vector: float vector[128]
If you see errors like "Failed to connect to Milvus server":
docker ps
(if using Docker)127.0.0.1
instead of localhost
in the URIIf you see authentication errors:
MILVUS_TOKEN
is correctIf the MCP tools don't appear in Claude Desktop or Cursor:
If you continue to experience issues:
Please log in to share your review and rating for this MCP.
Explore related MCPs that share similar capabilities and solve comparable challenges
by googleapis
An MCP server that streamlines database tool development by handling connection pooling, authentication, observability, and secure access, allowing agents to interact with databases via natural language.
by bytebase
Provides a universal gateway that lets MCP‑compatible clients explore and query MySQL, PostgreSQL, SQL Server, MariaDB, and SQLite databases through a single standardized interface.
by designcomputer
Enables secure interaction with MySQL databases via the Model Context Protocol, allowing AI applications to list tables, read contents, and execute queries safely.
by benborla
Provides read‑only access to MySQL databases for large language models, allowing schema inspection and safe execution of SQL queries.
by ClickHouse
Enables AI assistants to run read‑only ClickHouse queries, list databases and tables, and execute embedded chDB queries through an MCP interface.
by chroma-core
Offers an MCP server exposing Chroma's vector database capabilities for LLM applications, supporting collection and document management, multiple embedding functions, and flexible client types such as in‑memory, persistent, HTTP, and cloud.
by kiliczsh
Enables LLMs to interact with MongoDB databases via a standardized interface, offering schema inspection, query execution, aggregation, and write capabilities, with optional read‑only mode and smart ObjectId handling.
by domdomegg
Provides read and write access to Airtable bases for AI systems, enabling inspection of schemas and manipulation of records.
by XGenerationLab
A Model Context Protocol (MCP) server that enables natural language queries to databases