Grugenerator MCP服务器
  ](https://nodejs.org)
A. 模型上下文协议(MCP) 该服务器使人工智能助手可以直接访问来自德国和奥地利的绿党政治项目。
目录
演示
*即将推出:搜索功能演示*
特性
- 混合搜索 -将向量和文本搜索与RRF融合相结合
- 德语优化 -Umlaut处理→ae, ö→oe等)和查询变体
- 质量评分 -按文件质量加权的结果
- 语义缓存 -快速响应重复查询
- 元数据筛选 -按文档类型、章节、类别等进行筛选。
- 筛选器发现 -搜索前查询可用的筛选值
- MCP资源 -直接访问收集信息和人工智能指导
可用文档集合
| 集合 | 描述 | 筛选器 |
|---|---|---|
oesterreich | 奥地利绿党:欧盟选举、基本纲领、国民议会 | title |
deutschland | Bündnis 90/Die Grünen:基本计划、欧盟选举、政府计划 | title |
bundestagsfraktion | 绿色议会小组:立场和专家内容 | section |
gruene-de | gruene.de网站:立场、主题和新闻 | section |
gruene-at | gruene.at网站:立场、话题和新闻 | section |
kommunalwiki | KommunalWiki:市政政治知识(海因里希·伯尔基金会) | article_type, category |
boell-stiftung | 海因里希-伯尔基金会:分析、档案和地图集 | content_type, topic, region |
先决条件
在开始之前,请确保您已经:
安装
使用Docker(推荐)
# Build image
docker build -t gruenerator-mcp .
# Run container
docker run -d \
--name gruenerator-mcp \
-p 3000:3000 \
-e QDRANT_URL=https://your-qdrant.com \
-e QDRANT_API_KEY=your-api-key \
-e MISTRAL_API_KEY=your-mistral-key \
gruenerator-mcp本地开发
# Clone repository
git clone https://github.com/Movm/Gruenerator-MCP.git
cd Gruenerator-MCP
# Install dependencies
npm install
# Set environment variables
cp .env.example .env
# Edit .env with your credentials
# Start server
npm start
# Or with auto-reload
npm run dev使用Coolify
- 创建一个新项目
- 连接Git仓库:
https://github.com/Movm/Gruenerator-MCP - 设置环境变量(见下文)
- 部署
配置
环境变量
| 变量 | 描述 | 必填 |
|---|---|---|
QDRANT_URL | Qdrant实例的URL | 是 |
QDRANT_API_KEY | Qdrant的API密钥 | 是 |
MISTRAL_API_KEY | 用于Mistral嵌入的API密钥 | 是 |
PORT | 服务器端口 | 否(默认值:3000) |
PUBLIC_URL | 配置生成的公共URL | 否 |
LOG_LEVEL | 日志级别:调试、信息、警告、错误 | 否(默认值:信息) |
MCP客户端设置
光标/克劳德桌面
添加到MCP配置中:
{
"mcpServers": {
"gruenerator": {
"url": "http://localhost:3000/mcp"
}
}
}配置后,您可以提出以下问题:
- “在奥地利绿色计划中搜索气候政策”
- “德国绿色基本计划对能源转型有何看法?”
- “在KommunalWiki中查找有关废物管理的市政政治指导”
- “联邦议会对可再生能源的立场是什么?”
- “搜索波尔基金会,了解女权主义和性别平等分析”
API 参考
端点
| 端点 | 方法 | 描述 |
|---|---|---|
/mcp | POST | MCP通信 |
/mcp | GET | SSE流 |
/mcp | DELETE | 结束会话 |
/health | GET | 使用缓存和请求统计信息进行健康检查 |
/metrics | GET | 详细的服务器指标 |
/.well-known/mcp.json | GET | 自动发现元数据 |
/config/:client | GET | 生成客户端配置 |
/info | GET | 服务器信息 |
健康检查响应
{
"status": "ok",
"service": "gruenerator-mcp",
"version": "1.0.0",
"collections": ["oesterreich", "deutschland", "bundestagsfraktion", "gruene-de", "gruene-at", "kommunalwiki", "boell-stiftung"],
"uptime": { "ms": 3600000, "hours": 1.0 },
"cache": {
"embeddingHitRate": "65%",
"searchHitRate": "42%"
},
"requests": { "total": 150, "searches": 120, "errors": 0 },
"performance": { "avgResponseTimeMs": 250, "cacheHitRate": "65%" }
}指标响应
{
"server": { "name": "gruenerator-mcp", "version": "1.0.0" },
"uptime": { "hours": 1.0 },
"requests": { "total": 150, "searches": 120 },
"breakdown": {
"byCollection": { "deutschland": 40, "oesterreich": 30, "kommunalwiki": 25, "bundestagsfraktion": 20, "gruene-de": 15, "gruene-at": 20 },
"bySearchMode": { "hybrid": 100, "vector": 15, "text": 5 }
},
"cache": {
"embeddings": { "entries": 50, "hitRate": "65%" },
"search": { "entries": 30, "hitRate": "42%" }
},
"memory": { "heapUsedMB": 45, "rssMB": 120 }
}MCP工具和资源
工具
gruenerator_search
使用混合、矢量或文本搜索搜索派对节目和内容。
参数:
| 参数 | 类型 | 描述 | 默认值 |
|---|---|---|---|
query | string | 搜索词或问题 | 必填 |
collection | string | 要搜索的集合(见上表) | 必填 |
searchMode | 字符串 | hybrid, vector,或 text | hybrid |
limit | number | 最大结果数(1-20) | 5 |
filters | object | 元数据筛选器(见下文) | 可选 |
useCache | boolean | 使用缓存 | true |
按系列列出的可用筛选器:
| 筛选器 | 集合 | 描述 |
|---|---|---|
documentType | 德国 | Document type (原则计划、选举计划、欧盟选举计划) |
title | 德国奥斯特雷奇 | 确切的文件标题 |
section | bundestagsfraktion、gruene de、gruene-at | 内容部分(位置、主题等) |
article_type 文章类型(文学、实践帮助、页面等) | ||
category | 社区维基 | 主题类别 (预算、环境等) |
content_type | 博尔基金会 | Content type (文章, 档案, 地图集, 重点) |
topic 主题(气候、女权主义、移民、数字化等) | ||
region | 博尔基金会 | 地理区域(非洲,欧洲,亚洲,拉丁美洲等) |
例子:
{
"query": "climate protection and renewable energy",
"collection": "kommunalwiki",
"searchMode": "hybrid",
"limit": 5,
"filters": { "article_type": "praxishilfe", "category": "Umwelt" }
}gruenerator_get_filters
查找集合的可用筛选器值。在筛选之前使用此选项以了解有效值。
参数:
| 参数 | 类型 | 描述 | 默认值 |
|---|---|---|---|
collection | string | 要获取筛选条件的集合 | 必需 |
示例响应:
{
"collection": "KommunalWiki",
"collectionId": "kommunalwiki",
"description": "Municipal politics knowledge (Heinrich Böll Foundation)",
"filters": {
"article_type": {
"label": "Article Type",
"type": "keyword",
"values": ["literatur", "praxishilfe", "faq", "sachgebiet"],
"count": 4
},
"category": {
"label": "Category",
"type": "keyword",
"values": ["Haushalt", "Umwelt", "Verkehr", "..."],
"count": 25
}
}
}gruenerator_cache_stats
显示嵌入和搜索结果的缓存统计信息。
参数: 无
示例响应:
{
"embeddings": { "entries": 50, "hits": 120, "misses": 30, "hitRate": "80%" },
"search": { "entries": 30, "hits": 80, "misses": 40, "hitRate": "67%" }
}get_client_config
为各种客户端生成即用型MCP配置。
参数:
client(字符串,必填)-claude,cursor,或vscode
资源
服务器通过MCP协议提供以下资源:
| URI | 描述 |
|---|---|
gruenerator://system-prompt | 先读! AI助手使用说明 |
gruenerator://info | 服务器信息和功能 |
gruenerator://collections | 所有可用收藏列表 |
gruenerator://collections/{key} Details of a specific collection (österreich, deutschland, bundestagsfraktion, gruene-de, gruene-at, kommunalwiki, boell-stiftung) |
搜索模式
混合动力(默认)
将向量和文本搜索与交互秩融合(RRF)相结合。大多数查询的最佳结果。
矢量
基于嵌入的纯语义搜索。适合概念性问题。
文本
具有德语优化的经典文本搜索。适合精确的术语或名称。
贡献
欢迎投稿!以下是您可以提供帮助的方式:
请确保您的PR:
- 通过CI检查
- 遵循现有代码样式
- 包括适当的文档更新
致谢
- 模型上下文协议 -为该服务器供电的协议
- Qdrant -用于语义搜索的矢量数据库
- 米斯特拉尔AI -嵌入生成
- 绿色奥地利 & 联盟90/绿党 -源文件
- 联邦 绿党 -议会小组内容
- Heinrich-Böll 基金会 -政治分析、档案和地图集
- Heinrich-Böll-Stiftung 社区维基 -市政政治知识库
许可证
MIT许可证-请参阅 许可证
