DEV Community

Daniel Ioni
Daniel Ioni

Posted on

MCP Server Implementation: What We Built and How We Monitor It

MCP Server Implementation: What We Built and How We Monitor It

The Model Context Protocol (MCP) is the new standard for AI agents to interact with tools and data. Here's what we implemented on MyZubster Gateway.


🧠 What is an MCP Server?

An MCP Server exposes:

  • Tools: Executable functions (e.g., /api/robot/assign)
  • Resources: Accessible data (e.g., /api/tokens/balance/:userId)
  • Prompts: Interaction templates for AI agents

Our gateway acts as a fully functional MCP server, serving both human users and AI agents.


🛠️ What We Implemented

1. Core Infrastructure

Component Implementation
Server Node.js + Express
Process Manager PM2 with auto-restart
Reverse Proxy NGINX + SSL (Let's Encrypt)
Domain api.myzubster.com
Monitoring Sentry for errors and performance

2. Tools (Endpoints)

Tool Method Description
/api/health GET Gateway health check
/api/robot/assign GET Assign robots to tasks
/api/tokens/balance/:userId GET Get token balances
/api/notifications GET Get user notifications
/api/messages GET Get user messages
/api/test-error GET Test Sentry error tracking

3. Monitoring with Sentry

We integrated Sentry for comprehensive monitoring:


javascript
const Sentry = require('@sentry/node');

Sentry.init({
  dsn: process.env.SENTRY_DSN,
  environment: process.env.NODE_ENV,
  tracesSampleRate: 0.1, // 10% in production
});

// Every request is traced
app.use(Sentry.Handlers.requestHandler());

// Every route has error capture
app.get("/api/robot/assign", (req, res) => {
  try {
    // Business logic
  } catch (error) {
    Sentry.captureException(error);
    res.status(500).json({ error: error.message });
  }
});

// Error handler
app.use(Sentry.Handlers.errorHandler());

What we monitor:

    Client tracking: Who calls which tools

    Performance: Response times per endpoint

    Errors: Even silent JSON-RPC errors

    Usage: Tool popularity and patterns

📊 Live Example Responses
Health Check
json

{
  "status": "online",
  "version": "1.0.0",
  "timestamp": "2026-08-09T05:32:56.502Z",
  "uptime": 16.47
}

Robot Assignment
json

{
  "message": "Robot assign endpoint",
  "status": "ok"
}

Token Balance
json

{
  "userId": "test-user",
  "balances": {
    "MYZ": 1250.5,
    "XMR": 0.75,
    "BTC": 0.012,
    "ETH": 0.45,
    "ADA": 125
  },
  "totalUSD": 1450.75,
  "totalSGD": 1950.5,
  "timestamp": "2026-08-09T05:33:56.754Z"
}

Test Error (Sentry)
json

{
  "error": "Test error captured by Sentry",
  "message": "Test error for Sentry monitoring"
}

🔍 Why MCP Matters
Before MCP

    ❌ No standard protocol for AI agents

    ❌ Every integration was custom

    ❌ Hard to monitor usage

    ❌ Difficult to debug errors

After MCP

    ✅ Standardized AI-agent communication

    ✅ Consistent tool exposure

    ✅ Built-in monitoring

    ✅ Better debugging with context

🏗️ Architecture Overview
text

┌─────────────────┐
│   AI Agents     │
│  (Claude, etc)  │
└────────┬────────┘
         │ MCP Protocol
┌────────▼────────┐
│  api.myzubster  │
│  .com:443       │
└────────┬────────┘
         │ HTTP/HTTPS
┌────────▼────────┐
│   NGINX Proxy   │
│   SSL/Reverse   │
└────────┬────────┘
         │ Localhost:5002
┌────────▼────────┐
│  Node.js + PM2  │
│  MCP Server     │
└────────┬────────┘
         │
┌────────▼────────┐
│    Sentry       │
│   Monitoring    │
└─────────────────┘

🚀 What's Coming Next
Feature Status  ETA
IoT Sensors 🔄 In progress    2026-08
Fiat Payments   🔄 In progress    2026-08
Multi-currency Crypto   🔄 In progress    2026-08
BENZINA-XMR Wallet  🔄 In progress    2026-08
Mobile App  📅 Planned    2026-09
Smart Contracts 📅 Planned    2026-09
💡 Lessons Learned

    Start with monitoring — You can't fix what you can't see

    Silent errors are dangerous — Capture everything

    Performance matters — Slow tools hurt AI agents

    Documentation is key — Both for humans and AI

🤝 How to Contribute

We're building the future of AI-agent infrastructure. Join us!

    Explore issues → GitHub

    Comment /claim → Take a bounty

    Build and PR → Get paid in MYZ

Current bounties available: 50-900 MYZ
🔗 Links

    🌐 Live API: api.myzubster.com

    🐙 GitHub: MyZubster-Ecosystem

    📖 Docs: docs.myzubster.com

    💬 Discord: discord.gg/myzubster

The MCP server is live. The ecosystem is growing. Join us in building the future of AI-agent infrastructure. 🚀

#MCP #Server #Sentry #Monitoring #MyZubster #OpenSource #Web3 #AI
Enter fullscreen mode Exit fullscreen mode

Top comments (0)