小贴士:按下Ctrl+D 或 ⌘+D,一键收藏本站,方便下次快速访问!
MIT License
10
最近更新:7天前

专业的Gemini API集成,适用于Claude和所有MCP兼容主机,具有智能模型选择和高级文件处理功能 | Smithery.ai认证

GemSuite MCP:最全面的 Gemini API Model Context Protocol 集成

最终的开源服务器,用于高级 Gemini API 与 Model Context Protocol (MCP) 的交互,智能选择模型以实现最佳性能、最低令牌成本和无缝集成。

GemSuite MCP Logo



License: MIT
TypeScript
MCP
smithery badge
Node.js







专业级 Gemini API 集成,适用于 Claude 和所有 MCP 兼容主机,具有智能模型选择和高级文件处理功能

源自 geminiserchMCP 项目,功能增强

安装特性使用示例模型贡献

🌟 什么是 GemSuite MCP?

GemSuite (Model Context Protocol) MCP 是 MCP 主机的最佳 Gemini API 集成接口,智能选择适合任务的模型——提供最佳性能、最低令牌成本和无缝集成。它使任何 MCP 兼容主机(Claude、Cursor、Replit 等)能够无缝利用 Gemini 的能力,专注于:

  1. 智能性:根据任务和内容自动选择最佳 Gemini 模型
  2. 效率:优化不同工作负载下的令牌使用和性能
  3. 简单性:为复杂 AI 操作提供干净一致的 API
  4. 多功能性:高级文件处理;支持多种文件类型、操作和用例

无论您是在分析文档、解决复杂问题、处理大文本文件还是搜索信息,GemSuite MCP 都能为您提供完成任务所需的正确工具和模型。

为什么选择 GemSuite MCP?

与其他功能有限的 Gemini MCP 服务器不同,GemSuite MCP 提供:

智能模型选择:根据任务自动选择最佳 Gemini 模型
统一文件处理:无缝处理各种文件类型并自动检测格式
全面工具套件:涵盖搜索、推理、处理和分析的四种专用工具
生产就绪:在 Smithery.aiMCP.soGlama.io 上部署和验证

🚀 安装

选项 1:Smithery.ai(推荐)

bash 复制代码
# 使用 Smithery CLI 直接安装
npx -y @smithery/cli@latest install @PV-Bhat/gemsuite-mcp --client claude

选项 2:手动安装

bash 复制代码
# 克隆仓库
git clone https://github.com/PV-Bhat/gemsuite-mcp.git
cd gemsuite-mcp

# 安装依赖
npm install

# 设置您的 Gemini API 密钥
echo "GEMINI_API_KEY=your_api_key_here" > .env

# 构建项目
npm run build

# 启动服务器
npm start

🔑 API 密钥设置

  1. Google AI Studio 获取 Gemini API 密钥
  2. 将其设置为环境变量:
    bash 复制代码
    export GEMINI_API_KEY=your_api_key_here
    或在项目根目录创建 .env 文件:
    复制代码
    GEMINI_API_KEY=your_api_key_here

💎 核心特性

统一文件处理

  • 无缝文件处理:所有工具均支持通过 file_path 参数输入文件
  • 自动格式检测:正确处理各种文件类型并使用适当的 MIME 类型
  • 多模态支持:处理图像、文档、代码文件等
  • 批量处理:支持一次性操作多个文件

智能模型选择

GemSuite MCP 根据以下条件自动选择最适合的 Gemini 模型:

  • 任务类型:搜索、推理、处理或分析
  • 内容类型:文本、代码、图像或文档
  • 复杂度:简单查询 vs 复杂推理
  • 用户偏好:可选的手动覆盖

这种智能确保了最佳性能同时最小化令牌使用。

graph TD A[Task Request] --> B{Task Type} B -->|Search| C[Gemini Flash] B -->|Reasoning| D[Gemini Flash Thinking] B -->|Processing| E[Gemini Flash-Lite] B -->|Analysis| F{File Type} F -->|Image| G[Gemini Flash] F -->|Code| H[Gemini Flash Thinking] F -->|Text| I[Gemini Flash-Lite] C & D & E & G & H & I --> J[Execute Request]

专用工具

工具 目的 模型 使用场景
gem_search 带搜索集成的信息检索 Gemini Flash 事实性问题、当前信息、有依据的回答
gem_reason 带逐步分析的复杂推理 Gemini Flash Thinking 数学、科学、编程问题、逻辑分析
gem_process 快速高效的内容处理 Gemini Flash-Lite 摘要、提取、高容量操作
gem_analyze 带自动模型选择的智能文件分析 自动选择 文档分析、代码审查、图像理解

强大的错误处理

  • 指数退避:优雅处理 API 速率限制
  • 全面错误检测:清晰识别错误来源
  • 可操作消息:详细错误信息以便于排错
  • 恢复机制:当主要方法失败时智能回退

🖥️ 使用

在 Claude 或其他 MCP 兼容主机中

当使用 GemSuite MCP 与 Claude 或其他 MCP 兼容主机时,工具将直接出现在助手的工具包中。只需调用适合您需求的工具即可:

工具选择指南

  • gem_search:需要搜索集成的事实性问题
  • gem_reason:需要逐步推理的复杂问题
  • gem_process:高效处理文本或文件(最节省令牌)
  • gem_analyze:带自动模型选择的文件详细分析

📚 使用示例

