Gemini每日MCP服务器(压缩)⚡
](https://www.npmjs.com/package/gemini-daily-mcp-compressed) 
用于Google Gemini CLI的令牌优化MCP服务器 随着 43.8%的代币节省 通过渐进式披露策略。
🎯 为什么是压缩版本?
这是一个实验性的令牌优化变体 双子座日报 这通过以下方式减少了工具模式开销 43.8% 同时保持完整的功能。
代币节省比较
| 版本 | 架构大小 | 令牌 | 节省 |
|---|---|---|---|
| 原版 | 1227字节 | 306个令牌 | - |
| 压缩的 ⚡ | 691字节 | 172个令牌 | 43.8% |
影响:
- 每次对话:节省134个代币
- 3000次对话/月:每月节省约1.61美元
- 扩展到50个工具:每月节省约66美元(61%)
💡 工作原理:渐进式披露
传统方法(详细图式)
{
"name": "gemini",
"description": "Execute Gemini CLI in non-interactive mode for AI assistance with high Token efficiency",
"inputSchema": {
"properties": {
"prompt": {
"type": "string",
"description": "The coding task, question, or analysis request"
},
"sessionId": {
"type": "string",
"description": "Optional session ID for conversational context (saves up to 74% tokens in multi-turn conversations)"
}
}
}
}尺寸:731字节≈182个令牌
渐进式披露(压缩模式)
{
"name": "gemini",
"description": "Execute Gemini CLI. Use help for details",
"inputSchema": {
"properties": {
"prompt": {"type": "string"},
"sessionId": {"type": "string"}
}
}
}尺寸:281字节≈70个令牌(节省61.6%)
细节去哪儿了?
他们在增强 帮助 工具!当克劳德需要详细信息时:
# Claude calls: mcp__gemini-daily-compressed__help
# Returns comprehensive documentation:
# Gemini Daily MCP - Detailed Documentation
## gemini Tool
Execute Gemini CLI in non-interactive mode for AI assistance.
**Parameters:**
- prompt (required, string): The coding task, question, or analysis request
- sessionId (optional, string): Session ID for conversational context
- Saves up to 74% tokens in multi-turn conversations
- Obtained from previous gemini call's _meta.sessionId
- resetSession (optional, boolean): Reset session history before processing
- model (optional, string): Specify which Gemini model to use
- Default: gemini-2.5-flash
- Options: gemini-2.5-flash, gemini-2.5-flash-lite, gemini-2.5-pro, gemini-3-pro-preview
**Example:**
{
"prompt": "Write a Python function to calculate fibonacci",
"sessionId": "session-abc123",
"model": "gemini-2.5-flash"
}
...结果:
- ✅ 90%的对话:不需要细节→ 保存代币
- ✅ 10%的对话:呼叫帮助一次→ 获取完整文档
- ✅ 总体而言: 43.8%的代币节省
🚀 特性
功能与原版相同
- ✅ 完整的Gemini CLI集成
- ✅ 会话管理(在多回合对话中最多可节省74%的令牌)
- ✅ Gemini 3支持(双子座-3预审查,带回退)
- ✅ 多种型号选择(Flash、Flash Lite、Pro、Gemini 3)
- ✅ 全面的错误处理
令牌优化
- ⚡ 43.8%更小 工具模式
- ⚡ 通过增强的帮助工具逐步披露
- ⚡ 保留所有类型信息
- ⚡ 维护参数验证
📦 安装
先决条件
- 谷歌Gemini CLI 必须预先安装和配置
- 安装:遵循谷歌官方Gemini CLI安装指南 - 设置:运行 gemini auth login 使用您的Google帐户 - API密钥:设置 GOOGLE_API_KEY 环境变量或通过配置 gemini config
- 克劳德代码 或 克劳德桌面 安装
克劳德代码
# Clone this repository
git clone https://github.com/kdoooh000h/gemini-daily-mcp-compressed.git
cd gemini-daily-mcp-compressed
# Install dependencies
npm install
# Build
npm run build
# Add to Claude Code
# Edit your .mcp.json:
{
"mcpServers": {
"gemini-daily-compressed": {
"command": "node",
"args": ["/path/to/gemini-daily-mcp-compressed/dist/index.js"],
"env": {
"GEMINI_ENABLED": "true",
"SESSION_TTL_HOURS": "24",
"MAX_SESSIONS": "100",
"GEMINI_CLI_COMMAND": "gemini",
"LOG_LEVEL": "info"
}
}
}
}克劳德桌面
macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
窗户: %APPDATA%/Claude/claude_desktop_config.json
{
"mcpServers": {
"gemini-daily-compressed": {
"command": "node",
"args": ["/path/to/gemini-daily-mcp-compressed/dist/index.js"],
"env": {
"GEMINI_ENABLED": "true",
"SESSION_TTL_HOURS": "24",
"GEMINI_CLI_COMMAND": "gemini"
}
}
}
}🔧 工具
gemini -AI编码助手
使用可选会话支持执行Gemini CLI。
基本用法:
Use gemini to explain this Python function高级用法:
# With session for multi-turn conversation
Use gemini with sessionId "my-session" to analyze this code
# Continue conversation
Use gemini with sessionId "my-session" to implement the improvements
# Specify model
Use gemini with model "gemini-3-pro-preview" for complex analysis
# Reset session
Use gemini with sessionId "my-session" and resetSession true to start freshlistSessions -会话管理
列出所有活动的对话会话。
ping -连接测试
测试MCP服务器是否正常工作。
help -增强文档
获取所有工具的详细文档(详细信息位于压缩版本中)。
📊 压缩详细信息
策略
- 删除详细描述 从工具模式
- 保留所有功能:
- 参数名称 - 类型信息 - 必填字段 - 枚举值
- 增强帮助工具 提供完整的文件
代币细分
| 工具 | 原始 | 压缩 | 节省 |
|---|---|---|---|
| 双子座 | 182个代币 | 70个代币 | 61.6% |
| ping | 49个令牌 | 37个令牌 | 24.5% |
| 帮助 | 33个令牌 | 32个令牌 | 3.0% |
| listSessions | 40个令牌 | 33个令牌 | 17.5% |
| 总计 | 306个代币 | 172个代币 | 43.8% |
权衡
优点 ✅:
- 显著的代币节省(43.8%)
- 成本更低(使用50个工具进行3K对话每月66美元)
- 完整功能得以保留
- Claude理解压缩模式
缺点 ⚠️:
- 约10%的对话可能需要额外的帮助电话
- 模式对开发人员可读性较低
- 需要在两个地方维护文档(模式+帮助工具)
📈 何时使用压缩版本?
推荐✅
- 高频使用 (>100次对话/天)
- 许多工具 (MCP设置中有20多个工具)
- 成本敏感项目
- 复杂的工具模式 冗长的描述
请改用原始版本
- 低频使用 (每天少于100次对话)
- 工具很少 (\<10个工具)
- 需要最大的模式可读性
- 偶尔使用
🧪 实验状态
这是一个 实验性的 该项目旨在验证MCP工具模式的渐进式披露方法。
测试结果 (来自lab-02-tested):
- ✅ 所有工具功能正常
- ✅ 帮助工具提供完整的文档
- ✅ Claude理解压缩模式
- ✅ 已确认43.8%的代币节省
- ⚠️ ~10%的场景需要帮助调用(增加1个工具调用)
反馈欢迎:如果您遇到任何问题或有任何建议,请打开问题。
🔗 相关项目
- 原始版本: 双子座日报 -完整的详细架构
- 代币分析:参见 工具-化学-压缩-实验.md
- Gemini CLI: 谷歌Gemini CLI
📚 文档
- MODELS.md:Gemini型号兼容性和选择指南
- CODEX-TO-GEMINI-ADAPTATION.md:这是如何从codex mcp服务器改编而来的
- api参考:使用
helpClaude中的详细文档工具
🛠️ 发展
# Install dependencies
npm install
# Development mode
npm run dev
# Build
npm run build
# Test
npm test
# Lint
npm run lint📝 版本兼容性
此MCP服务器与以下设备兼容:
- Gemini CLI:v0.17.0+(支持Gemini 3)
- 克劳德代码:最新版本
- 克劳德桌面:最新版本
- MCP-SDK:@modelcontextprotocol/sdk^1.17.3
🤝 贡献
这是一个实验项目。欢迎投稿、问题和功能请求!
📄 许可证
ISC
💬 问题?
- 使用帮助工具:
mcp__gemini-daily-compressed__help - 打开一个问题:GitHub问题
- 原始项目: 双子座日报
______________________________________________________________________
⚡ 压缩的。高效。同样的力量。
