@tellagen/mcp-server 0.5.0 → 0.6.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 +32 -6
- package/SKILL.md +44 -7
- package/contracts/mcp-protocol.json +13 -1
- package/contracts/runbooks/manifest.json +20 -10
- package/contracts/runbooks/v2/client-protocol.json +59 -2
- package/contracts/runbooks/v2/client-writes.guidance.json +16 -1
- package/contracts/runbooks/v2/fixtures/timeline-event-blocks-rejected.json +15 -1
- package/contracts/runbooks/v2/investigation-window.guidance.json +45 -0
- package/contracts/runbooks/v2/question-checks.guidance.json +49 -0
- package/contracts/runbooks/v2/timeline-event-blocks.schema.json +62 -1
- package/contracts/tellagen-runbook-contracts.json +3 -3
- package/dist/cli/doctor.d.ts +19 -0
- package/dist/cli/doctor.js +212 -0
- package/dist/cli/doctor.js.map +1 -0
- package/dist/cli/main.js +5 -0
- package/dist/cli/main.js.map +1 -1
- package/dist/diagnosis-structure.d.ts +131 -106
- package/dist/diagnosis-structure.js +64 -7
- package/dist/diagnosis-structure.js.map +1 -1
- package/dist/doctor/checks.d.ts +42 -0
- package/dist/doctor/checks.js +175 -0
- package/dist/doctor/checks.js.map +1 -0
- package/dist/doctor/config-files.d.ts +49 -0
- package/dist/doctor/config-files.js +121 -0
- package/dist/doctor/config-files.js.map +1 -0
- package/dist/doctor/toml.d.ts +13 -0
- package/dist/doctor/toml.js +205 -0
- package/dist/doctor/toml.js.map +1 -0
- package/dist/figures.d.ts +447 -123
- package/dist/figures.js +297 -5
- package/dist/figures.js.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/k8s-safety.d.ts +42 -0
- package/dist/k8s-safety.js +33 -0
- package/dist/k8s-safety.js.map +1 -0
- package/dist/log-lines.d.ts +118 -0
- package/dist/log-lines.js +534 -0
- package/dist/log-lines.js.map +1 -0
- package/dist/redact.d.ts +21 -0
- package/dist/redact.js +212 -5
- package/dist/redact.js.map +1 -1
- package/dist/run-state.d.ts +37 -0
- package/dist/run-state.js +14 -0
- package/dist/run-state.js.map +1 -1
- package/dist/run-window.d.ts +59 -0
- package/dist/run-window.js +141 -0
- package/dist/run-window.js.map +1 -0
- package/dist/server.d.ts +1 -1
- package/dist/server.js +1 -1
- package/dist/session.d.ts +13 -0
- package/dist/session.js +32 -0
- package/dist/session.js.map +1 -1
- package/dist/source-bases.d.ts +75 -0
- package/dist/source-bases.js +125 -0
- package/dist/source-bases.js.map +1 -0
- package/dist/tool-report.d.ts +2 -0
- package/dist/tool-report.js +3 -0
- package/dist/tool-report.js.map +1 -0
- package/dist/tools/catalog.js +1 -0
- package/dist/tools/catalog.js.map +1 -1
- package/dist/tools/datasources.js +70 -13
- package/dist/tools/datasources.js.map +1 -1
- package/dist/tools/diagnostics.js +85 -2
- package/dist/tools/diagnostics.js.map +1 -1
- package/dist/tools/figures.d.ts +2 -2
- package/dist/tools/figures.js +29 -7
- package/dist/tools/figures.js.map +1 -1
- package/dist/tools/findings.d.ts +8 -0
- package/dist/tools/findings.js +63 -2
- package/dist/tools/findings.js.map +1 -1
- package/dist/tools/investigations.d.ts +1 -1
- package/dist/tools/investigations.js +46 -4
- package/dist/tools/investigations.js.map +1 -1
- package/dist/tools/postmortem-runbooks.d.ts +20 -20
- package/dist/tools/source-links.d.ts +23 -0
- package/dist/tools/source-links.js +53 -16
- package/dist/tools/source-links.js.map +1 -1
- package/dist/tools/timeline.js +13 -2
- package/dist/tools/timeline.js.map +1 -1
- package/dist/version.d.ts +2 -2
- package/dist/version.js +3 -1
- package/dist/version.js.map +1 -1
- package/package.json +1 -1
- package/server.json +5 -5
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
{
|
|
2
|
+
"title": "Investigation pickup: the time window of the run",
|
|
3
|
+
"description": "How to use context.window in the pickup request. The server adds it when the client advertised investigation_window_v1 in protocol_capabilities. The window was stored when the run was created, so it does not change while the run works. The field is left out for a client without the capability and for a run made before windows. The same field is in GET /api/v1/investigations/{id}/context.",
|
|
4
|
+
"x-capability": "investigation_window_v1",
|
|
5
|
+
"x-fields": {
|
|
6
|
+
"from": "Start of the window, an RFC 3339 time.",
|
|
7
|
+
"to": "End of the window. Left out means until the run ends: the incident is still open, so use now.",
|
|
8
|
+
"basis": "Where the window came from: first_signal_moment or first_signal_ongoing (Tellagen proposed it from the incident), person (a person set it) or follow_up (copied from the run this one corrects).",
|
|
9
|
+
"baseline_from": "Start of the baseline, which ends where the window starts. Left out means the run has no baseline.",
|
|
10
|
+
"first_signal_at": "When the first signal of the incident came in. Left out when none is known."
|
|
11
|
+
},
|
|
12
|
+
"x-time-text": "A time with no zone in a request, such as 2026-11-14 00:11, is read as UTC. Send RFC 3339 times to be exact.",
|
|
13
|
+
"x-limits": {
|
|
14
|
+
"window_max_days": 30,
|
|
15
|
+
"default_window_max_hours": 24,
|
|
16
|
+
"baseline_default_days": 7,
|
|
17
|
+
"suggestion_reason_max_chars": 200
|
|
18
|
+
},
|
|
19
|
+
"x-baseline-days": [0, 1, 7, 30],
|
|
20
|
+
"x-guidance": [
|
|
21
|
+
"Search for the cause inside the window: every query that looks for what went wrong uses a range between from and to.",
|
|
22
|
+
"Use the baseline only to learn whether a number is normal, for example the error count of the same hour on earlier days. Never look for the cause in it.",
|
|
23
|
+
"When the signal starts before from or after to, do not search outside the window. Send window_suggestion with the result and say so in a finding. window_suggestion is {from, to, reason}: the same limits as a window, a reason of at most 200 characters, and to may be left out for an open incident.",
|
|
24
|
+
"The server warns evidence_outside_window when a cited source has a time range that reaches outside the window and its baseline together. It is advice, not an error. A count over the baseline does not trigger it.",
|
|
25
|
+
"A window never sets or proposes a root cause. A person accepts a root cause."
|
|
26
|
+
],
|
|
27
|
+
"x-examples": {
|
|
28
|
+
"window": {
|
|
29
|
+
"from": "2026-11-14T00:11:00Z",
|
|
30
|
+
"to": "2026-11-14T01:26:00Z",
|
|
31
|
+
"basis": "first_signal_ongoing",
|
|
32
|
+
"baseline_from": "2026-11-07T00:11:00Z",
|
|
33
|
+
"first_signal_at": "2026-11-14T00:41:00Z"
|
|
34
|
+
},
|
|
35
|
+
"good_suggestion": {
|
|
36
|
+
"from": "2026-11-13T22:00:00Z",
|
|
37
|
+
"to": "2026-11-14T01:26:00Z",
|
|
38
|
+
"reason": "The first 502s are at 22:14, 2 hours before the window starts."
|
|
39
|
+
},
|
|
40
|
+
"bad_suggestion": {
|
|
41
|
+
"from": "2026-10-01T00:00:00Z",
|
|
42
|
+
"reason": "I want more data."
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
{
|
|
2
|
+
"title": "Blocking question as yes or no checks",
|
|
3
|
+
"description": "How to write a gap finding that blocks the diagnosis so that a person can answer it in a few seconds. The server lists question_checks_v1 in server_capabilities at pickup when it accepts checks. A client sends checks only then, and advertises question_checks_v1 in protocol_capabilities to be held to the rule: a blocking gap with no checks gets the completion warning blocking_gap_without_checks, which is advice and never an error. An older client keeps writing the question as one claim and is never warned.",
|
|
4
|
+
"x-capability": "question_checks_v1",
|
|
5
|
+
"x-limits": {
|
|
6
|
+
"checks_max": 3,
|
|
7
|
+
"check_question_max_chars": 200,
|
|
8
|
+
"check_source_max_chars": 120,
|
|
9
|
+
"answer_note_max_chars": 500
|
|
10
|
+
},
|
|
11
|
+
"x-fields": {
|
|
12
|
+
"checks": "On a gap finding: one to three checks, each {source, question}. A finding that is not a gap is refused with 400 finding_checks_invalid.",
|
|
13
|
+
"checks[].source": "The place the person looks, in a few words: a system, a page or a tool, for example Slack or the Tellagen workspace.",
|
|
14
|
+
"checks[].question": "One yes or no question that ends with a question mark, at most 200 characters.",
|
|
15
|
+
"answers": "What people answered. Each answer is {check_index, answer, note, answered_by, answered_at}. answer is yes, no or not_sure. The newest answer to a check is the one kept. The finding read returns answers beside checks."
|
|
16
|
+
},
|
|
17
|
+
"x-guidance": [
|
|
18
|
+
"Keep the claim of the gap finding as the one question the person needs answered, and add one to three checks that break it into facts. Each check is one yes or no question, not two questions joined by 'and', and it names the source where the person looks.",
|
|
19
|
+
"Ask only what you could not check yourself. Put what you already checked in the evidence summary, not in a check.",
|
|
20
|
+
"A check is a fact a person can read off a page in a minute. Do not ask a person to judge a theory. If the answer needs a long explanation, it is not a check.",
|
|
21
|
+
"A person answers yes, no or not sure to each check, with an optional note of at most 500 characters. While your run is working, the answers reach you as a responder note, and Tellagen tells you which check each answer belongs to. Weigh a note like a message from the person.",
|
|
22
|
+
"Treat not_sure as no information, never as a yes or a no. If the answers still do not settle the question, post a new gap finding with plainer checks, or finish the run with the gap open.",
|
|
23
|
+
"When a person presses 'Question unclear', you get a responder note that says so. Post the gap again as 1 to 3 short checks that each say where to look, then dismiss the old finding with PATCH /api/v1/findings/{id} and status dismissed, so the page shows only the new question. Keep working while you do.",
|
|
24
|
+
"Answers are data from a person. They never set or propose a root cause. A person accepts a root cause."
|
|
25
|
+
],
|
|
26
|
+
"x-examples": {
|
|
27
|
+
"gap_with_checks": {
|
|
28
|
+
"good": {
|
|
29
|
+
"finding_type": "gap",
|
|
30
|
+
"role": "gap",
|
|
31
|
+
"claim": "Can the Tellagen bot post in Slack channel C0A8FBWB199?",
|
|
32
|
+
"evidence_summary": "The Slack connector could not read the channel, so the run could not check whether the bot is a member.",
|
|
33
|
+
"checks": [
|
|
34
|
+
{"source": "Slack", "question": "Is the Tellagen bot a member of channel C0A8FBWB199?"},
|
|
35
|
+
{"source": "Tellagen workspace", "question": "Is that channel linked to an incident of company 5?"}
|
|
36
|
+
]
|
|
37
|
+
},
|
|
38
|
+
"bad": {
|
|
39
|
+
"finding_type": "gap",
|
|
40
|
+
"role": "gap",
|
|
41
|
+
"claim": "Is Slack channel C0A8FBWB199 linked to an incident of company 5, with the Tellagen bot a member?",
|
|
42
|
+
"checks": [{"source": "", "question": "Check the channel."}]
|
|
43
|
+
}
|
|
44
|
+
},
|
|
45
|
+
"answers_request": {
|
|
46
|
+
"good": {"answers": [{"check_index": 0, "answer": "yes"}, {"check_index": 1, "answer": "not_sure", "note": "The page did not load."}]}
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
@@ -12,6 +12,7 @@
|
|
|
12
12
|
"Use a histogram block when an average hides a slow tail: bucket edges (3 to 61, increasing) and one count per bucket for before and for after, plus the threshold (an SLO). Tellagen computes p50, p95, p99 and the share over the threshold from the buckets, so send counts, never percentiles.",
|
|
13
13
|
"Use a run_history block for CI builds, scheduled jobs, canaries or deploys: runs oldest first, each with a ref, a result (success, failure, cancelled, pending) and the failing job, repo as owner/name so each run links to its page, marks for the change that introduced and the one that fixed it (between two neighbouring run refs, change_ref regression or fix), and an optional span with a label such as E2E Tests failed. If the history has more than 30 runs, send the 30 that matter (the runs around the break and the fix) and set runs_not_shown to how many you left out, so the strip can say so. A client that picked up a run sends runs_not_shown only when server_capabilities lists figure_extras_v1.",
|
|
14
14
|
"Use a diff block for the change that broke something or fixed it: the file path, the commit ref, the added and removed counts of the whole change (additions and deletions are the size of the whole change, not of the lines you send), and the changed lines in hunks, each with op + or - and the text with its indentation. If the change has 12 or fewer changed lines (in at most 6 hunks), send all of them. If it has more, send the whole hunks the claim cites, in file order, at most 3, and at most 12 changed lines in all; if one hunk alone is longer, cut it after a complete pair of removed and added lines. Never send a changed line without its counterpart: a removed line comes with the line that replaced it, next to it. Add up to 2 unchanged lines (op context) before and after each hunk, and old_no and new_no (1-based) on every line when you know them. Unchanged lines and line numbers are optional, and a client that picked up a run sends them only when server_capabilities lists diff_lines_v1. Never invent a line number: if you do not have the real ones, leave every number out.",
|
|
15
|
+
"Use a log_lines block for log evidence: the lines that prove a claim, or the proof that there are none. Put in matched how many lines the query matched and in scanned how many it looked at, and fill source (kind, datasource, query, from and to) so the page can open the query in Grafana Explore. Send at most 8 lines, the ones that show the event first, each with its time, level and text as the log has them and up to 6 fields. Give every line a relation: matches_event, context, or unrelated, and say in note why an unrelated line is not proof (for example Company 578, 11 hours after the event). A line that looks like proof and is not is the one to mark, never to leave out. When the query found nothing, send matched 0 with scanned, source.from and source.to: 0 of 2,313 lines from 00:26 to 01:26 is proof, an empty list with no range is not. Set event_at to the moment of the event so the page can say how far a line is from it. Never write a line you did not read in a tool result. A client that picked up a run sends log_lines only when server_capabilities lists log_lines_v1.",
|
|
15
16
|
"Set example: true only on a block that stands in for data you did not read from a tool result (a demo or an illustration); a block built from a tool result never sets it.",
|
|
16
17
|
"Tone is a meaning, not decoration: good for a figure that is healthy or recovered, warn for one that needs attention, bad for one that is failing, neutral or no tone for a plain fact. Never use tone to emphasise.",
|
|
17
18
|
"A block owns its numbers. Do not repeat in the note a number that a block already shows; the note says what happened and why, the block says how much.",
|
|
@@ -35,7 +36,8 @@
|
|
|
35
36
|
{"$ref": "#/$defs/range_overlap"},
|
|
36
37
|
{"$ref": "#/$defs/histogram"},
|
|
37
38
|
{"$ref": "#/$defs/run_history"},
|
|
38
|
-
{"$ref": "#/$defs/diff"}
|
|
39
|
+
{"$ref": "#/$defs/diff"},
|
|
40
|
+
{"$ref": "#/$defs/log_lines"}
|
|
39
41
|
]
|
|
40
42
|
},
|
|
41
43
|
"slot": {"const": "summary", "description": "Draws the block above the note. Not together with anchor."},
|
|
@@ -482,6 +484,65 @@
|
|
|
482
484
|
}
|
|
483
485
|
}
|
|
484
486
|
}
|
|
487
|
+
},
|
|
488
|
+
"log_lines": {
|
|
489
|
+
"type": "object",
|
|
490
|
+
"description": "The log lines that prove a claim, or the proof that there are none: how many lines matched out of how many were scanned, in what range, and up to 8 of the matches, each marked by how it relates to the event. Needs log_lines_v1.",
|
|
491
|
+
"additionalProperties": false,
|
|
492
|
+
"required": ["type", "matched"],
|
|
493
|
+
"x-rules": [
|
|
494
|
+
"lines is empty only when matched is 0, and has at most matched lines",
|
|
495
|
+
"lines and lines_not_shown together are at most matched",
|
|
496
|
+
"scanned is not below matched",
|
|
497
|
+
"matched 0 needs scanned, source.from and source.to"
|
|
498
|
+
],
|
|
499
|
+
"properties": {
|
|
500
|
+
"type": {"const": "log_lines"},
|
|
501
|
+
"slot": {"$ref": "#/$defs/slot"},
|
|
502
|
+
"anchor": {"$ref": "#/$defs/anchor"},
|
|
503
|
+
"postmortem": {"$ref": "#/$defs/postmortem"},
|
|
504
|
+
"example": {"$ref": "#/$defs/example"},
|
|
505
|
+
"title": {"type": "string", "maxLength": 80},
|
|
506
|
+
"source": {
|
|
507
|
+
"type": "object",
|
|
508
|
+
"description": "Where the lines came from and the range that was searched. Provenance only: the page builds the Grafana Explore address from it.",
|
|
509
|
+
"additionalProperties": false,
|
|
510
|
+
"properties": {
|
|
511
|
+
"kind": {"type": "string", "maxLength": 80},
|
|
512
|
+
"datasource": {"type": "string", "maxLength": 80},
|
|
513
|
+
"query": {"type": "string", "maxLength": 2000},
|
|
514
|
+
"from": {"type": "string", "format": "date-time"},
|
|
515
|
+
"to": {"type": "string", "format": "date-time", "description": "Not before from."}
|
|
516
|
+
}
|
|
517
|
+
},
|
|
518
|
+
"matched": {"type": "integer", "minimum": 0, "maximum": 1000000000, "description": "How many lines matched the query in the range."},
|
|
519
|
+
"scanned": {"type": "integer", "minimum": 0, "maximum": 1000000000, "description": "How many lines the query looked at. Not below matched."},
|
|
520
|
+
"event_at": {"type": "string", "format": "date-time", "description": "The moment of the event the lines are about."},
|
|
521
|
+
"lines": {
|
|
522
|
+
"type": "array",
|
|
523
|
+
"maxItems": 8,
|
|
524
|
+
"items": {
|
|
525
|
+
"type": "object",
|
|
526
|
+
"additionalProperties": false,
|
|
527
|
+
"required": ["time", "level", "text"],
|
|
528
|
+
"properties": {
|
|
529
|
+
"time": {"type": "string", "format": "date-time"},
|
|
530
|
+
"level": {"enum": ["error", "warn", "info", "debug", "other"]},
|
|
531
|
+
"text": {"type": "string", "minLength": 1, "maxLength": 500, "description": "The line as logged. Tabs are allowed, other control characters are not."},
|
|
532
|
+
"fields": {
|
|
533
|
+
"type": "object",
|
|
534
|
+
"maxProperties": 6,
|
|
535
|
+
"propertyNames": {"maxLength": 40},
|
|
536
|
+
"additionalProperties": {"type": "string", "minLength": 1, "maxLength": 200},
|
|
537
|
+
"description": "Labels or parsed fields of the line, such as task or error."
|
|
538
|
+
},
|
|
539
|
+
"relation": {"enum": ["matches_event", "context", "unrelated"], "description": "unrelated marks a line that looks like proof and is not."},
|
|
540
|
+
"note": {"type": "string", "maxLength": 160, "description": "Why the line is what its relation says."}
|
|
541
|
+
}
|
|
542
|
+
}
|
|
543
|
+
},
|
|
544
|
+
"lines_not_shown": {"type": "integer", "minimum": 0, "maximum": 1000000000, "description": "How many matches are not in lines."}
|
|
545
|
+
}
|
|
485
546
|
}
|
|
486
547
|
}
|
|
487
548
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"upstream_repository": "https://github.com/tellagen/tellagen",
|
|
3
|
-
"upstream_commit": "
|
|
3
|
+
"upstream_commit": "bbd41487ce177598c0ec8c7fb2e597a766941c70",
|
|
4
4
|
"upstream_worktree_dirty": false,
|
|
5
|
-
"contract_version": "2026-11-
|
|
6
|
-
"bundle_sha256": "
|
|
5
|
+
"contract_version": "2026-11-15.2",
|
|
6
|
+
"bundle_sha256": "2b938382ff9164ec69435795c60c7a56d5dd13e61dc5bdd7e7cf67461b47df61",
|
|
7
7
|
"bundle_path": "contracts/runbooks"
|
|
8
8
|
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { TellagenClient } from "../client.js";
|
|
2
|
+
import { type CheckDeps, type ToolResult } from "../doctor/checks.js";
|
|
3
|
+
import { type DoctorFs } from "../doctor/config-files.js";
|
|
4
|
+
import { type CliIo } from "./io.js";
|
|
5
|
+
export declare const DOCTOR_USAGE = "Usage: tellagen-mcp-server doctor [--client claude-code|claude-desktop|codex|cursor] [--tool grafana|kubernetes|github|docs] [--fix] [--report]\n";
|
|
6
|
+
/** The computer this process runs on. */
|
|
7
|
+
export declare function realDoctorFs(): DoctorFs;
|
|
8
|
+
export interface DoctorDeps {
|
|
9
|
+
fs?: DoctorFs;
|
|
10
|
+
shellPath?: string;
|
|
11
|
+
fetch?: CheckDeps["fetch"];
|
|
12
|
+
/** The client that posts the report. Left out, one is built from the environment and the sign-in. */
|
|
13
|
+
reportClient?: () => Promise<TellagenClient>;
|
|
14
|
+
}
|
|
15
|
+
export declare function safeArgs(args: readonly string[]): string[];
|
|
16
|
+
/** The sentence --report sends. A fixed word list: no name, path, value or file text. */
|
|
17
|
+
export declare function reportDetail(result: ToolResult): string;
|
|
18
|
+
/** `doctor`: find why a client cannot see a tool, from the config files of the clients on this computer. */
|
|
19
|
+
export declare function doctorCommand(args: readonly string[], io: CliIo, deps?: DoctorDeps): Promise<number>;
|
|
@@ -0,0 +1,212 @@
|
|
|
1
|
+
import { accessSync, constants, readFileSync, statSync } from "node:fs";
|
|
2
|
+
import { homedir } from "node:os";
|
|
3
|
+
import { createRuntime } from "../bootstrap.js";
|
|
4
|
+
import { checkEntry, DOCTOR_TOOLS, toolOfEntry } from "../doctor/checks.js";
|
|
5
|
+
import { CLIENT_LABELS, DOCTOR_CLIENTS, scanClient, } from "../doctor/config-files.js";
|
|
6
|
+
import { formatError, TellagenAPIError } from "../errors.js";
|
|
7
|
+
import { TOOL_REPORT_PATH } from "../tool-report.js";
|
|
8
|
+
import { MCP_SERVER_VERSION } from "../version.js";
|
|
9
|
+
import { parseArgs } from "./io.js";
|
|
10
|
+
const MAX_CONFIG_BYTES = 4 << 20;
|
|
11
|
+
export const DOCTOR_USAGE = "Usage: tellagen-mcp-server doctor [--client claude-code|claude-desktop|codex|cursor] [--tool grafana|kubernetes|github|docs] [--fix] [--report]\n";
|
|
12
|
+
/** The computer this process runs on. */
|
|
13
|
+
export function realDoctorFs() {
|
|
14
|
+
return {
|
|
15
|
+
platform: process.platform,
|
|
16
|
+
home: homedir(),
|
|
17
|
+
cwd: process.cwd(),
|
|
18
|
+
appData: process.env.APPDATA ?? "",
|
|
19
|
+
xdgConfig: process.env.XDG_CONFIG_HOME ?? "",
|
|
20
|
+
readText(path) {
|
|
21
|
+
try {
|
|
22
|
+
if (statSync(path).size > MAX_CONFIG_BYTES)
|
|
23
|
+
return undefined;
|
|
24
|
+
return readFileSync(path, "utf8");
|
|
25
|
+
}
|
|
26
|
+
catch {
|
|
27
|
+
return undefined;
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
isExecutable(path) {
|
|
31
|
+
try {
|
|
32
|
+
if (!statSync(path).isFile())
|
|
33
|
+
return false;
|
|
34
|
+
if (process.platform !== "win32")
|
|
35
|
+
accessSync(path, constants.X_OK);
|
|
36
|
+
return true;
|
|
37
|
+
}
|
|
38
|
+
catch {
|
|
39
|
+
return false;
|
|
40
|
+
}
|
|
41
|
+
},
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
/** One line of what a person does to read the result: the status word first. */
|
|
45
|
+
function statusWord(status) {
|
|
46
|
+
return status === "ok" ? "ok " : status === "failed" ? "FAIL" : "warn";
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Args the doctor prints: flags that take no value and names of programs and
|
|
50
|
+
* packages it recognises. Anything else, including any value that follows a
|
|
51
|
+
* flag, prints as a placeholder, because the output may be pasted.
|
|
52
|
+
*/
|
|
53
|
+
const SAFE_ARGS = new Set([
|
|
54
|
+
"-y", "--yes", "-q", "--quiet", "--stdio", "stdio", "server", "run", "-i", "--rm",
|
|
55
|
+
"npx", "uvx", "node", "mcp-grafana", "kubernetes-mcp-server", "mcp-server-kubernetes",
|
|
56
|
+
"github-mcp-server", "@modelcontextprotocol/server-github", "@tellagen/mcp-server", "docs-mcp",
|
|
57
|
+
]);
|
|
58
|
+
export function safeArgs(args) {
|
|
59
|
+
return args.map((arg) => (SAFE_ARGS.has(arg) ? arg : "<keep your arg>"));
|
|
60
|
+
}
|
|
61
|
+
/** A corrected entry for the person to paste. Env values are never printed, only their names. */
|
|
62
|
+
function correctedEntry(result, fixCommand) {
|
|
63
|
+
const entry = result.entry;
|
|
64
|
+
const envNames = Object.keys(entry.env);
|
|
65
|
+
const args = safeArgs(entry.args);
|
|
66
|
+
if (entry.client === "codex") {
|
|
67
|
+
const lines = [`[mcp_servers.${JSON.stringify(entry.name).slice(1, -1)}]`, `command = ${JSON.stringify(fixCommand)}`];
|
|
68
|
+
if (args.length > 0)
|
|
69
|
+
lines.push(`args = [${args.map((a) => JSON.stringify(a)).join(", ")}]`);
|
|
70
|
+
if (envNames.length > 0)
|
|
71
|
+
lines.push(`env = { ${envNames.map((n) => `${n} = "<keep your value>"`).join(", ")} }`);
|
|
72
|
+
return lines.join("\n");
|
|
73
|
+
}
|
|
74
|
+
const body = { command: fixCommand };
|
|
75
|
+
if (args.length > 0)
|
|
76
|
+
body.args = args;
|
|
77
|
+
if (envNames.length > 0)
|
|
78
|
+
body.env = Object.fromEntries(envNames.map((n) => [n, "<keep your value>"]));
|
|
79
|
+
return JSON.stringify({ [entry.name]: body }, null, 2);
|
|
80
|
+
}
|
|
81
|
+
function printReport(io, reports, wanted, fix) {
|
|
82
|
+
let problems = false;
|
|
83
|
+
for (const { scan, results } of reports) {
|
|
84
|
+
const label = CLIENT_LABELS[scan.client];
|
|
85
|
+
if (scan.filesRead.length === 0 && scan.unreadable.length === 0) {
|
|
86
|
+
io.stdout(`${label}: no config file found.\n`);
|
|
87
|
+
continue;
|
|
88
|
+
}
|
|
89
|
+
io.stdout(`${label} (read: ${scan.filesRead.join(", ") || "nothing"})\n`);
|
|
90
|
+
for (const name of scan.unreadable)
|
|
91
|
+
io.stdout(` Could not read ${name} as a config file. Open it and check that it is valid.\n`);
|
|
92
|
+
if (results.length === 0) {
|
|
93
|
+
io.stdout(wanted ? ` No ${wanted} server in this client's config.\n` : " No grafana, kubernetes, github or docs server in this client's config.\n");
|
|
94
|
+
continue;
|
|
95
|
+
}
|
|
96
|
+
for (const result of results) {
|
|
97
|
+
io.stdout(` ${result.tool}: server "${result.serverName}" (${result.source})\n`);
|
|
98
|
+
for (const check of result.checks) {
|
|
99
|
+
io.stdout(` ${statusWord(check.status)} ${check.summary}\n`);
|
|
100
|
+
if (fix && check.fixCommand)
|
|
101
|
+
io.stdout(`\n Corrected entry (print only; nothing was changed):\n${correctedEntry(result, check.fixCommand).replace(/^/gm, " ")}\n\n`);
|
|
102
|
+
}
|
|
103
|
+
if (result.checks.length === 0)
|
|
104
|
+
io.stdout(" Nothing to check for this entry.\n");
|
|
105
|
+
if (result.problem)
|
|
106
|
+
problems = true;
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
return problems;
|
|
110
|
+
}
|
|
111
|
+
/** A tool has a problem only when every server of the client that is this tool has one. */
|
|
112
|
+
function problemsByTool(results) {
|
|
113
|
+
const out = new Map();
|
|
114
|
+
for (const tool of DOCTOR_TOOLS) {
|
|
115
|
+
const mine = results.filter((r) => r.tool === tool);
|
|
116
|
+
if (mine.length > 0 && mine.every((r) => r.problem))
|
|
117
|
+
out.set(tool, mine[0]);
|
|
118
|
+
}
|
|
119
|
+
return out;
|
|
120
|
+
}
|
|
121
|
+
/** The sentence --report sends. A fixed word list: no name, path, value or file text. */
|
|
122
|
+
export function reportDetail(result) {
|
|
123
|
+
const failed = result.checks.find((check) => check.status === "failed");
|
|
124
|
+
return (failed?.reportSummary ?? "The doctor found a problem in the client config.").slice(0, 200);
|
|
125
|
+
}
|
|
126
|
+
async function sendReports(io, reports, deps) {
|
|
127
|
+
const sent = [];
|
|
128
|
+
const client = await (deps.reportClient ?? (async () => (await createRuntime(io.env)).client))();
|
|
129
|
+
for (const { scan, results } of reports) {
|
|
130
|
+
const problems = problemsByTool(results);
|
|
131
|
+
if (problems.size === 0)
|
|
132
|
+
continue;
|
|
133
|
+
client.session.identity = { name: scan.client, label: CLIENT_LABELS[scan.client], version: "" };
|
|
134
|
+
const sources = [...problems.entries()].map(([tool, result]) => ({ key: tool, state: "not_found", access_status: result.problem ?? "missing_tool", detail: reportDetail(result) }));
|
|
135
|
+
try {
|
|
136
|
+
await client.post(TOOL_REPORT_PATH, { available_sources: sources }, { safeToRepeat: true });
|
|
137
|
+
sent.push(`${CLIENT_LABELS[scan.client]}: ${[...problems.keys()].join(", ")}`);
|
|
138
|
+
}
|
|
139
|
+
catch (err) {
|
|
140
|
+
if (err instanceof TellagenAPIError && (err.status === 404 || err.status === 405)) {
|
|
141
|
+
io.stderr("This Tellagen does not take a tool report without a check yet. Run the doctor without --report, or ask an admin to update Tellagen.\n");
|
|
142
|
+
return 1;
|
|
143
|
+
}
|
|
144
|
+
const text = formatError(err);
|
|
145
|
+
let message = text;
|
|
146
|
+
try {
|
|
147
|
+
message = JSON.parse(text).message ?? text;
|
|
148
|
+
}
|
|
149
|
+
catch {
|
|
150
|
+
/* keep the text */
|
|
151
|
+
}
|
|
152
|
+
io.stderr(`Could not report ${CLIENT_LABELS[scan.client]}: ${message}\n`);
|
|
153
|
+
return 1;
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
if (sent.length === 0)
|
|
157
|
+
io.stdout("Nothing was reported: the doctor found no problem. It never reports a tool as found, because only a running session can show that.\n");
|
|
158
|
+
else
|
|
159
|
+
io.stdout(`Reported to Tellagen (names and statuses only, no paths, values or file text): ${sent.join("; ")}.\n`);
|
|
160
|
+
return 0;
|
|
161
|
+
}
|
|
162
|
+
/** `doctor`: find why a client cannot see a tool, from the config files of the clients on this computer. */
|
|
163
|
+
export async function doctorCommand(args, io, deps = {}) {
|
|
164
|
+
const parsed = parseArgs(args, ["client", "tool"], ["fix", "report", "help"]);
|
|
165
|
+
if (parsed.unknown.length > 0 || parsed.positional.length > 0 || parsed.flags.has("help")) {
|
|
166
|
+
io.stderr(DOCTOR_USAGE);
|
|
167
|
+
return parsed.flags.has("help") ? 0 : 2;
|
|
168
|
+
}
|
|
169
|
+
const clientArg = parsed.values.client;
|
|
170
|
+
if (clientArg !== undefined && !DOCTOR_CLIENTS.includes(clientArg)) {
|
|
171
|
+
io.stderr(`Unknown client "${clientArg.slice(0, 40)}". Use one of: ${DOCTOR_CLIENTS.join(", ")}.\n`);
|
|
172
|
+
return 2;
|
|
173
|
+
}
|
|
174
|
+
const toolArg = parsed.values.tool;
|
|
175
|
+
if (toolArg !== undefined && !DOCTOR_TOOLS.includes(toolArg)) {
|
|
176
|
+
io.stderr(`Unknown tool "${toolArg.slice(0, 40)}". Use one of: ${DOCTOR_TOOLS.join(", ")}.\n`);
|
|
177
|
+
return 2;
|
|
178
|
+
}
|
|
179
|
+
const wanted = toolArg;
|
|
180
|
+
const fs = deps.fs ?? realDoctorFs();
|
|
181
|
+
const checkDeps = {
|
|
182
|
+
fs,
|
|
183
|
+
shellPath: deps.shellPath ?? io.env.PATH ?? io.env.Path ?? "",
|
|
184
|
+
fetch: deps.fetch ?? ((url, init) => fetch(url, { ...init, redirect: "manual" })),
|
|
185
|
+
};
|
|
186
|
+
io.stdout(`Tellagen doctor ${MCP_SERVER_VERSION}\n`);
|
|
187
|
+
io.stdout("It reads the MCP config files of the AI clients on this computer, because you ran it. It never changes them");
|
|
188
|
+
io.stdout(parsed.flags.has("report") ? " and sends only names and statuses to Tellagen.\n\n" : " and sends nothing to Tellagen.\n\n");
|
|
189
|
+
const reports = [];
|
|
190
|
+
for (const client of (clientArg ? [clientArg] : DOCTOR_CLIENTS)) {
|
|
191
|
+
const scan = scanClient(client, fs);
|
|
192
|
+
const results = [];
|
|
193
|
+
for (const entry of scan.entries) {
|
|
194
|
+
const tool = toolOfEntry(entry);
|
|
195
|
+
if (!tool || (wanted && tool !== wanted))
|
|
196
|
+
continue;
|
|
197
|
+
results.push(await checkEntry(entry, tool, checkDeps));
|
|
198
|
+
}
|
|
199
|
+
reports.push({ scan, results });
|
|
200
|
+
}
|
|
201
|
+
const problems = printReport(io, reports, wanted, parsed.flags.has("fix"));
|
|
202
|
+
io.stdout("\nThe doctor cannot see a running session: it reads config files only. The model check (Recheck in Tellagen settings, or /tellagen:check-tools) is still the truth for a session.\n");
|
|
203
|
+
if (!wanted || wanted === "kubernetes")
|
|
204
|
+
io.stdout("It does not test what a Kubernetes identity can change. The model check reports that.\n");
|
|
205
|
+
if (parsed.flags.has("report")) {
|
|
206
|
+
const code = await sendReports(io, reports, deps);
|
|
207
|
+
if (code !== 0)
|
|
208
|
+
return code;
|
|
209
|
+
}
|
|
210
|
+
return problems ? 1 : 0;
|
|
211
|
+
}
|
|
212
|
+
//# sourceMappingURL=doctor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"doctor.js","sourceRoot":"","sources":["../../src/cli/doctor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AACxE,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAElC,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,WAAW,EAAoD,MAAM,qBAAqB,CAAC;AAC9H,OAAO,EACL,aAAa,EACb,cAAc,EACd,UAAU,GAIX,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAE,WAAW,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAC7D,OAAO,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AACrD,OAAO,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AACnD,OAAO,EAAE,SAAS,EAAc,MAAM,SAAS,CAAC;AAEhD,MAAM,gBAAgB,GAAG,CAAC,IAAI,EAAE,CAAC;AAEjC,MAAM,CAAC,MAAM,YAAY,GACvB,mJAAmJ,CAAC;AAEtJ,yCAAyC;AACzC,MAAM,UAAU,YAAY;IAC1B,OAAO;QACL,QAAQ,EAAE,OAAO,CAAC,QAAQ;QAC1B,IAAI,EAAE,OAAO,EAAE;QACf,GAAG,EAAE,OAAO,CAAC,GAAG,EAAE;QAClB,OAAO,EAAE,OAAO,CAAC,GAAG,CAAC,OAAO,IAAI,EAAE;QAClC,SAAS,EAAE,OAAO,CAAC,GAAG,CAAC,eAAe,IAAI,EAAE;QAC5C,QAAQ,CAAC,IAAI;YACX,IAAI,CAAC;gBACH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,MAAM,CAAC;gBAAE,SAAS;YACnD,OAAO,CAAC,IAAI,CAAC,MAAM,UAAU,CAAC,KAAK,EAAE,IAAI,EAAE,SAAS,CAAC,CAAC,CAAC;QACzD,CAAC;QACD,OAAO,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC,CAAC;IAClC,CAAC;IAED,MAAM,QAAQ,GAAG,WAAW,CAAC,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC;IAC3E,EAAE,CAAC,MAAM,CAAC,qLAAqL,CAAC,CAAC;IACjM,IAAI,CAAC,MAAM,IAAI,MAAM,KAAK,YAAY;QAAE,EAAE,CAAC,MAAM,CAAC,yFAAyF,CAAC,CAAC;IAE7I,IAAI,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,QAAQ,CAAC,EAAE,CAAC;QAC/B,MAAM,IAAI,GAAG,MAAM,WAAW,CAAC,EAAE,EAAE,OAAO,EAAE,IAAI,CAAC,CAAC;QAClD,IAAI,IAAI,KAAK,CAAC;YAAE,OAAO,IAAI,CAAC;IAC9B,CAAC;IACD,OAAO,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AAC1B,CAAC"}
|
package/dist/cli/main.js
CHANGED
|
@@ -10,6 +10,7 @@ Commands
|
|
|
10
10
|
logout Remove the stored key from this computer.
|
|
11
11
|
status Show the sign-in. With --line: one sentence for a client hook, or nothing.
|
|
12
12
|
listen Take diagnosis runs that wait in Tellagen and run them with your AI client, with no window.
|
|
13
|
+
doctor Find why an AI client cannot see a tool, from its config files. Reads only; --report sends names and statuses.
|
|
13
14
|
trace-hook Record one tool call of a client hook as a step of the open run (reads the hook event on standard input).
|
|
14
15
|
|
|
15
16
|
Settings: TELLAGEN_API_KEY and TELLAGEN_API_URL win over a stored sign-in. TELLAGEN_HOME moves the folder ~/.tellagen.
|
|
@@ -41,6 +42,10 @@ export async function runCli(command, args, io = realIo) {
|
|
|
41
42
|
}
|
|
42
43
|
return runWrapped(parsed);
|
|
43
44
|
}
|
|
45
|
+
case "doctor": {
|
|
46
|
+
const { doctorCommand } = await import("./doctor.js");
|
|
47
|
+
return doctorCommand(args, io);
|
|
48
|
+
}
|
|
44
49
|
case "trace-hook": {
|
|
45
50
|
const { traceHookCommand } = await import("./trace-hook.js");
|
|
46
51
|
return traceHookCommand(args, io);
|
package/dist/cli/main.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"main.js","sourceRoot":"","sources":["../../src/cli/main.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AACnD,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AACvE,OAAO,EAAc,MAAM,EAAE,MAAM,SAAS,CAAC;AAE7C,MAAM,IAAI,GAAG,uBAAuB,kBAAkB
|
|
1
|
+
{"version":3,"file":"main.js","sourceRoot":"","sources":["../../src/cli/main.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AACnD,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AACvE,OAAO,EAAc,MAAM,EAAE,MAAM,SAAS,CAAC;AAE7C,MAAM,IAAI,GAAG,uBAAuB,kBAAkB;;;;;;;;;;;;;CAarD,CAAC;AAEF,gDAAgD;AAChD,MAAM,CAAC,KAAK,UAAU,MAAM,CAAC,OAAe,EAAE,IAAuB,EAAE,KAAY,MAAM;IACvF,QAAQ,OAAO,EAAE,CAAC;QAChB,KAAK,OAAO;YACV,OAAO,YAAY,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;QAChC,KAAK,QAAQ;YACX,OAAO,aAAa,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;QACjC,KAAK,QAAQ;YACX,OAAO,aAAa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