image

处理文件(最节省令牌)

javascript 复制代码
// 摘要大文档
const response = await gem_process({
  file_path: "/path/to/your/large_document.pdf",
  operation: "summarize"
});

// 提取特定信息
const response = await gem_process({
  file_path: "/path/to/your/report.docx",
  operation: "extract",
  content: "Extract all financial data and metrics from this document."
});

分析文件

javascript 复制代码
// 分析图像
const response = await gem_analyze({
  file_path: "/path/to/your/image.jpg",
  instruction: "Describe what you see in this image in detail."
});

// 分析代码
const response = await gem_analyze({
  file_path: "/path/to/your/code.py",
  instruction: "Identify potential bugs and suggest optimizations."
});

复杂推理

javascript 复制代码
// 使用逐步推理解决复杂问题
const response = await gem_reason({
  problem: "Analyze this code and suggest improvements:",
  file_path: "/path/to/your/code.js",
  show_steps: true
});

// 数学问题求解
const response = await gem_reason({
  problem: "Solve this differential equation: dy/dx = 2xy with y(0) = 1",
  show_steps: true
});

带文件搜索

javascript 复制代码
// 回答有关文档的问题并集成搜索
const response = await gem_search({
  query: "What companies are mentioned in this document?",
  file_path: "/path/to/your/document.pdf"
});

// 带搜索的事实性问题
const response = await gem_search({
  query: "What are the latest developments in quantum computing?",
  enable_thinking: true
});

🧠 模型特性

GemSuite MCP 利用三种主要的 Gemini 模型,智能选择每个任务的最佳模型:

Gemini 2.0 Flash

  • 1M token 上下文窗口:处理大量内容
  • 搜索集成:基于当前信息生成回答
  • 多模态能力:处理文本、图像等
  • 平衡性能:质量和速度的良好结合

Gemini 2.0 Flash-Lite

  • 最经济实惠:最小化令牌使用
  • 最快响应时间:适合高容量操作
  • 文本聚焦:优化文本处理
  • 效率最佳:无需搜索和推理时的理想选择

Gemini 2.0 Flash Thinking

  • 增强推理:逻辑分析和问题解决
  • 逐步分析:显示推理过程
  • 专业化能力:擅长复杂计算
  • 深度最佳:需要彻底分析时的理想选择

🔄 工作流示例

文档分析工作流

javascript 复制代码
// 1. 获取高层次摘要(最高效)
const summary = await gem_process({
  file_path: "/path/to/large_document.pdf",
  operation: "summarize"
});

// 2. 提取特定信息
const keyPoints = await gem_process({
  file_path: "/path/to/large_document.pdf",
  operation: "extract",
  content: "Extract the key findings and recommendations"
});

// 3. 带搜索集成回答具体问题
const answers = await gem_search({
  query: "Based on this document, what are the implications for market growth?",
  file_path: "/path/to/large_document.pdf"
});

// 4. Claude 合成处理后的信息
// 这种方法比让 Claude 直接处理整个文档要节省更多令牌

代码审查工作流

javascript 复制代码
// 1. 获取代码概述
const overview = await gem_analyze({
  file_path: "/path/to/code.js",
  instruction: "Provide an overview of this code's structure and purpose"
});

// 2. 识别潜在问题
const issues = await gem_reason({
  problem: "Analyze this code for bugs, security vulnerabilities, and performance issues",
  file_path: "/path/to/code.js",
  show_steps: true
});

// 3. 生成改进建议
const improvements = await gem_reason({
  problem: "Suggest specific improvements to make this code more efficient and maintainable",
  file_path: "/path/to/code.js",
  show_steps: true
});

// 4. Claude 提供全面的代码审查合成

🧩 与其他 MCP 主机的集成

GemSuite MCP 可与任何 MCP 兼容主机配合使用:

  • Claude Desktop:与 Claude 强大的推理能力无缝集成
  • Cursor IDE:借助 Gemini 的能力增强编码辅助
  • Replit:直接在开发环境中进行代码生成和分析
  • 其他 MCP 主机:与实现 MCP 标准的任何平台兼容

🛠️ 高级配置

自定义模型选择

可以通过指定 model_id 参数覆盖自动模型选择:

javascript 复制代码
// 强制在处理任务中使用 Gemini Flash Thinking
const response = await gem_process({
  file_path: "/path/to/document.pdf",
  operation: "analyze",
  model_id: "models/gemini-2.0-flash-thinking"
});

gem_process 的可用操作

  • summarize:生成简洁摘要
  • extract:提取特定信息
  • restructure:重组内容为更有用的格式
  • simplify:使复杂内容更容易理解
  • expand:为内容添加细节或上下文
  • critique:提供批判性分析
  • feedback:提供建设性反馈
  • analyze:内容的一般分析

🔧 贡献

欢迎贡献!以下是开始的方法:

  1. 叉仓库
  2. 创建功能分支:git checkout -b feature/my-new-feature
  3. 做出更改
  4. 运行测试:npm test
  5. 提交更改:git commit -m 'Add my new feature'
  6. 推送到分支:git push origin feature/my-new-feature
  7. 提交拉取请求

对于重大更改,请先打开一个 issue 讨论您想更改的内容。

📜 许可证

本项目采用 MIT 许可证,详情请参阅 LICENSE 文件。

🙏 致谢

🔗 链接


PV-Bhat ❤️ 制作