@agentrysh/mcp 0.0.1

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/dist/index.js ADDED
@@ -0,0 +1,40 @@
1
+ #!/usr/bin/env node
2
+ // Agentry stdio MCP server. Runs in the user's Claude Code via stdio.
3
+ // Talks to the agentry API over HTTPS using the user's API key.
4
+ import { Server } from "@modelcontextprotocol/sdk/server/index.js";
5
+ import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
6
+ import { CallToolRequestSchema, ListToolsRequestSchema, } from "@modelcontextprotocol/sdk/types.js";
7
+ import { TOOL_DESCRIPTORS, dispatchTool } from "./tools.js";
8
+ async function main() {
9
+ const server = new Server({ name: "agentry", version: "0.0.1" }, { capabilities: { tools: {} } });
10
+ server.setRequestHandler(ListToolsRequestSchema, async () => ({
11
+ tools: TOOL_DESCRIPTORS,
12
+ }));
13
+ server.setRequestHandler(CallToolRequestSchema, async (req) => {
14
+ const name = req.params.name;
15
+ const args = (req.params.arguments ?? {});
16
+ const result = await dispatchTool(name, args);
17
+ // MCP content blocks: return a single JSON text block. Agents parse it.
18
+ return {
19
+ content: [
20
+ {
21
+ type: "text",
22
+ text: JSON.stringify(result, null, 2),
23
+ },
24
+ ],
25
+ // If the result has a top-level `error`, signal that to the client too.
26
+ isError: Boolean(result.error),
27
+ };
28
+ });
29
+ const transport = new StdioServerTransport();
30
+ await server.connect(transport);
31
+ // Keep the process alive — connect() returns once the transport is ready,
32
+ // not when it closes. The transport handles its own lifecycle on stdin EOF.
33
+ }
34
+ main().catch((err) => {
35
+ // stderr is the only safe channel — stdout is the MCP protocol.
36
+ // eslint-disable-next-line no-console
37
+ console.error("[agentry-mcp] fatal:", err instanceof Error ? err.stack ?? err.message : err);
38
+ process.exit(1);
39
+ });
40
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AACA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CAAC,SAAS,CAAC,CAAC;IAChC,0EAA0E;IAC1E,4EAA4E;AAC9E,CAAC;AAED,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC,GAAY,EAAE,EAAE;IAC5B,gEAAgE;IAChE,sCAAsC;IACtC,OAAO,CAAC,KAAK,CAAC,sBAAsB,EAAE,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,KAAK,IAAI,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;IAC7F,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC"}
@@ -0,0 +1,24 @@
1
+ export declare const MEMORY_FILENAME = "agentry_memory.md";
2
+ export interface RememberInput {
3
+ case_id: string;
4
+ /** Short markdown body — what was learned. */
5
+ summary: string;
6
+ /** Optional structured fields surfaced as bullets. */
7
+ fingerprint?: string;
8
+ status?: string;
9
+ error_type?: string;
10
+ pr_url?: string;
11
+ watch_for?: string;
12
+ tags?: string[];
13
+ }
14
+ export interface RememberResult {
15
+ ok: boolean;
16
+ file_path: string;
17
+ action: "created" | "appended" | "updated";
18
+ next_action: string;
19
+ }
20
+ export declare function getMemoryPath(localPath: string | null | undefined): string | null;
21
+ export declare function ensureMemoryFile(filePath: string): "created" | "exists";
22
+ export declare function upsertCaseSection(filePath: string, input: RememberInput): "created" | "appended" | "updated";
23
+ export declare function readCaseSection(filePath: string, caseId: string): string | null;
24
+ //# sourceMappingURL=memory.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"memory.d.ts","sourceRoot":"","sources":["../src/memory.ts"],"names":[],"mappings":"AAcA,eAAO,MAAM,eAAe,sBAAsB,CAAC;AAYnD,MAAM,WAAW,aAAa;IAC5B,OAAO,EAAE,MAAM,CAAC;IAChB,8CAA8C;IAC9C,OAAO,EAAE,MAAM,CAAC;IAChB,sDAAsD;IACtD,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;CACjB;AAED,MAAM,WAAW,cAAc;IAC7B,EAAE,EAAE,OAAO,CAAC;IACZ,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,SAAS,GAAG,UAAU,GAAG,SAAS,CAAC;IAC3C,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,wBAAgB,aAAa,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,MAAM,GAAG,IAAI,CAGjF;AAED,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,MAAM,GAAG,SAAS,GAAG,QAAQ,CAMvE;AAwBD,wBAAgB,iBAAiB,CAC/B,QAAQ,EAAE,MAAM,EAChB,KAAK,EAAE,aAAa,GACnB,SAAS,GAAG,UAAU,GAAG,SAAS,CA4BpC;AAED,wBAAgB,eAAe,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAS/E"}
package/dist/memory.js ADDED
@@ -0,0 +1,99 @@
1
+ // Local agent memory: a markdown file in the customer's repo at
2
+ // `<local_path>/agentry_memory.md`. Each case gets a section the agent can
3
+ // upsert; the file is grep-able, git-versionable, and human-editable.
4
+ //
5
+ // Why a local file instead of a server table:
6
+ // - Survives even if agentry's server data is lost
7
+ // - Grep-able with the agent's existing Read/Grep/Glob tools — no extra MCP needed for read
8
+ // - Git-versioned with the customer's code (commit or .gitignore is their call)
9
+ // - The customer can edit it directly; the agent will see those edits
10
+ // - No server-side schema for what is fundamentally tacit knowledge
11
+ import * as fs from "node:fs";
12
+ import * as path from "node:path";
13
+ export const MEMORY_FILENAME = "agentry_memory.md";
14
+ const HEADER = `# Agentry memory
15
+
16
+ Notes the agent has accumulated investigating cases. Safe to commit (no secrets here).
17
+
18
+ Each \`## Case <id>\` section is upserted by \`agentry_remember\`. The agent reads
19
+ this file directly with its built-in file tools when investigating a similar case.
20
+
21
+ ---
22
+ `;
23
+ export function getMemoryPath(localPath) {
24
+ if (!localPath)
25
+ return null;
26
+ return path.join(localPath, MEMORY_FILENAME);
27
+ }
28
+ export function ensureMemoryFile(filePath) {
29
+ if (fs.existsSync(filePath))
30
+ return "exists";
31
+ const dir = path.dirname(filePath);
32
+ if (!fs.existsSync(dir))
33
+ fs.mkdirSync(dir, { recursive: true });
34
+ fs.writeFileSync(filePath, HEADER, "utf8");
35
+ return "created";
36
+ }
37
+ function buildSection(input) {
38
+ const ts = new Date().toISOString();
39
+ const lines = [];
40
+ lines.push(`## Case ${input.case_id}`);
41
+ if (input.error_type)
42
+ lines.push(`- **Error type**: ${input.error_type}`);
43
+ if (input.fingerprint)
44
+ lines.push(`- **Fingerprint**: \`${input.fingerprint}\``);
45
+ if (input.status)
46
+ lines.push(`- **Status**: ${input.status}`);
47
+ lines.push(`- **Last touched**: ${ts}`);
48
+ if (input.pr_url)
49
+ lines.push(`- **PR**: ${input.pr_url}`);
50
+ if (input.tags && input.tags.length > 0) {
51
+ lines.push(`- **Tags**: ${input.tags.map((t) => "`" + t + "`").join(", ")}`);
52
+ }
53
+ lines.push("");
54
+ lines.push(input.summary.trim());
55
+ if (input.watch_for) {
56
+ lines.push("");
57
+ lines.push(`**Watch for:** ${input.watch_for.trim()}`);
58
+ }
59
+ lines.push("");
60
+ return lines.join("\n");
61
+ }
62
+ export function upsertCaseSection(filePath, input) {
63
+ const initState = ensureMemoryFile(filePath);
64
+ const existing = fs.readFileSync(filePath, "utf8");
65
+ const sectionHeader = `## Case ${input.case_id}`;
66
+ // Find existing section start.
67
+ const headerIdx = existing.indexOf(sectionHeader);
68
+ if (headerIdx === -1) {
69
+ // Append a new section.
70
+ const newSection = buildSection(input);
71
+ const sep = existing.endsWith("\n") ? "" : "\n";
72
+ fs.writeFileSync(filePath, `${existing}${sep}\n${newSection}\n`, "utf8");
73
+ return initState === "created" ? "created" : "appended";
74
+ }
75
+ // Find next section header (## Case ...) or end of file.
76
+ const after = existing.slice(headerIdx + sectionHeader.length);
77
+ const nextSectionRel = after.search(/\n## Case /);
78
+ const sectionEnd = nextSectionRel === -1
79
+ ? existing.length
80
+ : headerIdx + sectionHeader.length + nextSectionRel + 1; // +1 to keep the blank line before next section
81
+ const before = existing.slice(0, headerIdx);
82
+ const afterSection = existing.slice(sectionEnd);
83
+ const replaced = `${before}${buildSection(input)}\n${afterSection.trimStart()}`;
84
+ fs.writeFileSync(filePath, replaced, "utf8");
85
+ return "updated";
86
+ }
87
+ export function readCaseSection(filePath, caseId) {
88
+ if (!fs.existsSync(filePath))
89
+ return null;
90
+ const text = fs.readFileSync(filePath, "utf8");
91
+ const header = `## Case ${caseId}`;
92
+ const idx = text.indexOf(header);
93
+ if (idx === -1)
94
+ return null;
95
+ const after = text.slice(idx);
96
+ const nextRel = after.slice(header.length).search(/\n## Case /);
97
+ return nextRel === -1 ? after : after.slice(0, header.length + nextRel + 1);
98
+ }
99
+ //# sourceMappingURL=memory.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"memory.js","sourceRoot":"","sources":["../src/memory.ts"],"names":[],"mappings":"AAAA,gEAAgE;AAChE,2EAA2E;AAC3E,sEAAsE;AACtE,EAAE;AACF,8CAA8C;AAC9C,qDAAqD;AACrD,8FAA8F;AAC9F,kFAAkF;AAClF,wEAAwE;AACxE,sEAAsE;AAEtE,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAElC,MAAM,CAAC,MAAM,eAAe,GAAG,mBAAmB,CAAC;AAEnD,MAAM,MAAM,GAAG;;;;;;;;CAQd,CAAC;AAsBF,MAAM,UAAU,aAAa,CAAC,SAAoC;IAChE,IAAI,CAAC,SAAS;QAAE,OAAO,IAAI,CAAC;IAC5B,OAAO,IAAI,CAAC,IAAI,CAAC,SA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AC,CAAC;IACjC,IAAI,GAAG,KAAK,CAAC,CAAC;QAAE,OAAO,IAAI,CAAC;IAC5B,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IAC9B,MAAM,OAAO,GAAG,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC;IAChE,OAAO,OAAO,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,MAAM,CAAC,MAAM,GAAG,OAAO,GAAG,CAAC,CAAC,CAAC;AAC9E,CAAC"}
@@ -0,0 +1,10 @@
1
+ import type { AgentryConfig } from "@agentrysh/shared";
2
+ export type OnboardingState = "no_key" | "no_project" | "needs_install" | "ready";
3
+ export interface OnboardingHint {
4
+ state: OnboardingState;
5
+ next_tool: string | null;
6
+ next_action: string;
7
+ message: string;
8
+ }
9
+ export declare function getOnboardingHint(cfg: AgentryConfig): OnboardingHint;
10
+ //# sourceMappingURL=onboarding.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"onboarding.d.ts","sourceRoot":"","sources":["../src/onboarding.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAEvD,MAAM,MAAM,eAAe,GAAG,QAAQ,GAAG,YAAY,GAAG,eAAe,GAAG,OAAO,CAAC;AAElF,MAAM,WAAW,cAAc;IAC7B,KAAK,EAAE,eAAe,CAAC;IACvB,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,aAAa,GAAG,cAAc,CAgDpE"}
@@ -0,0 +1,46 @@
1
+ // Compute structured onboarding hints for the agent.
2
+ // agentry_status pipes this through; tools also return individual hints.
3
+ export function getOnboardingHint(cfg) {
4
+ if (!cfg.api_key) {
5
+ return {
6
+ state: "no_key",
7
+ next_tool: "agentry_login",
8
+ next_action: "Call `agentry_login`. It returns a verification URL and a short user_code; " +
9
+ "ask the user to open the URL in their browser and paste the code. " +
10
+ "The tool blocks until GitHub authorizes (~30s), then persists the api_key locally.",
11
+ message: "No API key on file. Call `agentry_login` to authenticate via GitHub (no email or password required).",
12
+ };
13
+ }
14
+ const projectIds = Object.keys(cfg.projects);
15
+ if (projectIds.length === 0 || !cfg.default_project_id) {
16
+ return {
17
+ state: "no_project",
18
+ next_tool: "agentry_create_project",
19
+ next_action: "Ask the user for a project name (and optionally repo_url + local_path of the repo), " +
20
+ "then call `agentry_create_project`. The response includes the DSN and SDK install snippet.",
21
+ message: "API key on file, but no project yet. Call `agentry_create_project` to mint a DSN.",
22
+ };
23
+ }
24
+ // After project creation, the SDK isn't installed yet in the customer's app.
25
+ // We don't know for sure — but we lean on a local marker. If install_verified
26
+ // hasn't been set on any project, treat as needs_install.
27
+ const anyVerified = projectIds.some((id) => cfg.projects[id]?.install_verified === true);
28
+ if (!anyVerified) {
29
+ return {
30
+ state: "needs_install",
31
+ next_tool: "agentry_install_guide",
32
+ next_action: "Project created, but the SDK isn't proven installed yet. " +
33
+ "Call `agentry_install_guide` for the comprehensive checklist, walk through it, then call " +
34
+ "`agentry_verify_install` — that's how we know errors, analytics, and deploys are actually flowing.",
35
+ message: "Project ready, but install hasn't been verified. Run agentry_install_guide → agentry_verify_install.",
36
+ };
37
+ }
38
+ return {
39
+ state: "ready",
40
+ next_tool: "agentry_list_cases",
41
+ next_action: "Onboarding done. Call `agentry_list_cases` to see open errors, or " +
42
+ "`agentry_analytics_query` to investigate funnels.",
43
+ message: "Set up — install verified, signals flowing. Ready to investigate.",
44
+ };
45
+ }
46
+ //# sourceMappingURL=onboarding.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"onboarding.js","sourceRoot":"","sources":["../src/onboarding.ts"],"names":[],"mappings":"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Schema: {
5
+ type: "object";
6
+ properties: Record<string, unknown>;
7
+ required?: string[];
8
+ additionalProperties?: boolean;
9
+ };
10
+ }
11
+ export declare const TOOL_DESCRIPTORS: ToolDescriptor[];
12
+ export interface ToolResult {
13
+ [k: string]: unknown;
14
+ }
15
+ export declare function dispatchTool(name: string, args: Record<string, unknown> | undefined): Promise<ToolResult>;
16
+ //# sourceMappingURL=tools.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tools.d.ts","sourceRoot":"","sources":["../src/tools.ts"],"names":[],"mappings":"AAkBA,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE;QACX,IAAI,EAAE,QAAQ,CAAC;QACf,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;QACpC,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;QACpB,oBAAoB,CAAC,EAAE,OAAO,CAAC;KAChC,CAAC;CACH;AAED,eAAO,MAAM,gBAAgB,EAAE,cAAc,EAyjB5C,CAAC;AAmHF,MAAM,WAAW,UAAU;IAEzB,CAAC,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;CACtB;AAED,wBAAsB,YAAY,CAChC,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,GACxC,OAAO,CAAC,UAAU,CAAC,CA4LrB"}