MCP Server for Milvus
以下摘录自该仓库的 README(片段) · 在 GitHub 读完整 README →
> 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.
Prerequisites
Before using this MCP server, ensure you have:
- Python 3.10 or higher
- A running Milvus instance (local or remote)
- uv installed (recommended for running the server)
Usage
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:
Then you can run the server directly:
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:
Important: the .env file will have higher priority than the command line arguments.
Running Modes
The server supports two running modes: **stdio** (default) and **SSE** (Server-Sent Events).
Stdio Mode (Default)
- **Description**: Communicates with the client via standard input/output. This is the default mode if no mode is specified.
- Usage:
SSE Mode
- **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:**
- --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:
The output will be similar to:
You can then access the MCP Inspector at http://127.0.0.1:6274 for testing.
Streamable HTTP Mode
- **Description**: Uses HTTP with streaming support for communication. This is the recommended transport for production deployments and supports both stateful and stateless operation.
- **Usage:**
- --streamable-http: Enables Streamable HTTP mode.
- --port: Specifies the port for the server (default: 8000).
- --stateless: Optional flag for stateless mode (no session persistence).
- **Stateless Mode:**
Supported Applications
This MCP server can be used with various LLM applications that support the Model Context Protocol:
- **Claude Desktop**: Anthropic's desktop application for Claude
- **Cursor**: AI-powered code editor with MCP support
- **Custom MCP clients**: Any application implementing the MCP client specification
Usage with Claude Desktop
Configuration for Different Modes
SSE Mode Configuration
Follow these steps to configure Claude Desktop for SSE mode:
1. Install Claude Desktop from https://claude.ai/download.
2. Open your Claude Desktop configuration file:
- **macOS**: ~/Library/Application Support/Claude/claude_desktop_config.json
3. Add the following configuration for SSE mode:
Streamable HTTP Mode Configuration
4. Restart Claude Desktop to apply the changes.
Stdio Mode Configuration
For stdio mode, follow these steps:
1. Install Claude Desktop from https://claude.ai/download.
2. Open your Claude Desktop configuration file:
- **macOS**: ~/Library/Application Support/Claude/claude_desktop_config.json
3. Add the following configuration for stdio mode:
4. Restart Claude Desktop to apply the changes.
Usage with Cursor
Cursor also supports MCP tools. You can integrate your Milvus MCP server with Cursor by following these steps:
Integration Steps
1. Open Cursor Settings > MCP
2. Click on Add new global MCP server
3. After clicking, it will automatically redirect you to the mcp.json file, which will be created if it doesn’t exist
Configuring the mcp.json File
For Stdio Mode: