Skip to main content
Glama
bradmusolff

FusionReactor MCP Server

by bradmusolff
README.md
# FusionReactor MCP Server

A TypeScript [Model Context Protocol](https://modelcontextprotocol.io/) (MCP) server that exposes **FusionReactor Cloud** monitoring data — metrics, logs, and alerts — as callable tools for AI assistants.

## Features

| Category | Tools | Backend |
|----------|-------|---------|
| **Metrics** | `query_metrics`, `query_metrics_range`, `list_metric_series`, `list_metric_label_names`, `list_metric_label_values` | Prometheus / Mimir API |
| **Logs** | `query_logs`, `query_logs_range`, `list_log_label_names`, `list_log_label_values`, `list_log_series` | Loki API |
| **Alerts** | `list_alert_rules`, `list_alert_rules_by_namespace`, `get_alerts`, `get_alert_groups` | Grafana Alerting API |

## Prerequisites

- **Node.js** ≥ 18
- A **FusionReactor Cloud** account with an API key

## Quick Start

```bash
# 1. Install dependencies
npm install

# 2. Build
npm run build

# 3. Run (requires API key)
FUSIONREACTOR_API_KEY=your-key-here npm start
```

## Environment Variables

| Variable | Required | Description |
|----------|----------|-------------|
| `FUSIONREACTOR_API_KEY` | **Yes** | Your FusionReactor API key |
| `FUSIONREACTOR_API_URL` | No | API base URL. Defaults to `https://api.fusionreactor.io` |

## Using with an MCP Client

Add this server to your MCP client configuration. For example, in **Claude Desktop** or **VS Code**:

```json
{
  "mcpServers": {
    "fusionreactor": {
      "command": "node",
      "args": ["<path-to-project>/dist/index.js"],
      "env": {
        "FUSIONREACTOR_API_KEY": "your-key-here"
      }
    }
  }
}
```

## Development

```bash
# Watch mode — recompiles on file changes
npm run dev

# One-time build
npm run build
```

## Project Structure

```
src/
├── index.ts     # Entry point — bootstraps MCP server with stdio transport
├── client.ts    # FusionReactor HTTP API client (metrics, logs, alerts)
└── tools.ts     # MCP tool definitions wired to the API client
```

## API Endpoints Used

The server communicates with FusionReactor Cloud's Grafana-compatible API:

- **Metrics** — `/g/api/v1/query`, `/g/api/v1/query_range`, `/g/api/v1/series`, `/g/api/v1/labels`, `/g/api/v1/label/{name}/values`
- **Logs** — `/g/loki/api/v1/query`, `/g/loki/api/v1/query_range`, `/g/loki/api/v1/labels`, `/g/loki/api/v1/label/{name}/values`, `/g/loki/api/v1/series`
- **Alerts** — `/g/api/ruler/grafana/api/v1/rules`, `/g/api/alertmanager/grafana/api/v2/alerts`, `/g/api/alertmanager/grafana/api/v2/alerts/groups`

## License

MIT