airbrake-mcp 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (52) hide show
  1. package/CHANGELOG.md +49 -0
  2. package/LICENSE +21 -0
  3. package/README.md +154 -0
  4. package/dist/bin.d.ts +2 -0
  5. package/dist/bin.js +7 -0
  6. package/dist/bin.js.map +1 -0
  7. package/dist/client/airbrake.d.ts +16 -0
  8. package/dist/client/airbrake.js +120 -0
  9. package/dist/client/airbrake.js.map +1 -0
  10. package/dist/client/errors.d.ts +16 -0
  11. package/dist/client/errors.js +33 -0
  12. package/dist/client/errors.js.map +1 -0
  13. package/dist/client/pagination.d.ts +12 -0
  14. package/dist/client/pagination.js +9 -0
  15. package/dist/client/pagination.js.map +1 -0
  16. package/dist/config.d.ts +8 -0
  17. package/dist/config.js +38 -0
  18. package/dist/config.js.map +1 -0
  19. package/dist/server.d.ts +7 -0
  20. package/dist/server.js +101 -0
  21. package/dist/server.js.map +1 -0
  22. package/dist/tools/deploys.d.ts +45 -0
  23. package/dist/tools/deploys.js +47 -0
  24. package/dist/tools/deploys.js.map +1 -0
  25. package/dist/tools/groups.d.ts +148 -0
  26. package/dist/tools/groups.js +102 -0
  27. package/dist/tools/groups.js.map +1 -0
  28. package/dist/tools/index.d.ts +2 -0
  29. package/dist/tools/index.js +20 -0
  30. package/dist/tools/index.js.map +1 -0
  31. package/dist/tools/notices.d.ts +54 -0
  32. package/dist/tools/notices.js +53 -0
  33. package/dist/tools/notices.js.map +1 -0
  34. package/dist/tools/notify.d.ts +31 -0
  35. package/dist/tools/notify.js +27 -0
  36. package/dist/tools/notify.js.map +1 -0
  37. package/dist/tools/performance.d.ts +92 -0
  38. package/dist/tools/performance.js +60 -0
  39. package/dist/tools/performance.js.map +1 -0
  40. package/dist/tools/projects.d.ts +43 -0
  41. package/dist/tools/projects.js +36 -0
  42. package/dist/tools/projects.js.map +1 -0
  43. package/dist/tools/request.d.ts +26 -0
  44. package/dist/tools/request.js +37 -0
  45. package/dist/tools/request.js.map +1 -0
  46. package/dist/tools/sourcemaps.d.ts +45 -0
  47. package/dist/tools/sourcemaps.js +42 -0
  48. package/dist/tools/sourcemaps.js.map +1 -0
  49. package/dist/tools/types.d.ts +13 -0
  50. package/dist/tools/types.js +2 -0
  51. package/dist/tools/types.js.map +1 -0
  52. package/package.json +69 -0
