Monorail MCP Server & Dashboard
A self-hosted Model Context Protocol (MCP) server for Monorail’s on-chain quote & trade APIs, plus a Streamlit dashboard to visualize and track failed trades in real time.
🚀 Features
- /quote: Fetch swap quotes across 11 exchanges (7k+ tokens).
- /trade/{token_pair}: Request ready-to-send transaction data.
- Automatic retries & failure capture:
- Failed calls get logged to SQLite.
- Slack alerts on each failure.
- Webhook callbacks support custom listeners.
- /failed-trades: Browse persisted failures via API.
- Streamlit Dashboard:
- Bar chart of failures by token pair
- Detailed trade-by-trade view
🛠️ Tech Stack
- FastAPI — MCP server
- Pydantic — request validation
- HTTPX — async HTTP client with retry logic
- SQLModel (SQLite) — lightweight persistence
- Slack SDK — real-time alerts
- Streamlit — dashboard UI
- Docker & Docker Compose — containerized deployment
- Railway.app — hosting
📦 Getting Started
- Clone & configure
git clone https://github.com/life-agrees/monorail-mcp-py cd monorail-mcp-py cp .env.example .env # Edit .env with your BASE_URL, SLACK_BOT_TOKEN, SLACK_CHANNEL… - Build & run API
docker build -t monorail-app . docker run -d -p 8000:8000 --env-file .env monorail-app - Build & run Dashboard
docker build -f Dockerfile.dashboard -t monorail-dashboard . docker run -d -p 8501:8501 monorail-dashboard - Visit API docs: http://localhost:8000/docs Dashboard: http://localhost:8501
☁️ Deploy
- Pushed to Docker Hub
docker tag monorail-app lifeagrees/monorail-app:latest docker push lifeagrees/monorail-app:latest - Deployed on Railway API:https://monorail-mcp-py-production.up.railway.app/docs DASHBOARD:https://monorail-mcp-py-production-ffd0.up.railway.app
What This Solves
- Speeds up AI agents’ access to aggregated on-chain swap quotes & trades
- Reliability: automatic retry/catch + failure logging & alerting
- Visibility: real-time dashboard & API for audit & debugging
