Purpose
mcp-server-milvus is a Model Context Protocol (MCP) server for the Milvus vector database. MCP is an open protocol used to establish seamless integration between LLM applications and external data sources and tools, suitable for building AI-driven IDEs, enhancing chat interfaces, or creating custom AI workflows. The MCP server provided by this repository enables LLM applications to access the capabilities of the Milvus vector database.
Main Capabilities
The server provides two categories of tools: search and query operations, and collection management.
Search and query operations include:
- milvus_text_search: Use full-text search to find documents. Parameters include collection_name (the name of the collection to search), query_text (the text to search for), limit (the maximum number of results to return, default 5), output_fields (the fields to include in the results), drop_ratio (the proportion of low-frequency words to ignore, 0.0-1.0, default 0.2).
- milvus_vector_search: Perform vector similarity search on a collection. Parameters include collection_name, vector (the query vector), vector_field (the name of the field for vector search, default "vector"), limit (default 5), output_fields, filter_expr (filter expression), metric_type (distance metric, COSINE, L2, IP, default "COSINE"), radius (optional lower bound for range search, default None), range_filter (optional upper bound for range search, default None).
- milvus_hybrid_search: Perform hybrid search on a collection. Parameters include collection_name, query_text (the text query to search for), text_field (the name of the field for text search), vector (the vector of the text query), vector_field (the name of the field for vector search), limit (default 5), output_fields, filter_expr, sparse_radius (optional lower bound for sparse range search), sparse_range_filter (optional upper bound for sparse range search), dense_radius (optional lower bound for dense range search), dense_range_filter (optional upper bound for dense range search); the last four items all default to None.
- milvus_text_similarity_search: Perform text similarity search on a collection. Note: This tool is only supported on Milvus 2.6.0 and above, and requires an Embedding Function to be set on the Milvus server; see the Embedding Function documentation for details. Parameters include collection_name, query_text (the text query for similarity search), anns_field (the name of the field for text search), limit (default 5), output_fields, metric_type (default "COSINE"), filter_expr (optional filter expression), radius (optional lower bound, default None), range_filter (optional upper bound, default None).
- milvus_query: Query a collection using a filter expression. Parameters include collection_name, filter_expr (filter expression, e.g. 'age > 20'), output_fields, limit (maximum number of results to return, default 10).
Collection management includes:
- milvus_list_collections: List all collections in the database.
- milvus_create_collection: Create a new collection using quick setup or a custom schema. Parameters include collection_name (the new collection name), auto_id (whether to automatically generate ids, default True), dimension (vector dimension, default 768, used for quick setup; ignored if field_schema is provided), primary_field_name (primary field name, default "id", used for quick setup; ignored if field_schema is provided), vector_field_name (vector field name, default "vector", used for quick setup; ignored if field_schema is provided), metric_type (metric type, default "COSINE", used for quick setup; if field_schema is ignored), field_schema (a list of field schemas, each element is a dictionary whose keys include name (field name) and type (type)).
Usage
Before use, ensure: Python 3.10 or later; a running Milvus instance (local or remote); uv installed (recommended for running the server).
The recommended way to use it is to run it directly with uv, with no installation required. This is also the configuration method used in the Claude Desktop and Cursor examples.
If you want to clone the repository, you can then run the server directly. You can also modify the .env file under the src/mcp_server_milvus/ directory to set environment variables, and then run the server. Important: the .env file takes precedence over command-line arguments.
The server supports two running modes: stdio (default) and SSE (Server-Sent Events).
Stdio mode (default): communicates with the client through standard input/output. If no mode is specified, this is the default mode. Usage: uv run src/mcp_server_milvus/server.py --milvus-uri http://localhost:19530
SSE mode: communicates using HTTP Server-Sent Events. This mode allows multiple clients to connect over 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. Here --sse enables SSE mode, and --port specifies the SSE server port (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 is roughly as follows: % 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。然后可以访问 http://127.0.0.1:6274 Use MCP Inspector for testing.
Streamable HTTP mode: communicates using HTTP that supports streaming. This is the recommended transport method for production deployments, supporting both stateful and stateless operations. Usage: uv run src/mcp_server_milvus/server.py --streamable-http --milvus-uri http://localhost:19530 --port 8000. Here --streamable-http enables Streamable HTTP mode, --port specifies the server port (default 8000), and --stateless is an optional flag used for stateless mode (does not maintain session persistence). Example of stateless mode: uv run src/mcp_server_milvus/server.py --streamable-http --stateless --milvus-uri http://localhost:19530 --port 8000.
Supported Applications
This MCP server can be used with various LLM applications that support the Model Context Protocol: Claude Desktop (Anthropic's Claude desktop application), Cursor (an AI-driven code editor that supports MCP), custom MCP clients (any application that implements the MCP client specification).
Using with Claude Desktop
Configuration steps for different modes: to configure Claude Desktop for SSE mode, from https://claude.ai/download Install Claude Desktop; open the Claude Desktop configuration file: on macOS the path is ~/Library/Application Support/Claude/claude_desktop_config.json; add the configuration for SSE mode; restart Claude Desktop for the changes to take effect. For stdio mode, add the configuration for stdio mode.
Using with Cursor
Cursor also supports MCP tools. Integration steps: open Cursor Settings > MCP; click Add new global MCP server; after clicking, you will be automatically redirected to the mcp.json file, and if the file does not exist it will be created automatically.
Configure the mcp.json file: overwrite the mcp.json file with the corresponding content. Then start the service and run the command: uv run src/mcp_server_milvus/server.py --sse --milvus-uri http://your_sse_host --port port. Note: replace http://your_sse_host Replace with the actual SSE host address, and replace port with the specific port number being used. After the service is started and running, overwrite the mcp.json file with the following content: { "mcpServers" : { "milvus-sse" : { "url" : " http://your_sse_host:port/sse " , "disabled" : false , "autoApprove" : [] } } }.
In Streamable HTTP mode, start the service: uv run src/mcp_server_milvus/server.py --streamable-http --milvus-uri http://your_host --port port. Then update mcp.json: { "mcpServers" : { "milvus-streamable-http" : { "url" : " http://your_host:port/mcp " , "disabled" : false , "autoApprove" : [] } } }.
Complete the integration: After completing the above steps, restart Cursor or reload the window to ensure the configuration takes effect.
Verify the integration: To verify whether Cursor has successfully integrated with the Milvus MCP server, check whether "milvus", "milvus-sse", or "milvus-streamable-http" appears in the list (depending on the selected mode); confirm that the relevant tools are listed (for example milvus_list_collections, milvus_vector_search, etc.); if the server is enabled but displays an error, see the Troubleshooting section below.
Use Cases
This server is suitable for scenarios that require LLM applications to directly access the Milvus vector database, such as performing vector search, full-text search, hybrid search, or querying collection data by filter conditions in AI-powered IDEs, chat interfaces, or custom AI workflows. It is also suitable for integration through MCP clients such as Claude Desktop and Cursor.
Limitations
milvus_text_similarity_search is supported only in Milvus 2.6.0 and above, and requires an embedding function to be set on the Milvus server. Using this server requires prerequisites such as Python 3.10+, a running Milvus instance, and uv. Other limitations are not currently described in the provided materials.