package/CHANGELOG.md ADDED
@@ -0,0 +1,49 @@
1
+ # Changelog
2
+
3
+ All notable changes to `airbrake-mcp` will be documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
+
8
+ ## [Unreleased]
9
+
10
+ ## [0.1.0] — 2026-05-25
11
+
12
+ Initial public release. Eight resource-grouped tools cover what hosted Airbrake
13
+ actually exposes to Personal API tokens, plus a generic `airbrake_request`
14
+ escape hatch for any endpoint not directly modeled.
15
+
16
+ ### Added
17
+
18
+ - `airbrake_projects` — `list`, `get`, `list_activities`
19
+ - `airbrake_groups` — `list` (with `environment`, `resolved`, `muted`, `archived`,
20
+ `deploy_id`, `start_time`, `end_time`, `order`, `query` filters), `get`,
21
+ `get_stats` (v5 time-series), `mute`, `unmute`, `resolve`, `unresolve`,
22
+ `delete`
23
+ - `airbrake_notices` — `list` (with `version` filter), `get`, `get_status`
24
+ - `airbrake_deploys` — `list`, `get`, `create`
25
+ - `airbrake_performance` — `routes_stats`, `queries_stats` (requires `route`),
26
+ `queues_stats` (requires `queue`)
27
+ - `airbrake_notify` — `notify` (v3 Notifier API, project-key auth)
28
+ - `airbrake_sourcemaps` — `list`, `get`, `delete`
29
+ - `airbrake_request` — escape hatch with `auth: 'none'` support, raw string
30
+ bodies for multipart, arbitrary headers and query
31
+ - HTTP client: bearer + project-key auth, retries on 429 (honoring
32
+ `Retry-After`, including HTTP-date format) and 5xx with equal-jitter
33
+ exponential backoff, configurable timeouts
34
+ - `npm run validate` — spawns the built server, validates every tool's
35
+ `inputSchema` against MCP/Claude constraints (top-level `type: "object"`,
36
+ no top-level `anyOf`/`oneOf`/`allOf`)
37
+ - CI on Node 20 + 22: lint, typecheck, test, build, validate
38
+
39
+ ### Notes
40
+
41
+ This is an **unofficial** project, not affiliated with or endorsed by
42
+ Airbrake Technologies. See the README "Coverage caveats" section for
43
+ endpoints that are documented by Airbrake but unreachable from Personal
44
+ API tokens (and therefore not modeled), and for endpoints we expose that
45
+ aren't in Airbrake's public docs (live-verified working on hosted
46
+ Airbrake but not part of the public contract).
47
+
48
+ [Unreleased]: https://github.com/francktrouillez/airbrake-mcp/compare/v0.1.0...HEAD
49
+ [0.1.0]: https://github.com/francktrouillez/airbrake-mcp/releases/tag/v0.1.0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Franck Trouillez
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,154 @@
1
+ # airbrake-mcp
2
+
3
+ [![CI](https://github.com/francktrouillez/airbrake-mcp/actions/workflows/ci.yml/badge.svg)](https://github.com/francktrouillez/airbrake-mcp/actions/workflows/ci.yml)
4
+ [![npm version](https://img.shields.io/npm/v/airbrake-mcp.svg)](https://www.npmjs.com/package/airbrake-mcp)
5
+ [![License: MIT](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE)
6
+ [![Node.js](https://img.shields.io/badge/node-%3E%3D20-brightgreen.svg)](https://nodejs.org)
7
+
8
+ An MCP (Model Context Protocol) server that exposes the Airbrake public API to LLM clients. Works with any MCP-compatible client (Claude Desktop, Claude Code, Cursor, Cline, Codex CLI, Continue.dev, etc.).
9
+
10
+ Eight resource-grouped tools cover what hosted Airbrake actually exposes (projects, error groups, notices, deploys, v5 APM, source maps, the v3 Notifier), plus a generic `airbrake_request` escape hatch for endpoints not directly modeled — including project-key endpoints and multipart uploads.
11
+
12
+ **Unofficial. Not affiliated with or endorsed by Airbrake Technologies.**
13
+
14
+ ## Install
15
+
16
+ ### Claude Code (one-liner)
17
+
18
+ ```bash
19
+ claude mcp add airbrake --scope user \
20
+ --env AIRBRAKE_USER_TOKEN=YOUR_TOKEN \
21
+ -- npx -y airbrake-mcp
22
+ ```
23
+
24
+ Restart Claude Code and the `airbrake_*` tools become available.
25
+
26
+ ### Other clients
27
+
28
+ See [MCP client config](#mcp-client-config) below for Claude Desktop, Cursor, Cline, Codex CLI, and Continue.dev. (One-liner installers per client are documented as they ship — until then the JSON config block in that section is identical across all clients; only the file location changes.)
29
+
30
+ ### Run the binary directly (optional)
31
+
32
+ The server is normally spawned by your MCP client over stdio. To test it stand-alone:
33
+
34
+ ```bash
35
+ AIRBRAKE_USER_TOKEN=your_token npx airbrake-mcp
36
+ ```
37
+
38
+ It will wait for JSON-RPC messages on stdin. Useful for debugging the install only.
39
+
40
+ ## Configuration
41
+
42
+ All configuration is via environment variables.
43
+
44
+ | Var | Required | Default | Purpose |
45
+ |---|---|---|---|
46
+ | `AIRBRAKE_USER_TOKEN` | yes (except for notify-only setups) | — | Bearer token for the management API |
47
+ | `AIRBRAKE_PROJECT_KEYS` | only for `airbrake_notify` | — | JSON map `{"123":"notifier_key"}` |
48
+ | `AIRBRAKE_HOST` | no | `https://api.airbrake.io` | Override for self-hosted Airbrake or Errbit |
49
+ | `AIRBRAKE_TIMEOUT_MS` | no | `15000` | Per-request timeout |
50
+ | `AIRBRAKE_MAX_RETRIES` | no | `2` | Retries on 429 and 5xx |
51
+
52
+ Get a User API token from Airbrake → User Settings → Personal API tokens.
53
+
54
+ ## MCP client config
55
+
56
+ The MCP entry below is the same for every MCP client — only the config file location differs.
57
+
58
+ ```json
59
+ {
60
+ "mcpServers": {
61
+ "airbrake": {
62
+ "command": "npx",
63
+ "args": ["-y", "airbrake-mcp"],
64
+ "env": {
65
+ "AIRBRAKE_USER_TOKEN": "your_user_token_here"
66
+ }
67
+ }
68
+ }
69
+ }
70
+ ```
71
+
72
+ Where to put it, by client:
73
+
74
+ | Client | Location |
75
+ |---|---|
76
+ | **Claude Desktop** (macOS) | `~/Library/Application Support/Claude/claude_desktop_config.json` |
77
+ | **Claude Code** | `~/.claude.json` — or use `claude mcp add airbrake --scope user --env AIRBRAKE_USER_TOKEN=… -- npx -y airbrake-mcp` |
78
+ | **Cursor** | `.cursor/mcp.json` (per-project) or `~/.cursor/mcp.json` (user-wide) |
79
+ | **Cline (VS Code)** | VS Code Settings → Cline → MCP servers (UI), or `cline_mcp_settings.json` |
80
+ | **Codex CLI** | `~/.codex/config.json` under `mcpServers` |
81
+ | **Continue.dev** | `.continue/config.json` under `experimental.modelContextProtocolServers` |
82
+
83
+ To enable the notifier (sending errors TO Airbrake), add the project keys map:
84
+
85
+ ```json
86
+ {
87
+ "mcpServers": {
88
+ "airbrake": {
89
+ "command": "npx",
90
+ "args": ["-y", "airbrake-mcp"],
91
+ "env": {
92
+ "AIRBRAKE_USER_TOKEN": "your_user_token_here",
93
+ "AIRBRAKE_PROJECT_KEYS": "{\"123\":\"notifier_key_abc\"}"
94
+ }
95
+ }
96
+ }
97
+ }
98
+ ```
99
+
100
+ ## Tools
101
+
102
+ | Tool | Actions | Notes |
103
+ |---|---|---|
104
+ | `airbrake_projects` | `list`, `get`, `list_activities` | Project updates are not modeled — see the caveat below. |
105
+ | `airbrake_groups` | `list`, `get`, `get_stats`, `mute`, `unmute`, `resolve`, `unresolve`, `delete` | `list` supports `environment`, `resolved`, `muted`, `archived`, `deploy_id`, `start_time`, `end_time`, `order`, `query`. `get_stats` (v5) requires `time__gte`/`time__lt`/`period`. `resolve`/`unresolve` follow the documented mute PUT convention; fall back to `airbrake_request` if your instance disagrees. |
106
+ | `airbrake_notices` | `list`, `get`, `get_status` | `list` and `get_status` are documented; `get` calls an undocumented endpoint that currently works on hosted Airbrake. |
107
+ | `airbrake_deploys` | `list`, `get`, `create` | All documented. |
108
+ | `airbrake_performance` | `routes_stats`, `queries_stats`, `queues_stats` | v5 APM. All actions require `time__gte`/`time__lt`/`period` (`minute`\|`hour`\|`day`). **`queries_stats` additionally requires a `route` filter** and **`queues_stats` additionally requires a `queue` filter** — the server returns 400 without them. The GET (read) side of these endpoints is not in Airbrake's public docs (which only show the PUT ingest side) but is live-verified working on hosted Airbrake. `routes-breakdowns` is intentionally not modeled (PUT-only SDK endpoint). |
109
+ | `airbrake_notify` | `notify` | Sends errors TO Airbrake (v3 Notifier API). |
110
+ | `airbrake_sourcemaps` | `list`, `get`, `delete` | Upload is multipart/form-data — use `airbrake_request` with a pre-formed multipart body. |
111
+ | `airbrake_request` | `request` | Escape hatch for any endpoint. Supports `auth: 'none'` (project-key endpoints), raw string bodies (multipart), arbitrary headers and query. |
112
+
113
+ Tools return raw Airbrake JSON payloads with no field-stripping. List actions add a `_pagination` metadata object so the model can iterate pages.
114
+
115
+ ### ID precision — strings only for snowflakes
116
+
117
+ Airbrake's group/notice/deploy/sourcemap IDs are **19-digit snowflakes** that exceed `Number.MAX_SAFE_INTEGER`. **They MUST be passed as strings**, otherwise JSON parsing (in both the LLM tool-call layer and our zod schema) silently rounds the last 3–5 digits to zero and the lookup 404s.
118
+
119
+ The schemas reject numeric IDs explicitly; you'll see a clear zod error if you try. Project IDs are small integers and can be passed as numbers as usual.
120
+
121
+ ### Pagination params
122
+
123
+ Airbrake accepts both `limit` and `per_page` on list endpoints. This MCP standardizes on `page` + `per_page` for consistency across all list actions.
124
+
125
+ ### Coverage caveats
126
+
127
+ - **Project updates are not exposed.** The `PUT /api/v4/projects/:id` endpoint requires dashboard-session credentials (cookies + CSRF), not Personal API tokens, and returns 401 from every token shape we tested. Use the Airbrake dashboard to change project settings.
128
+ - **`airbrake_notices.get`** calls an undocumented endpoint. It works on hosted Airbrake today but is not part of the public contract — may break or differ on self-hosted instances and Errbit.
129
+ - **Source-map upload (`POST /api/v4/projects/:pid/sourcemaps`)** requires multipart/form-data. The escape hatch supports it via raw string body + a `Content-Type: multipart/form-data; boundary=…` header; constructing the multipart body is the caller's responsibility.
130
+ - **`POST /api/v3/projects/:pid/ios-reports`** (iOS crash reports) requires `?key=PROJECT_KEY` and no `Authorization` header. Call via `airbrake_request` with `auth: 'none'` and pass the project key in `query`.
131
+ - **APM write endpoints** (`PUT /api/v5/.../routes-stats` etc.) are SDK-internal; not modeled, but reachable via the escape hatch.
132
+ - **What this MCP intentionally doesn't model:** the Airbrake dashboard exposes endpoints for comments, bookmarks, iframes, personal tokens, project stats, and a cross-project `/api/v4/groups` listing — these all returned 404/401 against hosted Airbrake from a User API token. They were modeled in earlier versions and removed. If your instance does support them, reach for `airbrake_request`.
133
+
134
+ ## Development
135
+
136
+ ```bash
137
+ npm install
138
+ npm test # vitest, 80 tests
139
+ npm run typecheck
140
+ npm run lint
141
+ npm run build # emits dist/
142
+ npm run validate # spawns the built server, checks tool schemas (expects 8 tools)
143
+ npm run dev # tsx src/bin.ts (for local stdio testing)
144
+ ```
145
+
146
+ ## Contributing
147
+
148
+ Issues and pull requests welcome at <https://github.com/francktrouillez/airbrake-mcp/issues>.
149
+
150
+ Bug reports are most useful with: the action you called, the params (with secrets redacted), the response, and the Airbrake instance type (hosted `api.airbrake.io` vs self-hosted vs Errbit).
151
+
152
+ ## License
153
+
154
+ MIT
package/dist/bin.d.ts ADDED
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ export {};
package/dist/bin.js ADDED
@@ -0,0 +1,7 @@
1
+ #!/usr/bin/env node
2
+ import { startStdioServer } from './server.js';
3
+ startStdioServer().catch((err) => {
4
+ process.stderr.write(`airbrake-mcp failed to start: ${err instanceof Error ? err.message : String(err)}\n`);
5
+ process.exit(1);
6
+ });
7
+ //# sourceMappingURL=bin.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bin.js","sourceRoot":"","sources":["../src/bin.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAE/C,gBAAgB,EAAE,CAAC,KAAK,CAAC,CAAC,GAAG,EAAE,EAAE;IAC/B,OAAO,CAAC,MAAM,CAAC,KAAK,CAClB,iCAAiC,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,IAAI,CACtF,CAAC;IACF,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC"}
@@ -0,0 +1,16 @@
1
+ import type { Config } from '../config.js';
2
+ export type HttpMethod = 'GET' | 'POST' | 'PATCH' | 'PUT' | 'DELETE';
3
+ export interface RequestOptions {
4
+ query?: Record<string, string | number | boolean | undefined>;
5
+ body?: unknown;
6
+ headers?: Record<string, string>;
7
+ /** 'bearer' (default) uses AIRBRAKE_USER_TOKEN; 'none' omits Authorization (notifier path) */
8
+ auth?: 'bearer' | 'none';
9
+ }
10
+ export declare function parseRetryAfter(value: string | null, now?: number): number | null;
11
+ export declare function backoffMs(attempt: number, baseMs?: number): number;
12
+ export declare class AirbrakeClient {
13
+ private readonly config;
14
+ constructor(config: Config);
15
+ request(method: HttpMethod, path: string, options?: RequestOptions): Promise<unknown>;
16
+ }
@@ -0,0 +1,120 @@
1
+ import { AirbrakeApiError, AirbrakeNetworkError } from './errors.js';
2
+ function buildQuery(query) {
3
+ if (!query)
4
+ return '';
5
+ const params = new URLSearchParams();
6
+ for (const [k, v] of Object.entries(query)) {
7
+ if (v === undefined)
8
+ continue;
9
+ params.set(k, String(v));
10
+ }
11
+ const s = params.toString();
12
+ return s ? `?${s}` : '';
13
+ }
14
+ function isRetriable(status) {
15
+ return status === 429 || (status >= 500 && status < 600);
16
+ }
17
+ // Retry-After (RFC 7231 §7.1.3) is either delta-seconds or an HTTP-date.
18
+ // Returns ms to wait, or null if the header is absent or unparseable.
19
+ export function parseRetryAfter(value, now = Date.now()) {
20
+ if (!value)
21
+ return null;
22
+ const trimmed = value.trim();
23
+ if (trimmed === '')
24
+ return null;
25
+ if (/^\d+(\.\d+)?$/.test(trimmed)) {
26
+ return Math.max(0, Number(trimmed) * 1000);
27
+ }
28
+ const dateMs = Date.parse(trimmed);
29
+ if (Number.isFinite(dateMs))
30
+ return Math.max(0, dateMs - now);
31
+ return null;
32
+ }
33
+ // Equal-jitter exponential backoff: random delay between 50% and 100% of
34
+ // 2^attempt * baseMs. Avoids thundering-herd retries under concurrent load.
35
+ export function backoffMs(attempt, baseMs = 250) {
36
+ const exp = 2 ** attempt * baseMs;
37
+ return exp * 0.5 + Math.random() * exp * 0.5;
38
+ }
39
+ async function sleep(ms) {
40
+ return new Promise((r) => setTimeout(r, ms));
41
+ }
42
+ export class AirbrakeClient {
43
+ config;
44
+ constructor(config) {
45
+ this.config = config;
46
+ }
47
+ async request(method, path, options = {}) {
48
+ const url = `${this.config.host}${path}${buildQuery(options.query)}`;
49
+ const headers = {
50
+ accept: 'application/json',
51
+ ...(options.headers ?? {}),
52
+ };
53
+ if (options.auth !== 'none') {
54
+ if (!this.config.userToken) {
55
+ throw new AirbrakeApiError(401, method, path, {
56
+ message: 'AIRBRAKE_USER_TOKEN env var is required',
57
+ });
58
+ }
59
+ headers.authorization = `Bearer ${this.config.userToken}`;
60
+ }
61
+ let body;
62
+ if (options.body !== undefined) {
63
+ if (typeof options.body === 'string') {
64
+ // Pre-formed payload (e.g. multipart, plain text, raw JSON).
65
+ // Caller controls Content-Type via options.headers.
66
+ body = options.body;
67
+ }
68
+ else {
69
+ if (!('content-type' in headers)) {
70
+ headers['content-type'] = 'application/json';
71
+ }
72
+ body = JSON.stringify(options.body);
73
+ }
74
+ }
75
+ let attempt = 0;
76
+ while (true) {
77
+ const controller = new AbortController();
78
+ const timer = setTimeout(() => controller.abort(), this.config.timeoutMs);
79
+ let response;
80
+ try {
81
+ const init = { method, headers, signal: controller.signal };
82
+ if (body !== undefined)
83
+ init.body = body;
84
+ response = await fetch(url, init);
85
+ }
86
+ catch (err) {
87
+ clearTimeout(timer);
88
+ if (attempt < this.config.maxRetries) {
89
+ await sleep(backoffMs(attempt));
90
+ attempt++;
91
+ continue;
92
+ }
93
+ throw new AirbrakeNetworkError(method, path, err);
94
+ }
95
+ clearTimeout(timer);
96
+ if (isRetriable(response.status) && attempt < this.config.maxRetries) {
97
+ const retryAfterMs = parseRetryAfter(response.headers.get('retry-after'));
98
+ const delay = retryAfterMs !== null ? retryAfterMs : backoffMs(attempt);
99
+ await sleep(delay);
100
+ attempt++;
101
+ continue;
102
+ }
103
+ const text = response.status === 204 ? '' : await response.text();
104
+ let parsed = null;
105
+ if (text.length > 0) {
106
+ try {
107
+ parsed = JSON.parse(text);
108
+ }
109
+ catch {
110
+ parsed = text;
111
+ }
112
+ }
113
+ if (!response.ok) {
114
+ throw new AirbrakeApiError(response.status, method, path, parsed);
115
+ }
116
+ return parsed;
117
+ }
118
+ }
119
+ }
120
+ //# sourceMappingURL=airbrake.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"airbrake.js","sourceRoot":"","sources":["../../src/client/airbrake.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,E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akeApiError extends Error {
2
+ readonly status: number;
3
+ readonly method: string;
4
+ readonly path: string;
5
+ readonly body: unknown;
6
+ constructor(status: number, method: string, path: string, body: unknown);
7
+ }
8
+ export declare class AirbrakeNetworkError extends Error {
9
+ readonly method: string;
10
+ readonly path: string;
11
+ readonly cause: unknown;
12
+ constructor(method: string, path: string, cause: unknown);
13
+ }
14
+ export declare class AirbrakeConfigError extends Error {
15
+ constructor(message: string);
16
+ }
@@ -0,0 +1,33 @@
1
+ export class AirbrakeApiError extends Error {
2
+ status;
3
+ method;
4
+ path;
5
+ body;
6
+ constructor(status, method, path, body) {
7
+ super(`Airbrake API error ${status} on ${method} ${path}: ${JSON.stringify(body)}`);
8
+ this.status = status;
9
+ this.method = method;
10
+ this.path = path;
11
+ this.body = body;
12
+ this.name = 'AirbrakeApiError';
13
+ }
14
+ }
15
+ export class AirbrakeNetworkError extends Error {
16
+ method;
17
+ path;
18
+ cause;
19
+ constructor(method, path, cause) {
20
+ super(`Airbrake network error on ${method} ${path}: ${cause instanceof Error ? cause.message : String(cause)}`);
21
+ this.method = method;
22
+ this.path = path;
23
+ this.cause = cause;
24
+ this.name = 'AirbrakeNetworkError';
25
+ }
26
+ }
27
+ export class AirbrakeConfigError extends Error {
28
+ constructor(message) {
29
+ super(message);
30
+ this.name = 'AirbrakeConfigError';
31
+ }
32
+ }
33
+ //# sourceMappingURL=errors.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.js","sourceRoot":"","sources":["../../src/client/errors.ts"],"names":[],"mappings":"AAAA,MAAM,OAAO,gBAAiB,SAAQ,KAAK;IAEvB;IACA;IACA;IACA;IAJlB,YACkB,MAAc,EACd,MAAc,EACd,IAAY,EACZ,IAAa;QAE7B,KAAK,CAAC,sBAAsB,MAAM,OAAO,MAAM,IAAI,IAAI,KAAK,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QALpE,WAAM,GAAN,MAAM,CAAQ;QACd,WAAM,GAAN,MAAM,CAAQ;QACd,SAAI,GAAJ,IAAI,CAAQ;QACZ,SAAI,GAAJ,IAAI,CAAS;QAG7B,IAAI,CAAC,IAAI,GAAG,kBAAkB,CAAC;IACjC,CAAC;CACF;AAED,MAAM,OAAO,oBAAqB,SAAQ,KAAK;IAE3B;IACA;IACA;IAHlB,YACkB,MAAc,EACd,IAAY,EACZ,KAAc;QAE9B,KAAK,CACH,6BAA6B,MAAM,IAAI,IAAI,KAAK,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CACzG,CAAC;QANc,WAAM,GAAN,MAAM,CAAQ;QACd,SAAI,GAAJ,IAAI,CAAQ;QACZ,UAAK,GAAL,KAAK,CAAS;QAK9B,IAAI,CAAC,IAAI,GAAG,sBAAsB,CAAC;IACrC,CAAC;CACF;AAED,MAAM,OAAO,mBAAoB,SAAQ,KAAK;IAC5C,YAAY,OAAe;QACzB,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,qBAAqB,CAAC;IACpC,CAAC;CACF"}
@@ -0,0 +1,12 @@
1
+ export interface PaginationInput {
2
+ page: number;
3
+ perPage: number;
4
+ }
5
+ export interface PaginationMeta {
6
+ page: number;
7
+ per_page: number;
8
+ count?: number;
9
+ }
10
+ export declare function withPagination<T extends Record<string, unknown>>(payload: T, input: PaginationInput | null): T & {
11
+ _pagination?: PaginationMeta;
12
+ };
@@ -0,0 +1,9 @@
1
+ export function withPagination(payload, input) {
2
+ if (!input)
3
+ return payload;
4
+ const meta = { page: input.page, per_page: input.perPage };
5
+ if (typeof payload.count === 'number')
6
+ meta.count = payload.count;
7
+ return { ...payload, _pagination: meta };
8
+ }
9
+ //# sourceMappingURL=pagination.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pagination.js","sourceRoot":"","sources":["../../src/client/pagination.ts"],"names":[],"mappings":"AAWA,MAAM,UAAU,cAAc,CAC5B,OAAU,EACV,KAA6B;IAE7B,IAAI,CAAC,KAAK;QAAE,OAAO,OAAO,CAAC;IAC3B,MAAM,IAAI,GAAmB,EAAE,IAAI,EAAE,KAAK,CAAC,IAAI,EAAE,QAAQ,EAAE,KAAK,CAAC,OAAO,EAAE,CAAC;IAC3E,IAAI,OAAO,OAAO,CAAC,KAAK,KAAK,QAAQ;QAAE,IAAI,CAAC,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC;IAClE,OAAO,EAAE,GAAG,OAAO,EAAE,WAAW,EAAE,IAAI,EAAE,CAAC;AAC3C,CAAC"}
@@ -0,0 +1,8 @@
1
+ export interface Config {
2
+ userToken: string;
3
+ projectKeys: Record<string, string>;
4
+ host: string;
5
+ timeoutMs: number;
6
+ maxRetries: number;
7
+ }
8
+ export declare function loadConfig(env: NodeJS.ProcessEnv | Record<string, string | undefined>): Config;
package/dist/config.js ADDED
@@ -0,0 +1,38 @@
1
+ function parseInt(name, raw, fallback) {
2
+ if (raw === undefined)
3
+ return fallback;
4
+ const n = Number(raw);
5
+ if (!Number.isFinite(n) || !Number.isInteger(n)) {
6
+ throw new Error(`${name} must be an integer, got: ${raw}`);
7
+ }
8
+ return n;
9
+ }
10
+ function parseProjectKeys(raw) {
11
+ if (!raw)
12
+ return {};
13
+ let parsed;
14
+ try {
15
+ parsed = JSON.parse(raw);
16
+ }
17
+ catch {
18
+ throw new Error(`AIRBRAKE_PROJECT_KEYS is not valid JSON`);
19
+ }
20
+ if (parsed === null ||
21
+ typeof parsed !== 'object' ||
22
+ Array.isArray(parsed) ||
23
+ Object.values(parsed).some((v) => typeof v !== 'string')) {
24
+ throw new Error(`AIRBRAKE_PROJECT_KEYS must be a JSON object mapping project_id to notifier key strings`);
25
+ }
26
+ return parsed;
27
+ }
28
+ export function loadConfig(env) {
29
+ const host = (env.AIRBRAKE_HOST ?? 'https://api.airbrake.io').replace(/\/+$/, '');
30
+ return {
31
+ userToken: env.AIRBRAKE_USER_TOKEN ?? '',
32
+ projectKeys: parseProjectKeys(env.AIRBRAKE_PROJECT_KEYS),
33
+ host,
34
+ timeoutMs: parseInt('AIRBRAKE_TIMEOUT_MS', env.AIRBRAKE_TIMEOUT_MS, 15000),
35
+ maxRetries: parseInt('AIRBRAKE_MAX_RETRIES', env.AIRBRAKE_MAX_RETRIES, 2),
36
+ };
37
+ }
38
+ //# sourceMappingURL=config.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAQA,SAAS,QAAQ,CAAC,IAAY,EAAE,GAAuB,EAAE,QAAgB;IACvE,IAAI,GAAG,KAAK,SAAS;QAAE,OAAO,QAAQ,CAAC;IACvC,MAAM,CAAC,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC;IACtB,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC;QAChD,MAAM,IAAI,KAAK,CAAC,GAAG,IAAI,6BAA6B,GAAG,EAAE,CAAC,CAAC;IAC7D,CAAC;IACD,OAAO,CAAC,CAAC;AACX,CAAC;AAED,SAAS,gBAAgB,CAAC,GAAuB;IAC/C,IAAI,CAAC,GAAG;QAAE,OAAO,EAAE,CAAC;IACpB,IAAI,MAAe,CAAC;IACpB,IAAI,CAAC;QACH,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IAC3B,CAAC;IAAC,MAAM,CAAC;QACP,MAAM,IAAI,KAAK,CAAC,yCAAyC,CAAC,CAAC;IAC7D,CAAC;IACD,IACE,MAAM,KAAK,IAAI;QACf,OAAO,MAAM,KAAK,QAAQ;QAC1B,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC;QACrB,MAAM,CAAC,MAAM,CAAC,MAAiC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,OAAO,CAAC,KAAK,QAAQ,CAAC,EACnF,CAAC;QACD,MAAM,IAAI,KAAK,CACb,wFAAwF,CACzF,CAAC;IACJ,CAAC;IACD,OAAO,MAAgC,CAAC;AAC1C,CAAC;AAED,MAAM,UAAU,UAAU,CAAC,GAA2D;IACpF,MAAM,IAAI,GAAG,CAAC,GAAG,CAAC,aAAa,IAAI,yBAAyB,CAAC,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;IAClF,OAAO;QACL,SAAS,EAAE,GAAG,CAAC,mBAAmB,IAAI,EAAE;QACxC,WAAW,EAAE,gBAAgB,CAAC,GAAG,CAAC,qBAAqB,CAAC;QACxD,IAAI;QACJ,SAAS,EAAE,QAAQ,CAAC,qBAAqB,EAAE,GAAG,CAAC,mBAAmB,EAAE,KAAK,CAAC;QAC1E,UAAU,EAAE,QAAQ,CAAC,sBAAsB,EAAE,GAAG,CAAC,oBAAoB,EAAE,CAAC,CAAC;KAC1E,CAAC;AACJ,CAAC"}
@@ -0,0 +1,7 @@
1
+ import { Server } from '@modelcontextprotocol/sdk/server/index.js';
2
+ import type { z } from 'zod';
3
+ type JsonObject = Record<string, unknown>;
4
+ export declare function toMcpInputSchema(schema: z.ZodTypeAny): JsonObject;
5
+ export declare function createServer(env?: NodeJS.ProcessEnv | Record<string, string | undefined>): Promise<Server>;
6
+ export declare function startStdioServer(): Promise<void>;
7
+ export {};
package/dist/server.js ADDED
@@ -0,0 +1,101 @@
1
+ import { Server } from '@modelcontextprotocol/sdk/server/index.js';
2
+ import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
3
+ import { CallToolRequestSchema, ListToolsRequestSchema } from '@modelcontextprotocol/sdk/types.js';
4
+ import { zodToJsonSchema } from 'zod-to-json-schema';
5
+ import { AirbrakeClient } from './client/airbrake.js';
6
+ import { loadConfig } from './config.js';
7
+ import { allTools } from './tools/index.js';
8
+ function mergeAnyOf(branches) {
9
+ const properties = {};
10
+ const requiredCounts = {};
11
+ let total = 0;
12
+ for (const branch of branches) {
13
+ if (!branch || typeof branch !== 'object')
14
+ continue;
15
+ const b = branch;
16
+ if (b.type !== 'object')
17
+ continue;
18
+ total++;
19
+ const branchProps = b.properties ?? {};
20
+ for (const [name, propSchema] of Object.entries(branchProps)) {
21
+ if (!(name in properties)) {
22
+ properties[name] = JSON.parse(JSON.stringify(propSchema));
23
+ continue;
24
+ }
25
+ if (name === 'action') {
26
+ const existing = properties[name];
27
+ const incoming = propSchema;
28
+ const incomingVal = incoming.const;
29
+ if (incomingVal === undefined)
30
+ continue;
31
+ if (Array.isArray(existing.enum)) {
32
+ if (!existing.enum.includes(incomingVal))
33
+ existing.enum.push(incomingVal);
34
+ }
35
+ else if (existing.const !== undefined) {
36
+ const old = existing.const;
37
+ delete existing.const;
38
+ existing.enum = [old, incomingVal];
39
+ }
40
+ }
41
+ }
42
+ for (const name of b.required ?? []) {
43
+ requiredCounts[name] = (requiredCounts[name] ?? 0) + 1;
44
+ }
45
+ }
46
+ const required = Object.entries(requiredCounts)
47
+ .filter(([, count]) => count === total)
48
+ .map(([name]) => name);
49
+ const result = { type: 'object', properties, additionalProperties: false };
50
+ if (required.length > 0)
51
+ result.required = required;
52
+ return result;
53
+ }
54
+ export function toMcpInputSchema(schema) {
55
+ const json = zodToJsonSchema(schema, {
56
+ target: 'jsonSchema7',
57
+ $refStrategy: 'none',
58
+ });
59
+ if (Array.isArray(json.anyOf))
60
+ return mergeAnyOf(json.anyOf);
61
+ if (json.type === 'object')
62
+ return json;
63
+ return { type: 'object', ...json };
64
+ }
65
+ export async function createServer(env = process.env) {
66
+ const config = loadConfig(env);
67
+ const client = new AirbrakeClient(config);
68
+ const ctx = { client, config };
69
+ const server = new Server({ name: 'airbrake-mcp', version: '0.1.0' }, { capabilities: { tools: {} } });
70
+ server.setRequestHandler(ListToolsRequestSchema, async () => ({
71
+ tools: allTools.map((t) => ({
72
+ name: t.name,
73
+ description: t.description,
74
+ inputSchema: toMcpInputSchema(t.inputSchema),
75
+ })),
76
+ }));
77
+ server.setRequestHandler(CallToolRequestSchema, async (req) => {
78
+ const tool = allTools.find((t) => t.name === req.params.name);
79
+ if (!tool) {
80
+ return {
81
+ isError: true,
82
+ content: [{ type: 'text', text: `unknown tool: ${req.params.name}` }],
83
+ };
84
+ }
85
+ try {
86
+ const result = await tool.handler(ctx, req.params.arguments ?? {});
87
+ return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }] };
88
+ }
89
+ catch (err) {
90
+ const message = err instanceof Error ? err.message : String(err);
91
+ return { isError: true, content: [{ type: 'text', text: message }] };
92
+ }
93
+ });
94
+ return server;
95
+ }
96
+ export async function startStdioServer() {
97
+ const server = await createServer();
98
+ const transport = new StdioServerTransport();
99
+ await server.connect(transport);
100
+ }
101
+ //# sourceMappingURL=server.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"server.js","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,2CAA2C,CAAC;AACnE,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AACjF,OAAO,EAAE,qBAAqB,EAAE,sBAAsB,EAAE,MAAM,oCAAoC,CAAC;AAEnG,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAa5C,SAAS,UAAU,CAAC,QAAmB;IACrC,MAAM,UAAU,GAAe,EAAE,CAAC;IAClC,MAAM,cAAc,GAA2B,EAAE,CAAC;IAClD,IAAI,KAAK,GAAG,CAAC,CAAC;IACd,KAAK,MAAM,MAAM,IAAI,QAAQ,EAAE,CAAC;QAC9B,IAAI,CAAC,MAAM,IAAI,OAAO,MAAM,KAAK,QAAQ;YAAE,SAAS;QACpD,MAAM,CAAC,GAAG,MAAoB,CAAC;QAC/B,IAAI,CAAC,CAAC,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