mcp-emtrafesa

georgegiosue/mcp-emtrafesa

3.3

If you are the rightful owner of mcp-emtrafesa and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to dayong@mcphub.com.

MCP Emtrafesa is a Model Context Protocol server that provides AI assistants with seamless access to Peru's Emtrafesa bus transportation system.

Tools
5
Resources
0
Prompts
0

MCP Logo MCP Emtrafesa

A Model Context Protocol (MCP) server for accessing Emtrafesa bus transportation services in Peru

NPM Version TypeScript Bun MCP License: MIT

  • English: (You are here)
  • Español:

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: Use directly with npx (Recommended)

Add to your MCP client configuration:

{
  "mcpServers": {
    "mcp-emtrafesa": {
      "command": "npx",
      "args": ["mcp-emtrafesa@latest"]
    }
  }
}

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

# Start the MCP server
bun run index.ts

Tip: Use the MCP Inspector for debugging: bunx @modelcontextprotocol/inspector bun index.ts


Available Tools

ToolDescriptionParameters
get-terminalsGet all bus terminals in PeruNone
get-arrival-terminalGet destination terminals for a given origindepartureTerminalId
get-departure-schedulesGet schedules between two terminalsdepartureTerminalId, arrivalTerminalId, date?
get-latest-purchased-ticketsSearch your purchased ticketsDNI, email
get-ticket-pdfDownload your ticket as a PDF fileticketCode
get-frequently-asked-questionsGet FAQs about the serviceNone

Usage Examples

Get all terminals

const terminals = await client.callTool("get-terminals");

Find schedules from Chiclayo to Trujillo

const schedules = await client.callTool("get-departure-schedules", {
  departureTerminalId: "002",
  arrivalTerminalId: "001",
  date: "14/07/2025", // DD/MM/YYYY format
});

Look up your purchased tickets

const tickets = await client.callTool("get-latest-purchased-tickets", {
  DNI: "12345678",
  email: "user@example.com",
});

Download your ticket as PDF

const pdf = await client.callTool("get-ticket-pdf", {
  ticketCode: "BP01-123456",
});
// Returns a base64-encoded PDF that can be saved or displayed

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/                # Domain layer
│   │   ├── models/            # Domain models
│   │   └── ports/             # Repository interfaces
│   ├── infrastructure/        # Infrastructure layer
│   │   ├── http/              # HTTP repository implementations
│   │   └── mcp/               # MCP server tools
│   ├── 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

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/new-feature)
  3. Format your code (bun run format)
  4. Commit your changes
  5. Open a Pull Request

License

MIT License - see for details.


Acknowledgments


Support