PyMilvus Code Generate Helper

by shawnzheng011019

Not rated
GitHub

About

Retrieves relevant code snippets and documents to assist in generating PyMilvus code, requiring a running Milvus instance.

Details

Author
shawnzheng011019
Categories
Developer Tools, Database, Other, Knowledge Base

Usage With Gemini Cli As An Mcp Server

You can add a Gemini MCP server alongside this project in the same client. This is optional and independent of this server.

The server provides three powerful tools for Milvus code generation and translation:

Generate or provide sample PyMilvus/Milvus code based on natural language input.

- When to use: Code generation, sample code requests, "how to write" queries
- Parameters:

- query: Your natural language request for code generation

Convert between ORM and PyMilvus client code formats.

- When to use: Converting between ORM and client styles, format adaptation
- Parameters:

- query: List of Milvus API names to convert (e.g.,["create_collection", "insert"])

Translate Milvus code between different programming languages.

- When to use: Cross-language code translation
- Parameters:

- query: List of Milvus API names in escaped double quotes format (e.g.,[\"create_collection\", \"insert\", \"search\"])
- source_language: Source programming language (python, java, go, csharp, node, restful)
- target_language: Target programming language (python, java, go, csharp, node, restful)

⚠️Important: You don't need to specify tool names or parameters manually. Just describe your requirements naturally, and the MCP system will automatically select the appropriate tool and prepare the necessary parameters.

For backward compatibility, the server also supports SSE and STDIO transport modes:

# Start SSE server uv run src/mcp_pymilvus_code_generate_helper/sse_server.py --milvus_uri http://localhost:19530 # Cursor configuration for SSE { "mcpServers": { "milvus-sdk-code-helper": { "url": "http://localhost:23333/milvus-code-helper/sse" } } }
# Start STDIO server uv run src/mcp_pymilvus_code_generate_helper/stdio_server.py --milvus_uri http://localhost:19530 # Cursor configuration for STDIO { "mcpServers": { "milvus-sdk-code-helper": { "command": "/PATH/TO/uv", "args": [ "--directory", "/path/to/milvus-sdk-code-helper", "run", "src/mcp_pymilvus_code_generate_helper/stdio_server.py", "--milvus_uri", "http://localhost:19530" ], "env": { "OPENAI_API_KEY": "YOUR_OPENAI_API_KEY" } } } }

You can also run the server using Docker:

# First time run with document update docker run -p 8000:8000 \ -e OPENAI_API_KEY=your_openai_key \ -e MILVUS_URI=http://your-milvus-host:19530 \ -e MILVUS_TOKEN=your_milvus_token \ milvus-code-helper # Lightweight mode for subsequent runs docker run -p 8000:8000 \ -e OPENAI_API_KEY=your_openai_key \ -e MILVUS_URI=http://your-milvus-host:19530 \ -e MILVUS_TOKEN=your_milvus_token \ milvus-code-helper examples/fastmcp_server.py

- http: RESTful HTTP transport (recommended)
- sse: Server-Sent Events transport
- stdio: Standard input/output transport

- OPENAI_API_KEY: Required for document processing and embedding generation
- MILVUS_URI: Alternative way to specify Milvus server URI
- MILVUS_TOKEN: Alternative way to specify Milvus authentication token
- Connection refused: Ensure Milvus is running and accessible
- Authentication failed: Check your Milvus token and credentials
- Port conflicts: Change the port using--portparameter
- Missing documents: Run the full server first to populate the database

PYTHONPATH=src python -m logging --level DEBUG src/mcp_pymilvus_code_generate_helper/fastmcp_server.py

Contributions are welcome! If you have ideas for improving the retrieval results or adding new features, please submit a pull request or open an issue.

This project is licensed under the MIT License.

This is a web browser that enables your coding agent, such as Claude Code, to visit websites on your behalf and assist you in identifying bugs or creating UI test cases.

Introspects Laravel codebases to provide structured information about views, routes, classes, and models using the mateffy/laravel-introspect package.

uild plug-and-play MCP servers for code search, docs, databases, and more. Integrates with Claude Code, Cursor, and Windsurf.

MCP server for AI Diagram Maker — generate beautiful software engineering diagrams directly inside Cursor, Claude Desktop, Claude Code, or any MCP-compatible AI agent

MCP server that gives AI assistants on-demand access to 1,500+ amCharts docs, ~300 code examples, and 1000+ class API references.

One shared context layer for AI agents and humans — live API specs, DB schemas, and versioned contracts across repos so every agent and teammate works from the same source of truth.

Local stdio MCP server that lets AI coding agents read and maintain structured architecture, rules, and decisions directly from your repository.

The official developer experience MCP Server for Amazon DynamoDB. This server provides DynamoDB expert design guidance and data modeling assistance.

The MCP server for Bitrix24 provides AI assistants with structured access to the Bitrix24 API. It delivers up-to-date method descriptions, parameters, and valid values, allowing assistants to work with precise data instead of guesswork. This reduces code errors and accelerates Bitrix24 integration development.

Official Context7 MCP server that brings up-to-date, version-specific library documentation and code examples into AI coding prompts.

Remote, no-auth MCP server providing AI-powered codebase context and answers

Retrieves relevant code snippets and documents to assist in generating PyMilvus code, requiring a running Milvus instance.

A Model Context Protocol server that retrieves relevant code snippets or documents to help generating pymilvus code.

Before using this MCP server, ensure you have:

- Python 3.10 or higher
- A runningMilvusinstance (local or remote)
-
uvinstalled (recommended for running the server)

The recommended way to use this MCP server is through FastMCP, which provides better performance and easier configuration.

For the first time running the server, use the main FastMCP server which will automatically update the document database:

uv run src/mcp_pymilvus_code_generate_helper/fastmcp_server.py

- Connect to your Milvus instance (default:http://localhost:19530)
- Download and process the latest Milvus documentation
- Start the MCP server with all three tools available

# Connect to remote Milvus server uv run src/mcp_pymilvus_code_generate_helper/fastmcp_server.py --milvus_uri http://your-server:19530 --milvus_token your_token # Change server host and port uv run src/mcp_pymilvus_code_generate_helper/fastmcp_server.py --host 0.0.0.0 --port 8080 # Use different transport (default is http) uv run src/mcp_pymilvus_code_generate_helper/fastmcp_server.py --transport sse

After the initial setup, you can use the lightweight FastMCP server for faster startup:

- Skips document synchronization
- Starts immediately without background tasks
- Assumes documents are already loaded in Milvus

# Custom configuration for lightweight server uv run examples/fastmcp_server.py --milvus_uri http://your-server:19530 --host 0.0.0.0 --port 8080 --transport http

- Automatically fetches and indexes the latest Milvus documentation version (可以获取最新文档版本)
- Weekly auto-refresh via a lightweight background scheduler
- Go toCursor>Settings>MCP
- Click on the+ Add New Global MCP Serverbutton
- Configure based on your chosen mode:

{ "mcpServers": { "milvus-sdk-code-helper": { "url": "http://localhost:8000/mcp" } } }
{ "mcpServers": { "milvus-sdk-code-helper": { "url": "http://localhost:8000" } } }
{ "mcpServers": { "milvus-sdk-code-helper": { "command": "/PATH/TO/uv", "args": [ "--directory", "/path/to/milvus-sdk-code-helper", "run", "examples/fastmcp_server.py", "--transport", "stdio", "--milvus_uri", "http://localhost:19530" ], "env": { "OPENAI_API_KEY": "YOUR_OPENAI_API_KEY" } } } }

- Install Claude Desktop fromhttps://claude.ai/download
- Open your Claude Desktop configuration:

- macOS:~/Library/Application Support/Claude/claude_desktop_config.json
- Windows:%APPDATA%\Claude\claude_desktop_config.json

{ "mcpServers": { "milvus-sdk-code-helper": { "url": "http://localhost:8000/mcp" } } }
{ "mcpServers": { "milvus-sdk-code-helper": { "command": "/PATH/TO/uv", "args": [ "--directory", "/path/to/milvus-sdk-code-helper", "run", "examples/fastmcp_server.py", "--transport", "stdio", "--milvus_uri", "http://localhost:19530" ], "env": { "OPENAI_API_KEY": "YOUR_OPENAI_API_KEY" } } } }

⚠️Note: Remember to set theOPENAI_API_KEYenvironment variable when using STDIO transport.

# HTTP (recommended) claude mcp add --transport http milvus-sdk-code-helper http://localhost:8000/mcp # SSE claude mcp add --transport sse milvus-sdk-code-helper http://localhost:8000 # STDIO claude mcp add milvus-sdk-code-helper /ABS/PATH/TO/uv -- \ --directory /ABS/PATH/TO/milvus-sdk-code-helper \ run examples/fastmcp_server.py --transport stdio --milvus_uri http://localhost:19530

- Global (~/.claude.json) – HTTP transport

{ "mcpServers": { "milvus-sdk-code-helper": { "type": "http", "url": "http://localhost:8000/mcp" } } }

- Project (.mcp.jsonat project root) – STDIO transport

{ "mcpServers": { "milvus-sdk-code-helper": { "type": "stdio", "command": "/ABS/PATH/TO/uv", "args": [ "--directory", "/ABS/PATH/TO/milvus-sdk-code-helper", "run", "examples/fastmcp_server.py", "--transport", "stdio", "--milvus_uri", "http://localhost:19530" ], "env": { "OPENAI_API_KEY": "YOUR_OPENAI_API_KEY" } } } }

Usage with Gemini CLI (as an MCP server)

You can add a Gemini MCP server alongside this project in the same client. This is optional and independent of this server.

The server provides three powerful tools for Milvus code generation and translation:

Generate or provide sample PyMilvus/Milvus code based on natural language input.

- When to use: Code generation, sample code requests, "how to write" queries
- Parameters:

- query: Your natural language request for code generation

Convert between ORM and PyMilvus client code formats.

- When to use: Converting between ORM and client styles, format adaptation
- Parameters:

- query: List of Milvus API names to convert (e.g.,["create_collection", "insert"])

Translate Milvus code between different programming languages.

- When to use: Cross-language code translation
- Parameters:

- query: List of Milvus API names in escaped double quotes format (e.g.,[\"create_collection\", \"insert\", \"search\"])
- source_language: Source programming language (python, java, go, csharp, node, restful)
- target_language: Target programming language (python, java, go, csharp, node, restful)

⚠️Important: You don't need to specify tool names or parameters manually. Just describe your requirements naturally, and the MCP system will automatically select the appropriate tool and prepare the necessary parameters.

For backward compatibility, the server also supports SSE and STDIO transport modes:

# Start SSE server uv run src/mcp_pymilvus_code_generate_helper/sse_server.py --milvus_uri http://localhost:19530 # Cursor configuration for SSE { "mcpServers": { "milvus-sdk-code-helper": { "url": "http://localhost:23333/milvus-code-helper/sse" } } }
# Start STDIO server uv run src/mcp_pymilvus_code_generate_helper/stdio_server.py --milvus_uri http://localhost:19530 # Cursor configuration for STDIO { "mcpServers": { "milvus-sdk-code-helper": { "command": "/PATH/TO/uv", "args": [ "--directory", "/path/to/milvus-sdk-code-helper", "run", "src/mcp_pymilvus_code_generate_helper/stdio_server.py", "--milvus_uri", "http://localhost:19530" ], "env": { "OPENAI_API_KEY": "YOUR_OPENAI_API_KEY" } } } }

You can also run the server using Docker:

# First time run with document update docker run -p 8000:8000 \ -e OPENAI_API_KEY=your_openai_key \ -e MILVUS_URI=http://your-milvus-host:19530 \ -e MILVUS_TOKEN=your_milvus_token \ milvus-code-helper # Lightweight mode for subsequent runs docker run -p 8000:8000 \ -e OPENAI_API_KEY=your_openai_key \ -e MILVUS_URI=http://your-milvus-host:19530 \ -e MILVUS_TOKEN=your_milvus_token \ milvus-code-helper examples/fastmcp_server.py

- http: RESTful HTTP transport (recommended)
- sse: Server-Sent Events transport
- stdio: Standard input/output transport

- OPENAI_API_KEY: Required for document processing and embedding generation
- MILVUS_URI: Alternative way to specify Milvus server URI
- MILVUS_TOKEN: Alternative way to specify Milvus authentication token
- Connection refused: Ensure Milvus is running and accessible
- Authentication failed: Check your Milvus token and credentials
- Port conflicts: Change the port using--portparameter
- Missing documents: Run the full server first to populate the database

PYTHONPATH=src python -m logging --level DEBUG src/mcp_pymilvus_code_generate_helper/fastmcp_server.py

Contributions are welcome! If you have ideas for improving the retrieval results or adding new features, please submit a pull request or open an issue.

This project is licensed under the MIT License.

This is a web browser that enables your coding agent, such as Claude Code, to visit websites on your behalf and assist you in identifying bugs or creating UI test cases.

Introspects Laravel codebases to provide structured information about views, routes, classes, and models using the mateffy/laravel-introspect package.

uild plug-and-play MCP servers for code search, docs, databases, and more. Integrates with Claude Code, Cursor, and Windsurf.

MCP server for AI Diagram Maker — generate beautiful software engineering diagrams directly inside Cursor, Claude Desktop, Claude Code, or any MCP-compatible AI agent

MCP server that gives AI assistants on-demand access to 1,500+ amCharts docs, ~300 code examples, and 1000+ class API references.

One shared context layer for AI agents and humans — live API specs, DB schemas, and versioned contracts across repos so every agent and teammate works from the same source of truth.

Local stdio MCP server that lets AI coding agents read and maintain structured architecture, rules, and decisions directly from your repository.

The official developer experience MCP Server for Amazon DynamoDB. This server provides DynamoDB expert design guidance and data modeling assistance.

The MCP server for Bitrix24 provides AI assistants with structured access to the Bitrix24 API. It delivers up-to-date method descriptions, parameters, and valid values, allowing assistants to work with precise data instead of guesswork. This reduces code errors and accelerates Bitrix24 integration development.

Official Context7 MCP server that brings up-to-date, version-specific library documentation and code examples into AI coding prompts.

Remote, no-auth MCP server providing AI-powered codebase context and answers

No reviews yet — be the first

Sign in to leave a review

Use Google, GitHub, or an email account so ratings stay tied to real people.

Email sign in

No reviews posted yet.