Diavgeia MCP服务器
这是一个模型上下文协议(MCP)服务器实现,用于 API它允许人工智能助手和其他MCP客户端与希腊透明度计划(Diavgeia)进行交互,以搜索决策并检索决策细节。
特性
- MCP服务器:使用官方Node.js SDK实现模型上下文协议。
- Diavgeia API集成:提供8种工具与希腊透明计划API交互:
- 使用高级过滤器进行搜索决策 - 检索决策详细信息和版本历史记录 - 列出和查询组织 - 访问决策类型和字典
- HTTP传输:使用StreamableHTTPServerTransport进行无状态通信。
- TypeScript:使用TypeScript构建,以实现类型安全性和可维护性。
- 日志记录:与Winston集成日志记录(多级)。
- 测试:使用Vitest和Zod进行全面的单元和集成测试。
- 基于标头的身份验证:通过接受凭据
x-diavgeia-username和x-diavgeia-passwordheaders(待实现)。
先决条件
- Node.js(建议使用v18或更高版本)
- pnpm
安装
- 克隆存储库:
git clone
cd diavgeia-mcp- 安装依赖项:
pnpm install配置
创建一个 .env 根目录中的文件来配置服务器。您可以使用提供的示例或添加自己的变量:
PORT=3000
LOG_LEVEL=info
# Rate limiting: requests per second to Diavgeia API (default: 1)
DIAVGEIA_RATE_LIMIT=1
# Optional: Diavgeia API Credentials (if needed for higher rate limits or specific access)
DIAVGEIA_USERNAME=your_username
DIAVGEIA_PASSWORD=your_password用法
建设项目
要构建TypeScript项目:
pnpm build运行服务器
要启动服务器,请执行以下操作:
pnpm start对于自动重新加载的开发:
pnpm dev服务器将从端口3000(或中指定的端口)启动 .env)并监听MCP请求 /mcp 终点。
连接MCP客户端
配置您的MCP客户端以向以下对象发送POST请求:
- 统一资源定位符:
http://localhost:3000/mcp
身份验证(可选): 您可以通过自定义标头传递Diavgeia凭据:
x-diavgeia-username:您的Diavgeia用户名x-diavgeia-password:您的Diavgeia密码
备注:已配置基于标头的身份验证,但尚未在工具调用中实现。目前,所有工具都可以在没有对公共数据进行身份验证的情况下工作。
LLM提示示例
以下是一些示例提示,您可以使用连接到此MCP服务器的AI助手来探索希腊政府的透明度数据:
基本搜索示例
1.搜索市政当局最近的决定:
Find all published decisions from the Municipality of Athens (Δήμος Αθηναίων) from the last 30 days2.搜索与预算有关的决定:
Search for budget commitment decisions (type Β.1.3) from any ministry in October 20253.按关键字搜索:
Find all decisions related to "προμήθεια" (procurement) from September 2025组织发现
4.列出政府机构:
Show me all active municipalities in Greece5.获取组织详细信息:
What are the details of organization with UID 99206? Include their full name, status, and website6.列出不同的组织类型:
What categories of organizations are available in Diavgeia? List them with examples决策分析
7.获取决策细节:
Get the full details of decision with ADA ΨΧΦΘ46ΜΠ3Ζ-975. What is it about and who signed it?8.跟踪决策变更:
Show me the version history of decision ΒΛΕΖΝ-Ρ7Ν. When was it modified and what changed?9.分析决策类型:
What are the main categories of decisions in Diavgeia? Group them by their parent categories高级查询
10.交叉引用决定:
Find all decisions from the Ministry of Education in 2025 related to appointments (τύπος Γ.3.1)11.监督具体组织:
Track all decisions published by organization 50894 in the last week. Summarize the types of decisions they made12.词典探索:
What procurement vocabularies (CPV codes) are available? Show me the ones related to construction研究和透明度用例
13.预算跟踪:
Find all budget approval decisions from regional authorities in Q1 2025. What's the total amount committed?14.人员监控:
Show me all hiring and personnel change decisions from universities in 202515.采购监督:
Find procurement award decisions (type Δ.1) over 100,000 EUR from the last 6 months16.时间分析:
Compare the number of decisions published by municipalities in January vs February 2025. Which were most active?多步骤工作流
17.组织+决策:
First, find the UID for the Municipality of Thessaloniki. Then search for all their decisions from November 202518.类型发现+搜索:
List all decision types related to contracts (συμβάσεις). Then find examples of each type from the last month19.字典+过滤:
Get the ORG_CATEGORY dictionary values. Then list all organizations in the "REGION" category20.综合报告:
Create a transparency report for organization 30 (Ministry of Interior):
1. Get their details
2. Find their decisions from the last 3 months
3. Categorize by decision type
4. Highlight any revoked decisions这些提示展示了MCP服务器通过自然语言交互搜索、分析和监控希腊政府透明度数据的能力。
可用工具
search_decisions
根据各种标准在Diavgeia中搜索决策。
论据:
query(字符串,可选):通用搜索词。org(字符串,可选):组织ID或拉丁名称。type(字符串,可选):决策类型ID。from_date(字符串,可选):起始日期(YYYY-MM-DD)。to_date(字符串,可选):截止日期(YYYY-MM-DD)。status(枚举,可选):决策状态(published,revoked,pending_revocation,all).违约:published.page(数字,可选):页码(从0开始)。默认值:0。size(数字,可选):页面大小。默认值:20。sort(枚举,可选):排序顺序(recent,relative).违约:recent.
get_decision_details
使用ADA(互联网上传号码)获取有关特定决策的详细信息。
论据:
ada(string,必填):决定的ADA。
get_organizations
从Diavgeia获取组织列表。
论据:
status(枚举,可选):组织状态(active,inactive,pending).违约:active.category(字符串,可选):ORG_category字典中的组织类别代码。
get_decision_types
获取所有可用决策类型的列表。
论据: 没有。
get_organization_details
通过UID获取特定组织的详细信息。
论据:
uid(string,必填):组织的唯一标识符。
get_decision_history
通过ADA获取决策的版本历史。
论据:
ada(string,必填):决定的ADA。
get_dictionaries
获取所有可用词典的列表(例如,ORG_CATEGORY、CPV、CURRENCY)。
论据: 没有。
get_dictionary_values
通过UID获取特定字典的值。
论据:
uid(string,必填):字典的唯一标识符(例如。,ORG_CATEGORY,CPV).
发展
测试
使用Vitest运行单元测试:
pnpm test项目结构
src/:源代码
- tools/:MCP工具实现 - utils/:实用程序函数(API客户端、记录器) - types/:TypeScript类型定义 - index.ts:主服务器入口点
tests/:单元测试docs/:文件
许可证
ISC
