MCP Emtrafesa
用于访问秘鲁Emtrafesa公交服务的模型上下文协议(MCP)服务器
  ](https://www.npmjs.com/package/mcp-emtrafesa)    
- 英语: README.md (你在这里)
- 西班牙语: README.es.md
MCP Emtrafesa 是一个模型上下文协议服务器,为AI助手提供对秘鲁Emtrafesa公交系统的无缝访问。通过标准化的MCP工具查询终端、日程、票务和常见问题。
______________________________________________________________________
你可以用这个MCP做什么?
- 查找公交总站 秘鲁全境
- 检查时间表 任何两个城市之间
- 查询您购买的门票 使用您的DNI和电子邮件
- 下载PDF格式的门票 用于打印或共享
- 获取答案 常见问题解答
______________________________________________________________________
快速开始
选项1:克劳德桌面(推荐)
打开您的Claude Desktop配置文件:
- macOS:
~/Library/Application Support/Claude/claude_desktop_config.json - 视窗:
%APPDATA%\Claude\claude_desktop_config.json
添加以下条目:
{
"mcpServers": {
"mcp-emtrafesa": {
"command": "npx",
"args": ["mcp-emtrafesa@latest"]
}
}
}重新启动克劳德桌面。当服务器连接时,您将在聊天输入的右下角看到一个MCP指示器。
选项2:克隆并在本地运行
# Clone the repository
git clone https://github.com/georgegiosue/mcp-emtrafesa.git
cd mcp-emtrafesa
# Install dependencies
bun install然后将MCP客户端指向本地服务器:
{
"mcpServers": {
"mcp-emtrafesa": {
"command": "bun",
"args": ["/absolute/path/to/mcp-emtrafesa/src/index.ts"]
}
}
}提示: 使用MCP检查器进行调试: bunx @modelcontextprotocol/inspector bun src/index.ts______________________________________________________________________
可用工具
| 工具 | 说明 | 参数 |
|---|---|---|
get-terminals | 获取秘鲁的所有公交总站 | 无 |
get-arrival-terminals | 获取给定起点的目的地终端 | departureTerminalId |
get-departure-schedules | 获取两个终端之间的时间表 | departureTerminalId, arrivalTerminalId, date? |
get-latest-purchased-tickets | 搜索您购买的门票 | DNI, email |
get-ticket-pdf | 将您的门票下载为PDF文件 | ticketCode |
get-frequently-asked-questions | 获取有关该服务的常见问题解答 | 无 |
______________________________________________________________________
使用示例
一旦连接,你可以自然地问克劳德:
- *“Emtrafesa有哪些公交总站?”*
- *“2025年7月14日从奇克拉约到特鲁希略有什么时间表?”*
- *“使用DNI 12345678和电子邮件查找我的门票user@example.com"*
- *“下载门票BP01-123456的PDF”*
______________________________________________________________________
需求
- 包子 v1.2.10+或Node.js v18+
- MCP兼容客户端(Claude Desktop等)
______________________________________________________________________
项目结构
mcp-emtrafesa/
├── src/
│ ├── config/ # API configuration
│ ├── domain/
│ │ ├── models/ # Domain model interfaces
│ │ └── ports/ # Repository interface (contract)
│ ├── infrastructure/
│ │ ├── http/ # HTTP repository implementation
│ │ └── mcp/
│ │ └── tools/
│ │ ├── index.ts # Auto-discovers and registers all tools
│ │ ├── tool.ts # Tool interface + register() helper
│ │ ├── error.ts # Shared errorResponse()
│ │ ├── faq/
│ │ │ └── get-frequently-asked-questions/
│ │ │ ├── constants.ts
│ │ │ └── get-frequently-asked-questions.ts
│ │ ├── schedule/
│ │ │ └── get-departure-schedules/
│ │ │ ├── constants.ts
│ │ │ ├── schema.ts
│ │ │ ├── types.ts
│ │ │ └── get-departure-schedules.ts
│ │ ├── terminal/
│ │ │ ├── get-terminals/
│ │ │ │ ├── constants.ts
│ │ │ │ └── get-terminals.ts
│ │ │ └── get-arrival-terminals/
│ │ │ ├── constants.ts
│ │ │ ├── schema.ts
│ │ │ ├── types.ts
│ │ │ └── get-arrival-terminals.ts
│ │ └── ticket/
│ │ ├── get-latest-purchased-tickets/
│ │ │ ├── constants.ts
│ │ │ ├── schema.ts
│ │ │ ├── types.ts
│ │ │ └── get-latest-purchased-tickets.ts
│ │ └── get-ticket-pdf/
│ │ ├── constants.ts
│ │ ├── schema.ts
│ │ ├── types.ts
│ │ └── get-ticket-pdf.ts
│ ├── shared/ # Shared utilities
│ └── index.ts # MCP server entry point
├── package.json
└── tsconfig.json______________________________________________________________________
发展
# Format code
bun run format
# Check formatting
bunx biome check______________________________________________________________________
贡献
- 分叉存储库
- 创建要素分支(
git checkout -b feature/new-feature) - 设置代码格式(
bun run format) - 提交您的更改
- 打开拉取请求
______________________________________________________________________
许可证
MIT许可证-请参阅 许可证 了解详情。
______________________________________________________________________
致谢
______________________________________________________________________
支持
- 电子邮件: peraldonamoc@gmail.com
