Emtrafesa
A Model Context Protocol (MCP) server for accessing Emtrafesa bus transportation services in Peru
Ask AI about Emtrafesa
Powered by Claude Β· Grounded in docs
I know everything about Emtrafesa. Ask me about installation, configuration, usage, or troubleshooting.
0/500
Reviews
Documentation
MCP Emtrafesa
A Model Context Protocol (MCP) server for accessing Emtrafesa bus transportation services in Peru
- English: README.md (You are here)
- EspaΓ±ol: README.es.md
MCP Emtrafesa is a Model Context Protocol server that provides AI assistants with seamless access to Peru's Emtrafesa bus transportation system. Query terminals, schedules, tickets, and FAQs through standardized MCP tools.
What can you do with this MCP?
- Find bus terminals across Peru
- Check schedules between any two cities
- Look up your purchased tickets using your DNI and email
- Download your ticket as PDF for printing or sharing
- Get answers to frequently asked questions
Quick Start
Option 1: Claude Desktop (Recommended)
Open your Claude Desktop configuration file:
- macOS:
~/Library/Application Support/Claude/claude_desktop_config.json - Windows:
%APPDATA%\Claude\claude_desktop_config.json
Add the following entry:
{
"mcpServers": {
"mcp-emtrafesa": {
"command": "npx",
"args": ["mcp-emtrafesa@latest"]
}
}
}
Restart Claude Desktop. You'll see an MCP indicator in the bottom-right corner of the chat input when the server is connected.
Option 2: Clone and run locally
# Clone the repository
git clone https://github.com/georgegiosue/mcp-emtrafesa.git
cd mcp-emtrafesa
# Install dependencies
bun install
Then point your MCP client to the local server:
{
"mcpServers": {
"mcp-emtrafesa": {
"command": "bun",
"args": ["/absolute/path/to/mcp-emtrafesa/src/index.ts"]
}
}
}
Tip: Use the MCP Inspector for debugging:
bunx @modelcontextprotocol/inspector bun src/index.ts
Available Tools
| Tool | Description | Parameters |
|---|---|---|
get-terminals | Get all bus terminals in Peru | None |
get-arrival-terminals | Get destination terminals for a given origin | departureTerminalId |
get-departure-schedules | Get schedules between two terminals | departureTerminalId, arrivalTerminalId, date? |
get-latest-purchased-tickets | Search your purchased tickets | DNI, email |
get-ticket-pdf | Download your ticket as a PDF file | ticketCode |
get-frequently-asked-questions | Get FAQs about the service | None |
Usage Examples
Once connected, you can ask Claude naturally:
- "What bus terminals does Emtrafesa have?"
- "What schedules are available from Chiclayo to Trujillo on 14/07/2025?"
- "Look up my tickets with DNI 12345678 and email user@example.com"
- "Download the PDF for ticket BP01-123456"
Requirements
- Bun v1.2.10+ or Node.js v18+
- An MCP-compatible client (Claude Desktop, etc.)
Project Structure
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
Development
# Format code
bun run format
# Check formatting
bunx biome check
Contributing
- Fork the repository
- Create a feature branch (
git checkout -b feature/new-feature) - Format your code (
bun run format) - Commit your changes
- Open a Pull Request
License
MIT License - see LICENSE for details.
Acknowledgments
- Emtrafesa - Transportation API provider
- Model Context Protocol - MCP specification
- @tecncr - API endpoint insights
- Bun - Fast JavaScript runtime
