🔍 Kimi Search MCP Server
  ](Dockerfile)
基于 Moonshot AI Kimi 的 MCP 联网搜索服务
简体中文
📖 项目简介
本项目是一个轻量级的 MCP (Model Context Protocol) 服务器实现,使用 Rust 编写,通过 Moonshot AI 的 Kimi API 提供联网搜索功能。
让任何支持 MCP 协议的 AI 应用都能够实时联网搜索,获取最新信息。
✨ 特性
- 🚀 高性能 - Rust 实现,内存安全,极致性能
- 🪶 轻量级 - 静态编译,二进制文件体积小
- 🐳 容器化 - 开箱即用的 Docker 支持
- 🔌 MCP 协议 - 标准实现,兼容性好
- 🌐 CORS 支持 - 跨域友好,方便集成
- 🔐 安全传递 - API Key 通过请求参数传递,不存储
🛠️ 技术栈
📦 快速开始
方式一:Docker 运行(推荐)
# 构建镜像
docker build -t kimi-search-mcp .
# 运行容器
docker run -d -p 3000:3000 kimi-search-mcp或者从ghcr拉取
docker pull ghcr.io/herta-ai/kimi-search-mcp-rs:latest
docker run -d -p 3000:3000 ghcr.io/herta-ai/kimi-search-mcp-rs方式二:本地编译
# 克隆项目
git clone https://github.com/your-username/kimi-search-mcp-rs.git
cd kimi-search-mcp-rs
# 编译运行
cargo run --release服务将在 http://localhost:3000 启动。
命令行参数
| 参数 | 说明 | 示例 |
|---|---|---|
| `-p, --port | ||
| ` | 指定监听端口,默认 3000 | cargo run --release -- -p 8080 |
# 使用默认端口 3000
cargo run --release
# 指定端口 8080
cargo run --release -- -p 8080
# 或
cargo run --release -- --port 8080📡 API 使用
MCP 端点
POST http://localhost:3000/mcp?apiKey=YOUR_KIMI_API_KEY&model=kimi-k2-turbo-preview请求示例
1. 初始化连接
{
"jsonrpc": "2.0",
"id": 1,
"method": "initialize",
"params": {
"protocolVersion": "2024-11-05",
"capabilities": {}
}
}2. 获取工具列表
{
"jsonrpc": "2.0",
"id": 2,
"method": "tools/list"
}3. 调用搜索工具
{
"jsonrpc": "2.0",
"id": 3,
"method": "tools/call",
"params": {
"name": "search",
"arguments": {
"query": "今天的新闻"
}
}
}响应示例
{
"jsonrpc": "2.0",
"id": 3,
"result": {
"content": [
{
"type": "text",
"text": "根据搜索结果,今天的主要新闻包括..."
}
]
}
}🔧 配置参数
| 参数 | 必填 | 默认值 | 说明 |
|---|---|---|---|
apiKey | ✅ | - | Moonshot AI API Key |
model | ❌ | kimi-k2-turbo-preview | 使用的模型名称 |
🤝 客户端集成
Claude Desktop
在 Claude Desktop 配置文件中添加:
{
"mcpServers": {
"kimi-search": {
"url": "http://localhost:3000/mcp",
"queryParams": {
"apiKey": "YOUR_KIMI_API_KEY"
}
}
}
}Cursor / 其他 MCP 客户端
配置 MCP 服务器 URL:
http://localhost:3000/mcp?apiKey=YOUR_KIMI_API_KEY📝 开发
# 开发模式运行
cargo run
# 运行测试
cargo test
# 构建发布版本
cargo build --release📄 许可证
本项目采用 MIT 许可证。详见 LICENSE 文件。
English
📖 Overview
A lightweight MCP (Model Context Protocol) server implementation in Rust, providing web search capabilities through Moonshot AI's Kimi API.
Enable any MCP-compatible AI application to perform real-time web searches and access up-to-date information.
✨ Features
- 🚀 High Performance - Rust implementation with memory safety
- 🪶 Lightweight - Statically compiled, minimal binary size
- 🐳 Docker Ready - Out-of-the-box containerization support
- 🔌 MCP Protocol - Standard implementation with great compatibility
- 🌐 CORS Support - Cross-origin friendly for easy integration
- 🔐 Secure - API Key passed via request parameters, never stored
📦 Quick Start
Docker (Recommended)
docker build -t kimi-search-mcp .
docker run -d -p 3000:3000 kimi-search-mcpLocal Build
git clone https://github.com/your-username/kimi-search-mcp-rs.git
cd kimi-search-mcp-rs
cargo run --releaseServer starts at http://localhost:3000.
Command Line Options
| Option | Description | Example |
|---|---|---|
| `-p, --port | ||
| ` | Specify listening port, default 3000 | cargo run --release -- -p 8080 |
# Use default port 3000
cargo run --release
# Specify port 8080
cargo run --release -- -p 8080
# or
cargo run --release -- --port 8080📡 API Usage
MCP Endpoint
POST http://localhost:3000/mcp?apiKey=YOUR_KIMI_API_KEY&model=kimi-k2-turbo-previewTool: search
Search the web using Kimi's built-in web search capability.
Parameters:
query(string, required): The search query
Example:
{
"jsonrpc": "2.0",
"id": 1,
"method": "tools/call",
"params": {
"name": "search",
"arguments": {
"query": "latest technology news"
}
}
}🔧 Configuration
| Parameter | Required | Default | Description |
|---|---|---|---|
apiKey | ✅ | - | Moonshot AI API Key |
model | ❌ | kimi-k2-turbo-preview | Model to use |
📄 License
MIT License. See LICENSE for details.
Made with ❤️ using Rust
