eRegulations MCP 服务器
一种模型上下文协议服务器的实现,它提供了结构化的、适合AI的对eRegulations数据的访问方式,从而使AI模型更容易回答用户关于行政程序的问题。
MCP 服务配置
复制以下 JSON 到 OPClaw 或其他 MCP 客户端的配置文件中即可使用
{
"mcpServers": {
"eregulations": {
"args": [
"run",
"-i",
"--rm",
"-e",
"EREGULATIONS_API_URL",
"ghcr.io/unctad-ai/eregulations-mcp-server:latest"
],
"command": "docker",
"env": {
"EREGULATIONS_API_URL": "https://your-eregulations-api.com"
}
}
}
}
该服务需要配置环境变量:EREGULATIONS_API_URL、PORT
服务介绍
eRegulations MCP 服务器
这是一个用于访问 eRegulations API 数据的 Model Context Protocol (MCP) 服务器实现。该服务器提供了结构化、对 AI 友好的访问方式,以便更容易地让 AI 模型回答用户关于行政程序的问题。
特性
- 通过标准化协议访问 eRegulations 数据
- 查询程序、步骤、要求和成本
- MCP 提示模板以指导 LLM 工具使用
- 使用标准 I/O 连接简化实现
安装
# Clone the repository
git clone https://github.com/benmoumen/eregulations-mcp-server.git
cd eregulations-mcp-server
# Install dependencies
npm install
# Build the project
npm run build
配置
可以通过命令行参数(首选)或环境变量来配置服务器:
命令行参数(首选)
--api-url:要连接的 eRegulations API 的 URL--help:显示所有可用的命令行选项
环境变量
EREGULATIONS_API_URL:要连接的 eRegulations API 的 URL(如果未提供 --api-url,则作为备用)
注意:命令行参数优先于环境变量。
使用方法
使用标准 I/O
对于支持通过标准 I/O 进行 MCP 的 LLM 系统:
# Using command-line argument (preferred)
node dist/index.js --api-url https://example.com/api
# Using environment variable
EREGULATIONS_API_URL=https://example.com/api node dist/index.js
Docker 部署
可以使用 Docker 部署 MCP 服务器。创建一个 docker-compose.yml 文件:
version: '3.8'
services:
eregulations-mcp-server:
build: .
command: ["--api-url", "https://example.com/api"] # Command-line args (preferred)
# environment: # Alternative: environment variable
# - EREGULATIONS_API_URL=https://example.com/api
然后运行:
# Build and start the containers
docker-compose up -d
# To stop the containers
docker-compose down
可用工具
MCP 服务器提供以下工具:
listProcedures
列出 eRegulations 系统中的所有可用程序。
getProcedureDetails
通过 ID 获取特定程序的详细信息。
参数:
procedureId:要检索的程序的 ID
getProcedureStep
获取程序中特定步骤的信息。
参数:
procedureId:程序的 IDstepId:程序内的步骤 ID
提示模板
服务器提供提示模板,以指导 LLM 正确使用可用工具。这些模板解释了每个工具的正确格式和参数。支持 MCP 提示模板功能的 LLM 客户端将自动接收这些模板,以提高它们与 API 协作的能力。
开发
# Run in development mode
npm run start
# Run tests
npm test
# Run tests with watch mode
npm run test:watch
# Run test client
npm run test-client
日志
MCP 服务器将所有控制台输出重定向到 TCP 套接字,以避免干扰需要在 stdout 上进行干净 JSON 通信的 MCP 协议。
要查看日志:
-
在单独的终端中启动日志服务器:
npm run logs -
然后使用 MCP 检查器或直接运行 MCP 服务器:
npm run mcp-inspector # 或者 npm run start
所有日志将在日志服务器终端窗口中出现,而不是在 stdout/stderr 中。
许可证
MIT