@tellagen/mcp-server 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.
- package/README.md +217 -0
- package/SKILL.md +289 -0
- package/dist/auth.d.ts +6 -0
- package/dist/auth.js +18 -0
- package/dist/auth.js.map +1 -0
- package/dist/client.d.ts +15 -0
- package/dist/client.js +53 -0
- package/dist/client.js.map +1 -0
- package/dist/errors.d.ts +8 -0
- package/dist/errors.js +30 -0
- package/dist/errors.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +28 -0
- package/dist/index.js.map +1 -0
- package/dist/server.d.ts +4 -0
- package/dist/server.js +45 -0
- package/dist/server.js.map +1 -0
- package/dist/tools/findings.d.ts +3 -0
- package/dist/tools/findings.js +262 -0
- package/dist/tools/findings.js.map +1 -0
- package/dist/tools/incidents.d.ts +3 -0
- package/dist/tools/incidents.js +135 -0
- package/dist/tools/incidents.js.map +1 -0
- package/dist/tools/index.d.ts +4 -0
- package/dist/tools/index.js +10 -0
- package/dist/tools/index.js.map +1 -0
- package/dist/tools/investigations.d.ts +3 -0
- package/dist/tools/investigations.js +89 -0
- package/dist/tools/investigations.js.map +1 -0
- package/package.json +38 -0
package/dist/index.js
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
3
|
+
import { TellagenClient } from "./client.js";
|
|
4
|
+
import { validateAuth } from "./auth.js";
|
|
5
|
+
import { createServer } from "./server.js";
|
|
6
|
+
async function main() {
|
|
7
|
+
const apiKey = process.env.TELLAGEN_API_KEY;
|
|
8
|
+
const apiUrl = process.env.TELLAGEN_API_URL;
|
|
9
|
+
if (!apiKey) {
|
|
10
|
+
process.stderr.write("Error: TELLAGEN_API_KEY environment variable is required.\n");
|
|
11
|
+
process.exit(1);
|
|
12
|
+
}
|
|
13
|
+
if (!apiUrl) {
|
|
14
|
+
process.stderr.write("Error: TELLAGEN_API_URL environment variable is required.\n");
|
|
15
|
+
process.exit(1);
|
|
16
|
+
}
|
|
17
|
+
const client = new TellagenClient({ apiUrl, apiKey });
|
|
18
|
+
// Validate credentials before starting the server.
|
|
19
|
+
await validateAuth(client);
|
|
20
|
+
const server = createServer(client);
|
|
21
|
+
const transport = new StdioServerTransport();
|
|
22
|
+
await server.connect(transport);
|
|
23
|
+
}
|
|
24
|
+
main().catch((err) => {
|
|
25
|
+
process.stderr.write(`Fatal: ${err instanceof Error ? err.message : String(err)}\n`);
|
|
26
|
+
process.exit(1);
|
|
27
|
+
});
|
|
28
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AACjF,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAE3C,KAAK,UAAU,IAAI;IACjB,MAAM,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC,gBAAgB,CAAC;IAC5C,MAAM,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC,gBAAgB,CAAC;IAE5C,IAAI,CAAC,MAAM,EAAE,CAAC;QACZ,OAAO,CAAC,MAAM,CAAC,KAAK,CAClB,6DAA6D,CAC9D,CAAC;QACF,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;IACD,IAAI,CAAC,MAAM,EAAE,CAAC;QACZ,OAAO,CAAC,MAAM,CAAC,KAAK,CAClB,6DAA6D,CAC9D,CAAC;QACF,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;IAED,MAAM,MAAM,GAAG,IAAI,cAAc,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC;IAEtD,mDAAmD;IACnD,MAAM,YAAY,CAAC,MAAM,CAAC,CAAC;IAE3B,MAAM,MAAM,GAAG,YAAY,CAAC,MAAM,CAAC,CAAC;IACpC,MAAM,SAAS,GAAG,IAAI,oBAAoB,EAAE,CAAC;IAC7C,MAAM,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;AAClC,CAAC;AAED,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC,GAAG,EAAE,EAAE;IACnB,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,UAAU,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IACrF,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC"}
|
package/dist/server.d.ts
ADDED
package/dist/server.js
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { readFileSync } from "node:fs";
|
|
2
|
+
import { dirname, join } from "node:path";
|
|
3
|
+
import { fileURLToPath } from "node:url";
|
|
4
|
+
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
5
|
+
import { registerAllTools } from "./tools/index.js";
|
|
6
|
+
const INSTRUCTIONS = `Tellagen MCP server — incident investigation platform.
|
|
7
|
+
|
|
8
|
+
12 tools: get/list/create incidents, get timeline, start/list/complete investigations, post/list/get/update/promote findings.
|
|
9
|
+
|
|
10
|
+
Investigation lifecycle: get_incident → start_investigation (returns run_id) → gather evidence → post_finding (incrementally, not batched) → promote key findings to timeline → complete_investigation.
|
|
11
|
+
|
|
12
|
+
Findings require: finding_type (observation|correlation|hypothesis|evidence|recommendation|negative), claim, evidence_summary, confidence (0-1), confidence_reason. Attach evidence_refs with source, query, result_summary, url. Attach screenshots (url or base64) to evidence_refs or findings.
|
|
13
|
+
|
|
14
|
+
For the full guide on composing with Grafana, GitHub, PagerDuty MCP servers, read resource://tellagen/skill-guide.`;
|
|
15
|
+
function loadSkillGuide() {
|
|
16
|
+
const dir = dirname(fileURLToPath(import.meta.url));
|
|
17
|
+
const skillPath = join(dir, "..", "SKILL.md");
|
|
18
|
+
return readFileSync(skillPath, "utf-8");
|
|
19
|
+
}
|
|
20
|
+
/** Create and configure the Tellagen MCP server with all tools registered. */
|
|
21
|
+
export function createServer(client) {
|
|
22
|
+
const server = new McpServer({
|
|
23
|
+
name: "tellagen",
|
|
24
|
+
version: "0.1.0",
|
|
25
|
+
}, {
|
|
26
|
+
instructions: INSTRUCTIONS,
|
|
27
|
+
});
|
|
28
|
+
registerAllTools(server, client);
|
|
29
|
+
const skillGuide = loadSkillGuide();
|
|
30
|
+
server.registerResource("skill-guide", "resource://tellagen/skill-guide", {
|
|
31
|
+
title: "Tellagen Investigation Guide",
|
|
32
|
+
description: "Complete guide for AI agents: investigation lifecycle, finding types, composing with Grafana/GitHub/PagerDuty MCP servers, screenshot support, and common mistakes.",
|
|
33
|
+
mimeType: "text/markdown",
|
|
34
|
+
}, async (uri) => ({
|
|
35
|
+
contents: [
|
|
36
|
+
{
|
|
37
|
+
uri: uri.href,
|
|
38
|
+
mimeType: "text/markdown",
|
|
39
|
+
text: skillGuide,
|
|
40
|
+
},
|
|
41
|
+
],
|
|
42
|
+
}));
|
|
43
|
+
return server;
|
|
44
|
+
}
|
|
45
|
+
//# sourceMappingURL=server.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"server.js","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAEpE,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAEpD,MAAM,YAAY,GAAG;;;;;;;;mHAQ8F,CAAC;AAEpH,SAAS,cAAc;IACrB,MAAM,GAAG,GAAG,OAAO,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;IACpD,MAAM,SAAS,GAAG,IAAI,CAAC,GAAG,EAAE,IAAI,EAAE,UAAU,CAAC,CAAC;IAC9C,OAAO,YAAY,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC;AAC1C,CAAC;AAED,8EAA8E;AAC9E,MAAM,UAAU,YAAY,CAAC,MAAsB;IACjD,MAAM,MAAM,GAAG,IAAI,SAAS,CAC1B;QACE,IAAI,EAAE,UAAU;QAChB,OAAO,EAAE,OAAO;KACjB,EACD;QACE,YAAY,EAAE,YAAY;KAC3B,CACF,CAAC;IAEF,gBAAgB,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAEjC,MAAM,UAAU,GAAG,cAAc,EAAE,CAAC;IACpC,MAAM,CAAC,gBAAgB,CACrB,aAAa,EACb,iCAAiC,EACjC;QACE,KAAK,EAAE,8BAA8B;QACrC,WAAW,EACT,qKAAqK;QACvK,QAAQ,EAAE,eAAe;KAC1B,EACD,KAAK,EAAE,GAAG,EAAE,EAAE,CAAC,CAAC;QACd,QAAQ,EAAE;YACR;gBACE,GAAG,EAAE,GAAG,CAAC,IAAI;gBACb,QAAQ,EAAE,eAAe;gBACzB,IAAI,EAAE,UAAU;aACjB;SACF;KACF,CAAC,CACH,CAAC;IAEF,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
|
@@ -0,0 +1,262 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { formatError } from "../errors.js";
|
|
3
|
+
const screenshotSchema = z.object({
|
|
4
|
+
url: z
|
|
5
|
+
.string()
|
|
6
|
+
.url()
|
|
7
|
+
.optional()
|
|
8
|
+
.describe("URL to a hosted screenshot (e.g., Grafana render URL, uploaded image link)"),
|
|
9
|
+
base64: z
|
|
10
|
+
.string()
|
|
11
|
+
.optional()
|
|
12
|
+
.describe("Base64-encoded image data (e.g., PNG screenshot captured by a tool)"),
|
|
13
|
+
media_type: z
|
|
14
|
+
.string()
|
|
15
|
+
.optional()
|
|
16
|
+
.describe('Image media type (e.g., "image/png", "image/jpeg"). Defaults to "image/png"'),
|
|
17
|
+
caption: z
|
|
18
|
+
.string()
|
|
19
|
+
.optional()
|
|
20
|
+
.describe("Description of what the screenshot shows"),
|
|
21
|
+
});
|
|
22
|
+
const evidenceRefSchema = z.object({
|
|
23
|
+
source: z
|
|
24
|
+
.string()
|
|
25
|
+
.min(1)
|
|
26
|
+
.describe('System name (e.g., "grafana-loki", "github", "pagerduty", "codebase")'),
|
|
27
|
+
query: z
|
|
28
|
+
.string()
|
|
29
|
+
.optional()
|
|
30
|
+
.describe("Query or command used to gather this evidence"),
|
|
31
|
+
result_summary: z
|
|
32
|
+
.string()
|
|
33
|
+
.min(1)
|
|
34
|
+
.describe("What the query returned — summarize the key data"),
|
|
35
|
+
url: z
|
|
36
|
+
.string()
|
|
37
|
+
.optional()
|
|
38
|
+
.describe("Deep link to the source (e.g., Grafana explore URL, GitHub commit)"),
|
|
39
|
+
screenshots: z
|
|
40
|
+
.array(screenshotSchema)
|
|
41
|
+
.optional()
|
|
42
|
+
.describe("Screenshots related to this evidence (e.g., Grafana dashboard panel showing the spike)"),
|
|
43
|
+
});
|
|
44
|
+
export function registerFindingTools(server, client) {
|
|
45
|
+
server.registerTool("tellagen_post_finding", {
|
|
46
|
+
description: "Post a structured finding to an active investigation run on a Tellagen incident. Post findings incrementally as you discover them — do not batch.",
|
|
47
|
+
inputSchema: {
|
|
48
|
+
incident_id: z.number().int().positive().describe("Incident ID"),
|
|
49
|
+
investigation_run_id: z
|
|
50
|
+
.string()
|
|
51
|
+
.min(1)
|
|
52
|
+
.describe("Active investigation run ID"),
|
|
53
|
+
finding_type: z
|
|
54
|
+
.enum([
|
|
55
|
+
"observation",
|
|
56
|
+
"correlation",
|
|
57
|
+
"hypothesis",
|
|
58
|
+
"evidence",
|
|
59
|
+
"recommendation",
|
|
60
|
+
"negative",
|
|
61
|
+
])
|
|
62
|
+
.describe("Type of finding: observation (notable data), correlation (two related things), hypothesis (proposed cause), evidence (proof), recommendation (suggested action), negative (ruled out)"),
|
|
63
|
+
claim: z
|
|
64
|
+
.string()
|
|
65
|
+
.min(1)
|
|
66
|
+
.describe("One-sentence finding statement"),
|
|
67
|
+
evidence_summary: z
|
|
68
|
+
.string()
|
|
69
|
+
.min(1)
|
|
70
|
+
.describe("Detailed explanation with supporting data — this is the body of the finding"),
|
|
71
|
+
confidence: z
|
|
72
|
+
.number()
|
|
73
|
+
.min(0)
|
|
74
|
+
.max(1)
|
|
75
|
+
.describe("Confidence score from 0.0 to 1.0: 0.9+ near-certain, 0.5-0.7 plausible, <0.5 speculative"),
|
|
76
|
+
confidence_reason: z
|
|
77
|
+
.string()
|
|
78
|
+
.min(1)
|
|
79
|
+
.describe("Why you have this confidence level"),
|
|
80
|
+
evidence_refs: z
|
|
81
|
+
.array(evidenceRefSchema)
|
|
82
|
+
.optional()
|
|
83
|
+
.describe("References to evidence sources consulted. Include deep links in url where possible."),
|
|
84
|
+
screenshots: z
|
|
85
|
+
.array(screenshotSchema)
|
|
86
|
+
.optional()
|
|
87
|
+
.describe("Standalone screenshots for this finding (e.g., Grafana dashboard panels, error traces). Use evidence_refs[].screenshots for source-specific screenshots."),
|
|
88
|
+
},
|
|
89
|
+
}, async ({ incident_id, investigation_run_id, finding_type, claim, evidence_summary, confidence, confidence_reason, evidence_refs, screenshots, }) => {
|
|
90
|
+
try {
|
|
91
|
+
const reqBody = {
|
|
92
|
+
investigation_run_id,
|
|
93
|
+
finding_type,
|
|
94
|
+
claim,
|
|
95
|
+
evidence_summary,
|
|
96
|
+
confidence,
|
|
97
|
+
confidence_reason,
|
|
98
|
+
evidence_refs: evidence_refs ?? [],
|
|
99
|
+
};
|
|
100
|
+
if (screenshots !== undefined)
|
|
101
|
+
reqBody.screenshots = screenshots;
|
|
102
|
+
const data = await client.post(`/api/v1/incidents/${incident_id}/findings`, reqBody);
|
|
103
|
+
return {
|
|
104
|
+
content: [{ type: "text", text: JSON.stringify(data) }],
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
catch (err) {
|
|
108
|
+
return {
|
|
109
|
+
content: [{ type: "text", text: formatError(err) }],
|
|
110
|
+
isError: true,
|
|
111
|
+
};
|
|
112
|
+
}
|
|
113
|
+
});
|
|
114
|
+
server.registerTool("tellagen_list_findings", {
|
|
115
|
+
description: "List all findings for a Tellagen incident. Returns findings with type, confidence, status, and evidence.",
|
|
116
|
+
inputSchema: {
|
|
117
|
+
incident_id: z.number().int().positive().describe("Incident ID"),
|
|
118
|
+
run_id: z
|
|
119
|
+
.string()
|
|
120
|
+
.optional()
|
|
121
|
+
.describe("Filter by investigation run ID"),
|
|
122
|
+
},
|
|
123
|
+
}, async ({ incident_id, run_id }) => {
|
|
124
|
+
try {
|
|
125
|
+
const query = run_id ? `?run_id=${run_id}` : "";
|
|
126
|
+
const data = await client.get(`/api/v1/incidents/${incident_id}/findings${query}`);
|
|
127
|
+
return {
|
|
128
|
+
content: [{ type: "text", text: JSON.stringify(data) }],
|
|
129
|
+
};
|
|
130
|
+
}
|
|
131
|
+
catch (err) {
|
|
132
|
+
return {
|
|
133
|
+
content: [{ type: "text", text: formatError(err) }],
|
|
134
|
+
isError: true,
|
|
135
|
+
};
|
|
136
|
+
}
|
|
137
|
+
});
|
|
138
|
+
server.registerTool("tellagen_get_finding", {
|
|
139
|
+
description: "Get a single finding by ID. Returns full finding details including evidence refs.",
|
|
140
|
+
inputSchema: {
|
|
141
|
+
finding_id: z.number().int().positive().describe("Finding ID"),
|
|
142
|
+
},
|
|
143
|
+
}, async ({ finding_id }) => {
|
|
144
|
+
try {
|
|
145
|
+
const data = await client.get(`/api/v1/findings/${finding_id}`);
|
|
146
|
+
return {
|
|
147
|
+
content: [{ type: "text", text: JSON.stringify(data) }],
|
|
148
|
+
};
|
|
149
|
+
}
|
|
150
|
+
catch (err) {
|
|
151
|
+
return {
|
|
152
|
+
content: [{ type: "text", text: formatError(err) }],
|
|
153
|
+
isError: true,
|
|
154
|
+
};
|
|
155
|
+
}
|
|
156
|
+
});
|
|
157
|
+
server.registerTool("tellagen_update_finding", {
|
|
158
|
+
description: "Update a finding's status (dismiss or restore to draft). Promoted findings are immutable.",
|
|
159
|
+
inputSchema: {
|
|
160
|
+
finding_id: z.number().int().positive().describe("Finding ID"),
|
|
161
|
+
status: z
|
|
162
|
+
.enum(["draft", "dismissed"])
|
|
163
|
+
.describe("New status for the finding"),
|
|
164
|
+
},
|
|
165
|
+
}, async ({ finding_id, status }) => {
|
|
166
|
+
try {
|
|
167
|
+
const data = await client.patch(`/api/v1/findings/${finding_id}`, {
|
|
168
|
+
status,
|
|
169
|
+
});
|
|
170
|
+
return {
|
|
171
|
+
content: [{ type: "text", text: JSON.stringify(data) }],
|
|
172
|
+
};
|
|
173
|
+
}
|
|
174
|
+
catch (err) {
|
|
175
|
+
return {
|
|
176
|
+
content: [{ type: "text", text: formatError(err) }],
|
|
177
|
+
isError: true,
|
|
178
|
+
};
|
|
179
|
+
}
|
|
180
|
+
});
|
|
181
|
+
server.registerTool("tellagen_promote_finding", {
|
|
182
|
+
description: "Promote a finding to the incident timeline. Creates a timeline event visible in the war room. Optionally override the title and body for the timeline entry.",
|
|
183
|
+
inputSchema: {
|
|
184
|
+
finding_id: z.number().int().positive().describe("Finding ID"),
|
|
185
|
+
title: z
|
|
186
|
+
.string()
|
|
187
|
+
.optional()
|
|
188
|
+
.describe("Custom title for the timeline event (defaults to finding claim)"),
|
|
189
|
+
body: z
|
|
190
|
+
.string()
|
|
191
|
+
.optional()
|
|
192
|
+
.describe("Custom body for the timeline event (defaults to evidence_summary)"),
|
|
193
|
+
is_key: z
|
|
194
|
+
.boolean()
|
|
195
|
+
.optional()
|
|
196
|
+
.describe("Mark as a key event on the timeline"),
|
|
197
|
+
started_at: z
|
|
198
|
+
.string()
|
|
199
|
+
.datetime()
|
|
200
|
+
.optional()
|
|
201
|
+
.describe("ISO 8601 timestamp for when this event started on the timeline (defaults to now)"),
|
|
202
|
+
ended_at: z
|
|
203
|
+
.string()
|
|
204
|
+
.datetime()
|
|
205
|
+
.optional()
|
|
206
|
+
.describe("ISO 8601 timestamp for when this event ended (omit for point events or ongoing)"),
|
|
207
|
+
is_ongoing: z
|
|
208
|
+
.boolean()
|
|
209
|
+
.optional()
|
|
210
|
+
.describe("Mark as an ongoing duration event (ended_at should be omitted)"),
|
|
211
|
+
tags: z
|
|
212
|
+
.array(z.string())
|
|
213
|
+
.optional()
|
|
214
|
+
.describe("Tags for the timeline event (e.g., 'latency', 'database'). Auto-suggested if omitted."),
|
|
215
|
+
evidence_links: z
|
|
216
|
+
.array(z.object({
|
|
217
|
+
source: z.string(),
|
|
218
|
+
url: z.string().url(),
|
|
219
|
+
label: z.string().optional(),
|
|
220
|
+
}))
|
|
221
|
+
.optional()
|
|
222
|
+
.describe("Evidence source links. Auto-extracted from finding evidence_refs if omitted."),
|
|
223
|
+
screenshots: z
|
|
224
|
+
.array(screenshotSchema)
|
|
225
|
+
.optional()
|
|
226
|
+
.describe("Screenshots to attach to the timeline event (e.g., Grafana panels, error dashboards)"),
|
|
227
|
+
},
|
|
228
|
+
}, async ({ finding_id, title, body, is_key, started_at, ended_at, is_ongoing, tags, evidence_links, screenshots, }) => {
|
|
229
|
+
try {
|
|
230
|
+
const reqBody = {};
|
|
231
|
+
if (title !== undefined)
|
|
232
|
+
reqBody.title = title;
|
|
233
|
+
if (body !== undefined)
|
|
234
|
+
reqBody.body = body;
|
|
235
|
+
if (is_key !== undefined)
|
|
236
|
+
reqBody.is_key = is_key;
|
|
237
|
+
if (started_at !== undefined)
|
|
238
|
+
reqBody.started_at = started_at;
|
|
239
|
+
if (ended_at !== undefined)
|
|
240
|
+
reqBody.ended_at = ended_at;
|
|
241
|
+
if (is_ongoing !== undefined)
|
|
242
|
+
reqBody.is_ongoing = is_ongoing;
|
|
243
|
+
if (tags !== undefined)
|
|
244
|
+
reqBody.tags = tags;
|
|
245
|
+
if (evidence_links !== undefined)
|
|
246
|
+
reqBody.evidence_links = evidence_links;
|
|
247
|
+
if (screenshots !== undefined)
|
|
248
|
+
reqBody.screenshots = screenshots;
|
|
249
|
+
const data = await client.post(`/api/v1/findings/${finding_id}/promote`, reqBody);
|
|
250
|
+
return {
|
|
251
|
+
content: [{ type: "text", text: JSON.stringify(data) }],
|
|
252
|
+
};
|
|
253
|
+
}
|
|
254
|
+
catch (err) {
|
|
255
|
+
return {
|
|
256
|
+
content: [{ type: "text", text: formatError(err) }],
|
|
257
|
+
isError: true,
|
|
258
|
+
};
|
|
259
|
+
}
|
|
260
|
+
});
|
|
261
|
+
}
|
|
262
|
+
//# sourceMappingURL=findings.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"findings.js","sourceRoot":"","sources":["../../src/tools/findings.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAE3C,MAAM,gBAAgB,GAAG,CAAC,CAAC,MAAM,CAAC;IAChC,GAAG,EAAE,CAAC;SACH,MAAM,EAAE;SACR,GAAG,EAAE;SACL,QAAQ,EAAE;SACV,QAAQ,CACP,4EAA4E,CAC7E;IACH,MAAM,EAAE,CAAC;SACN,MAAM,EAAE;SACR,QAAQ,EAAE;SACV,QAAQ,CAAC,qEAAqE,CAAC;IAClF,UAAU,EAAE,CAAC;SACV,MAAM,EAAE;SACR,QAAQ,EAAE;SACV,QAAQ,CAAC,6EAA6E,CAAC;IAC1F,OAAO,EAAE,CAAC;SACP,MAAM,EAAE;SACR,QAAQ,EAAE;SACV,QAAQ,CAAC,0CAA0C,CAAC;CACxD,CAAC,CAAC;AAEH,MAAM,iBAAiB,GAAG,CAAC,CAAC,MAAM,CAAC;IACjC,MAA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BAAoB,UAAU,UAAU,EACxC,OAAO,CACR,CAAC;YACF,OAAO;gBACL,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAe,EAAE,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,EAAE,CAAC;aACjE,CAAC;QACJ,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,OAAO;gBACL,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAe,EAAE,IAAI,EAAE,WAAW,CAAC,GAAG,CAAC,EAAE,CAAC;gBAC5D,OAAO,EAAE,IAAI;aACd,CAAC;QACJ,CAAC;IACH,CAAC,CACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { formatError } from "../errors.js";
|
|
3
|
+
export function registerIncidentTools(server, client) {
|
|
4
|
+
server.registerTool("tellagen_get_incident", {
|
|
5
|
+
description: "Get details of a Tellagen incident by ID. Returns severity, status, services, timestamps, and manager info.",
|
|
6
|
+
inputSchema: {
|
|
7
|
+
incident_id: z
|
|
8
|
+
.number()
|
|
9
|
+
.int()
|
|
10
|
+
.positive()
|
|
11
|
+
.describe("Incident ID"),
|
|
12
|
+
},
|
|
13
|
+
}, async ({ incident_id }) => {
|
|
14
|
+
try {
|
|
15
|
+
const data = await client.get(`/api/v1/incidents/${incident_id}`);
|
|
16
|
+
return {
|
|
17
|
+
content: [{ type: "text", text: JSON.stringify(data) }],
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
catch (err) {
|
|
21
|
+
return {
|
|
22
|
+
content: [{ type: "text", text: formatError(err) }],
|
|
23
|
+
isError: true,
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
server.registerTool("tellagen_list_incidents", {
|
|
28
|
+
description: "List all incidents for the current Tellagen workspace. Returns an array of incidents with summary info.",
|
|
29
|
+
inputSchema: {
|
|
30
|
+
status: z
|
|
31
|
+
.enum(["active", "resolved", "all"])
|
|
32
|
+
.optional()
|
|
33
|
+
.describe("Filter by incident status"),
|
|
34
|
+
},
|
|
35
|
+
}, async ({ status }) => {
|
|
36
|
+
try {
|
|
37
|
+
const query = status && status !== "all" ? `?status=${status}` : "";
|
|
38
|
+
const data = await client.get(`/api/v1/incidents${query}`);
|
|
39
|
+
return {
|
|
40
|
+
content: [{ type: "text", text: JSON.stringify(data) }],
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
catch (err) {
|
|
44
|
+
return {
|
|
45
|
+
content: [{ type: "text", text: formatError(err) }],
|
|
46
|
+
isError: true,
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
});
|
|
50
|
+
server.registerTool("tellagen_get_incident_timeline", {
|
|
51
|
+
description: "Get the timeline of events for a Tellagen incident. Shows status changes, key decisions, findings, and notes.",
|
|
52
|
+
inputSchema: {
|
|
53
|
+
incident_id: z
|
|
54
|
+
.number()
|
|
55
|
+
.int()
|
|
56
|
+
.positive()
|
|
57
|
+
.describe("Incident ID"),
|
|
58
|
+
},
|
|
59
|
+
}, async ({ incident_id }) => {
|
|
60
|
+
try {
|
|
61
|
+
const data = await client.get(`/api/v1/incidents/${incident_id}/timeline`);
|
|
62
|
+
return {
|
|
63
|
+
content: [{ type: "text", text: JSON.stringify(data) }],
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
catch (err) {
|
|
67
|
+
return {
|
|
68
|
+
content: [{ type: "text", text: formatError(err) }],
|
|
69
|
+
isError: true,
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
});
|
|
73
|
+
server.registerTool("tellagen_create_incident", {
|
|
74
|
+
description: "Create a new incident in Tellagen. Returns the created incident with its ID and details.",
|
|
75
|
+
inputSchema: {
|
|
76
|
+
service: z
|
|
77
|
+
.string()
|
|
78
|
+
.max(128)
|
|
79
|
+
.optional()
|
|
80
|
+
.describe("Service name"),
|
|
81
|
+
regions: z
|
|
82
|
+
.array(z.string())
|
|
83
|
+
.optional()
|
|
84
|
+
.describe("Affected regions"),
|
|
85
|
+
severity: z
|
|
86
|
+
.string()
|
|
87
|
+
.optional()
|
|
88
|
+
.describe('Severity key (e.g. "sev1", "sev2")'),
|
|
89
|
+
gist: z
|
|
90
|
+
.string()
|
|
91
|
+
.max(12)
|
|
92
|
+
.optional()
|
|
93
|
+
.describe("Short slug summary"),
|
|
94
|
+
doc_url: z
|
|
95
|
+
.string()
|
|
96
|
+
.url()
|
|
97
|
+
.optional()
|
|
98
|
+
.describe("Runbook or postmortem URL"),
|
|
99
|
+
team_id: z
|
|
100
|
+
.number()
|
|
101
|
+
.int()
|
|
102
|
+
.positive()
|
|
103
|
+
.optional()
|
|
104
|
+
.describe("Owning team ID"),
|
|
105
|
+
create_slack_channel: z
|
|
106
|
+
.boolean()
|
|
107
|
+
.optional()
|
|
108
|
+
.describe("Whether to create a Slack channel"),
|
|
109
|
+
invite_usergroups: z
|
|
110
|
+
.array(z.string())
|
|
111
|
+
.optional()
|
|
112
|
+
.describe("Slack usergroup handles to invite"),
|
|
113
|
+
},
|
|
114
|
+
}, async (params) => {
|
|
115
|
+
try {
|
|
116
|
+
const body = {};
|
|
117
|
+
for (const [key, value] of Object.entries(params)) {
|
|
118
|
+
if (value !== undefined) {
|
|
119
|
+
body[key] = value;
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
const data = await client.post("/api/v1/incidents", body);
|
|
123
|
+
return {
|
|
124
|
+
content: [{ type: "text", text: JSON.stringify(data) }],
|
|
125
|
+
};
|
|
126
|
+
}
|
|
127
|
+
catch (err) {
|
|
128
|
+
return {
|
|
129
|
+
content: [{ type: "text", text: formatError(err) }],
|
|
130
|
+
isError: true,
|
|
131
|
+
};
|
|
132
|
+
}
|
|
133
|
+
});
|
|
134
|
+
}
|
|
135
|
+
//# sourceMappingURL=incidents.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"incidents.js","sourceRoot":"","sources":["../../src/tools/incidents.ts"],"names":[],"mapp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MAAM,CAAC,EAAE,CAAC;gBAClD,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;oBACxB,IAAI,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;gBACpB,CAAC;YACH,CAAC;YACD,MAAM,IAAI,GAAG,MAAM,MAAM,CAAC,IAAI,CAAC,mBAAmB,EAAE,IAAI,CAAC,CAAC;YAC1D,OAAO;gBACL,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAe,EAAE,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,EAAE,CAAC;aACjE,CAAC;QACJ,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,OAAO;gBACL,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAe,EAAE,IAAI,EAAE,WAAW,CAAC,GAAG,CAAC,EAAE,CAAC;gBAC5D,OAAO,EAAE,IAAI;aACd,CAAC;QACJ,CAAC;IACH,CAAC,CACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { registerIncidentTools } from "./incidents.js";
|
|
2
|
+
import { registerInvestigationTools } from "./investigations.js";
|
|
3
|
+
import { registerFindingTools } from "./findings.js";
|
|
4
|
+
/** Register all Tellagen MCP tools on the server. */
|
|
5
|
+
export function registerAllTools(server, client) {
|
|
6
|
+
registerIncidentTools(server, client);
|
|
7
|
+
registerInvestigationTools(server, client);
|
|
8
|
+
registerFindingTools(server, client);
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/tools/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,qBAAqB,EAAE,MAAM,gBAAgB,CAAC;AACvD,OAAO,EAAE,0BAA0B,EAAE,MAAM,qBAAqB,CAAC;AACjE,OAAO,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAC;AAErD,qDAAqD;AACrD,MAAM,UAAU,gBAAgB,CAC9B,MAAiB,EACjB,MAAsB;IAEtB,qBAAqB,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACtC,0BAA0B,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC3C,oBAAoB,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;AACvC,CAAC"}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { formatError } from "../errors.js";
|
|
3
|
+
export function registerInvestigationTools(server, client) {
|
|
4
|
+
server.registerTool("tellagen_start_investigation", {
|
|
5
|
+
description: "Start a new AI investigation run on a Tellagen incident. Returns the created run with its ID for posting findings.",
|
|
6
|
+
inputSchema: {
|
|
7
|
+
incident_id: z.number().int().positive().describe("Incident ID"),
|
|
8
|
+
agent_name: z
|
|
9
|
+
.string()
|
|
10
|
+
.min(1)
|
|
11
|
+
.describe('Name of the AI agent performing the investigation (e.g., "Claude Code")'),
|
|
12
|
+
model_used: z
|
|
13
|
+
.string()
|
|
14
|
+
.min(1)
|
|
15
|
+
.describe('Model identifier (e.g., "claude-opus-4-6")'),
|
|
16
|
+
data_sources: z
|
|
17
|
+
.array(z.string())
|
|
18
|
+
.optional()
|
|
19
|
+
.describe('List of data sources the agent will consult (e.g., ["codebase", "grafana-loki", "github"])'),
|
|
20
|
+
},
|
|
21
|
+
}, async ({ incident_id, agent_name, model_used, data_sources }) => {
|
|
22
|
+
try {
|
|
23
|
+
const data = await client.post(`/api/v1/incidents/${incident_id}/investigations`, {
|
|
24
|
+
agent_name,
|
|
25
|
+
model_used,
|
|
26
|
+
data_sources: data_sources ?? [],
|
|
27
|
+
});
|
|
28
|
+
return {
|
|
29
|
+
content: [{ type: "text", text: JSON.stringify(data) }],
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
catch (err) {
|
|
33
|
+
return {
|
|
34
|
+
content: [{ type: "text", text: formatError(err) }],
|
|
35
|
+
isError: true,
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
});
|
|
39
|
+
server.registerTool("tellagen_list_investigation_runs", {
|
|
40
|
+
description: "List all investigation runs for a Tellagen incident. Shows run status, agent info, and finding counts.",
|
|
41
|
+
inputSchema: {
|
|
42
|
+
incident_id: z.number().int().positive().describe("Incident ID"),
|
|
43
|
+
},
|
|
44
|
+
}, async ({ incident_id }) => {
|
|
45
|
+
try {
|
|
46
|
+
const data = await client.get(`/api/v1/incidents/${incident_id}/investigations`);
|
|
47
|
+
return {
|
|
48
|
+
content: [{ type: "text", text: JSON.stringify(data) }],
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
catch (err) {
|
|
52
|
+
return {
|
|
53
|
+
content: [{ type: "text", text: formatError(err) }],
|
|
54
|
+
isError: true,
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
});
|
|
58
|
+
server.registerTool("tellagen_complete_investigation", {
|
|
59
|
+
description: 'Complete or fail an investigation run. Set status to "completed" when done, or "failed" with a failure_reason if the investigation could not finish.',
|
|
60
|
+
inputSchema: {
|
|
61
|
+
run_id: z.string().min(1).describe("Investigation run ID"),
|
|
62
|
+
status: z
|
|
63
|
+
.enum(["completed", "failed"])
|
|
64
|
+
.describe("Final status for the run"),
|
|
65
|
+
failure_reason: z
|
|
66
|
+
.string()
|
|
67
|
+
.optional()
|
|
68
|
+
.describe('Reason for failure (required when status is "failed")'),
|
|
69
|
+
},
|
|
70
|
+
}, async ({ run_id, status, failure_reason }) => {
|
|
71
|
+
try {
|
|
72
|
+
const body = { status };
|
|
73
|
+
if (failure_reason) {
|
|
74
|
+
body.failure_reason = failure_reason;
|
|
75
|
+
}
|
|
76
|
+
const data = await client.patch(`/api/v1/investigations/${run_id}`, body);
|
|
77
|
+
return {
|
|
78
|
+
content: [{ type: "text", text: JSON.stringify(data) }],
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
catch (err) {
|
|
82
|
+
return {
|
|
83
|
+
content: [{ type: "text", text: formatError(err) }],
|
|
84
|
+
isError: true,
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
//# sourceMappingURL=investigations.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"investigations.js","sourceRoot":"","sources":["../../src/tools/investigations.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAE3C,MAAM,UAAU,0BAA0B,CACxC,MAAiB,EACjB,MAAsB;IAEtB,MAAM,CAAC,YAAY,CACjB,8BAA8B,EAC9B;QACE,WAAW,EACT,oHAAoH;QACtH,WAAW,EAAE;YACX,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,aAAa,CAAC;YAChE,UAAU,EAAE,CAAC;iBACV,MAAM,EAAE;iBACR,GAAG,CAAC,CAAC,CAAC;iBACN,QAAQ,CACP,yEAAyE,CAC1E;YACH,UAAU,EAAE,CAAC;iBACV,MAAM,EAAE;iBACR,GAAG,CAAC,CAAC,CAAC;iBACN,QAAQ,CACP,4CAA4C,CAC7C;YACH,YAAY,EAAE,CAAC;iBACZ,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;iBACjB,QAAQ,EAAE;iBACV,QAAQ,CACP,4FAA4F,CAC7F;SACJ;KACF,EACD,KAAK,EAAE,EAAE,WAAW,EAAE,UAAU,EAAE,UAAU,EAAE,YAAY,EAAE,EAAE,EAAE;QAC9D,IAAI,CAAC;YACH,MAAM,IAAI,GAAG,MAAM,MAAM,CAAC,IAAI,CAC5B,qBAAqB,WAAW,iBAAiB,EACjD;gBACE,UAAU;gBACV,UAAU;gBACV,YAAY,EAAE,YAAY,IAAI,EAAE;aACjC,CACF,CAAC;YACF,OAAO;gBACL,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAe,EAAE,IAAI,EAAE,I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