Skip to main content
Glama
README.md
# mcp-ops-toolkit

> **30-Minute Production Boilerplate for Node.js + TypeScript MCP Servers (stdio + HTTP/SSE)**  
> Connect Claude Code, Cursor, and custom AI agents to external REST/GraphQL metrics APIs, structured Google Sheets / Webhook sinks, and Slack operational alerts — with zero-secret indirection, exponential-backoff retries, SSRF guards, and Docker health checks built in.

[![Node.js >= 20](https://img.shields.io/badge/Node.js-%3E%3D20-339933?style=flat-square&logo=nodedotjs&logoColor=white)](https://nodejs.org/)
[![TypeScript](https://img.shields.io/badge/TypeScript-5.8-3178C6?style=flat-square&logo=typescript&logoColor=white)](https://www.typescriptlang.org/)
[![MCP SDK](https://img.shields.io/badge/MCP_SDK-1.x-111827?style=flat-square)](https://modelcontextprotocol.io/)
[![License: MIT](https://img.shields.io/badge/License-MIT-blue?style=flat-square)](LICENSE)

---

## Architecture

```mermaid
flowchart LR
    Agent["AI Agent<br/>(Claude Code / Cursor / Custom)"]
    Agent -->|"stdio (local) or<br/>Streamable HTTP /mcp &amp; /sse"| Server["mcp-ops-toolkit<br/>(Node.js + TypeScript + Zod)"]

    Server --> T1["Tool 1: fetch_external_api_metrics<br/>REST &amp; GraphQL · Timeout · Backoff · SSRF Guard"]
    Server --> T2["Tool 2: append_structured_sheet_row<br/>Google Sheets API v4 (RS256 JWT) or Webhook"]
    Server --> T3["Tool 3: send_ops_alert<br/>Slack Block Kit · Severity · Dedupe"]

    T1 --> APIs["Financial / Ads / SaaS APIs"]
    T2 --> Sheets["Google Sheets / n8n Webhook"]
    T3 --> Slack["Slack Ops Channel"]
```

### Why This Boilerplate Exists
Most demo MCP servers omit production fundamentals. `mcp-ops-toolkit` ships ready for real operational workflows from minute one:
- **Zero-Secret Context Hygiene:** Agents pass environment variable names (`authEnvVar`, `webhookEnvVar`), never raw API keys.
- **Resilient HTTP Engine:** Native `fetch` with `AbortController` timeouts, exponential backoff + jitter, and `Retry-After` handling on `408`/`429`/`5xx`.
- **SSRF Protection by Default:** Plain HTTP and private/cloud-metadata IP ranges (`169.254.169.254`, RFC1918, loopback) are blocked unless `ALLOW_PRIVATE_NETWORKS=true` is explicitly enabled.
- **Zero-Dependency Google Sheets Auth:** Native `node:crypto` RS256 Service Account JWT signing (no bloated SDKs) plus webhook fallback for `n8n` / Make.
- **Dual Transport + Container Ready:** Runs locally over `stdio` or remotely over **Streamable HTTP (`/mcp`) + SSE (`/sse`)** with `GET /api/health` and optional constant-time Bearer token auth (`MCP_HTTP_AUTH_TOKEN`).

---

## Quick Start (< 2 Minutes)

### 1. Install, Build & Test

```bash
git clone https://github.com/gabrieldave/mcp-ops-toolkit.git
cd mcp-ops-toolkit
cp .env.example .env
npm install
npm run build
npm test
```

### 2. Run in `stdio` Mode (Claude Code / Cursor)

```bash
npm start
```

### 3. Run in HTTP / SSE Mode (Docker / VPS / Remote Agents)

```bash
MCP_TRANSPORT=http PORT=3000 npm start
# Health check:
curl http://localhost:3000/api/health
```

### 4. Run with Docker (Production Multi-Stage Image)

```bash
docker build -t mcp-ops-toolkit .
docker run --rm -p 3000:3000 --env-file .env mcp-ops-toolkit
```

---

## Connecting to Claude Code & Cursor

### Cursor (`.cursor/mcp.json`) or Claude Desktop (`stdio`)

```json
{
  "mcpServers": {
    "mcp-ops-toolkit": {
      "command": "node",
      "args": ["/absolute/path/to/mcp-ops-toolkit/dist/index.js"],
      "env": {
        "METRICS_API_TOKEN": "YOUR_METRICS_TOKEN",
        "OPS_SHEET_WEBHOOK_URL": "https://your-n8n-host/webhook/sheet-sink",
        "SLACK_WEBHOOK_URL": "https://hooks.slack.com/services/T000/B000/XXX"
      }
    }
  }
}
```

### Remote Streamable HTTP Client (`/mcp`)

```json
{
  "mcpServers": {
    "mcp-ops-toolkit-remote": {
      "url": "https://your-mcp-host.example.com/mcp",
      "headers": {
        "Authorization": "Bearer YOUR_MCP_HTTP_AUTH_TOKEN"
      }
    }
  }
}
```

> See [`SKILL.md`](./SKILL.md) for drop-in agent instructions covering dry-run validation, auth indirection, and end-to-end tool chaining.

---

## Tool Reference

| Tool | Purpose | Key Capabilities |
|---|---|---|
| `fetch_external_api_metrics` | Pull metrics from financial, SaaS, or ads APIs | `mode: "rest" \| "graphql"`, `authEnvVar` indirection, `extractPath` dot-notation slicing, timeout + exponential backoff, `dryRun` |
| `append_structured_sheet_row` | Log validated JSON rows from call transcripts or reports | `destination: "google_sheets" \| "webhook"`, deterministic 7-column schema, native RS256 Google JWT auth, `idempotencyKey`, `dryRun` |
| `send_ops_alert` | Dispatch structured incident & KPI alerts to Slack | Slack Block Kit formatting, `severity` (`info`/`success`/`warning`/`critical`), structured metric fields, `actionUrl`, `dedupeKey`, `dryRun` |

---

## Security & Verification

```bash
npm run typecheck    # Strict TypeScript check
npm test             # Unit + live mock HTTP integration tests
npm run secret-scan  # Fails if any credential pattern exists in tracked sources
```

- Built and maintained by **David Del Rio Colin** ([github.com/gabrieldave](https://github.com/gabrieldave))
- Licensed under the [MIT License](./LICENSE).

TDQS

A3.6/5.0

Scored across 3 tools

Disambiguation4/5

Each tool maps to a distinct pipeline stage: fetch (read external metrics), append (persist a row), and alert (notify via Slack). The only mild overlap is that fetch_external_api_metrics and append_structured_sheet_row both touch external systems, but the read-vs-write verbs make selection clear.

Naming Consistency5/5

All three names follow a consistent snake_case verb_noun_object pattern (fetch_/append_/send_ plus a scoped noun). No mixed conventions or casing deviations.

Tool Count3/5

Three tools is thin for a toolkit that spans ingestion, persistence, and alerting; it covers a single happy-path pipeline. Each tool is substantive, but there is little room for reading back or managing configurations.

Completeness4/5

The fetch → append → alert pipeline is closed for the write path, but there is no way to read or update sheet rows, query existing metrics, or manage alert routing. These are minor gaps agents could work around but limit lifecycle coverage.

Maintenance

ActivityMaintained
ResponsivenessNo recent community issues