@tethral/acr-mcp 2.1.1 → 2.1.2

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 (98) hide show
  1. package/dist/http.mjs +0 -1
  2. package/dist/index.mjs +0 -1
  3. package/package.json +9 -8
  4. package/dist/http.mjs.map +0 -7
  5. package/dist/index.mjs.map +0 -7
  6. package/dist/src/acr-state-file.d.ts +0 -6
  7. package/dist/src/acr-state-file.js +0 -32
  8. package/dist/src/acr-state-file.js.map +0 -1
  9. package/dist/src/env-detect.d.ts +0 -25
  10. package/dist/src/env-detect.js +0 -52
  11. package/dist/src/env-detect.js.map +0 -1
  12. package/dist/src/http.d.ts +0 -2
  13. package/dist/src/http.js +0 -112
  14. package/dist/src/http.js.map +0 -1
  15. package/dist/src/index.d.ts +0 -2
  16. package/dist/src/index.js +0 -17
  17. package/dist/src/index.js.map +0 -1
  18. package/dist/src/middleware/correlation-window.d.ts +0 -68
  19. package/dist/src/middleware/correlation-window.js +0 -113
  20. package/dist/src/middleware/correlation-window.js.map +0 -1
  21. package/dist/src/middleware/self-log.d.ts +0 -22
  22. package/dist/src/middleware/self-log.js +0 -72
  23. package/dist/src/middleware/self-log.js.map +0 -1
  24. package/dist/src/server.d.ts +0 -17
  25. package/dist/src/server.js +0 -96
  26. package/dist/src/server.js.map +0 -1
  27. package/dist/src/session-state.d.ts +0 -29
  28. package/dist/src/session-state.js +0 -102
  29. package/dist/src/session-state.js.map +0 -1
  30. package/dist/src/state.d.ts +0 -10
  31. package/dist/src/state.js +0 -39
  32. package/dist/src/state.js.map +0 -1
  33. package/dist/src/strip-sub-components.d.ts +0 -7
  34. package/dist/src/strip-sub-components.js +0 -15
  35. package/dist/src/strip-sub-components.js.map +0 -1
  36. package/dist/src/tools/acknowledge-threat.d.ts +0 -3
  37. package/dist/src/tools/acknowledge-threat.js +0 -38
  38. package/dist/src/tools/acknowledge-threat.js.map +0 -1
  39. package/dist/src/tools/check-entity.d.ts +0 -2
  40. package/dist/src/tools/check-entity.js +0 -144
  41. package/dist/src/tools/check-entity.js.map +0 -1
  42. package/dist/src/tools/check-environment.d.ts +0 -2
  43. package/dist/src/tools/check-environment.js +0 -32
  44. package/dist/src/tools/check-environment.js.map +0 -1
  45. package/dist/src/tools/disable-deep-composition.d.ts +0 -20
  46. package/dist/src/tools/disable-deep-composition.js +0 -45
  47. package/dist/src/tools/disable-deep-composition.js.map +0 -1
  48. package/dist/src/tools/get-coverage.d.ts +0 -2
  49. package/dist/src/tools/get-coverage.js +0 -67
  50. package/dist/src/tools/get-coverage.js.map +0 -1
  51. package/dist/src/tools/get-failure-registry.d.ts +0 -2
  52. package/dist/src/tools/get-failure-registry.js +0 -75
  53. package/dist/src/tools/get-failure-registry.js.map +0 -1
  54. package/dist/src/tools/get-friction-report.d.ts +0 -2
  55. package/dist/src/tools/get-friction-report.js +0 -208
  56. package/dist/src/tools/get-friction-report.js.map +0 -1
  57. package/dist/src/tools/get-interaction-log.d.ts +0 -2
  58. package/dist/src/tools/get-interaction-log.js +0 -199
  59. package/dist/src/tools/get-interaction-log.js.map +0 -1
  60. package/dist/src/tools/get-my-agent.d.ts +0 -2
  61. package/dist/src/tools/get-my-agent.js +0 -36
  62. package/dist/src/tools/get-my-agent.js.map +0 -1
  63. package/dist/src/tools/get-network-status.d.ts +0 -2
  64. package/dist/src/tools/get-network-status.js +0 -85
  65. package/dist/src/tools/get-network-status.js.map +0 -1
  66. package/dist/src/tools/get-notifications.d.ts +0 -3
  67. package/dist/src/tools/get-notifications.js +0 -34
  68. package/dist/src/tools/get-notifications.js.map +0 -1
  69. package/dist/src/tools/get-profile.d.ts +0 -2
  70. package/dist/src/tools/get-profile.js +0 -89
  71. package/dist/src/tools/get-profile.js.map +0 -1
  72. package/dist/src/tools/get-skill-tracker.d.ts +0 -2
  73. package/dist/src/tools/get-skill-tracker.js +0 -93
  74. package/dist/src/tools/get-skill-tracker.js.map +0 -1
  75. package/dist/src/tools/get-skill-versions.d.ts +0 -2
  76. package/dist/src/tools/get-skill-versions.js +0 -74
  77. package/dist/src/tools/get-skill-versions.js.map +0 -1
  78. package/dist/src/tools/get-stable-corridors.d.ts +0 -2
  79. package/dist/src/tools/get-stable-corridors.js +0 -65
  80. package/dist/src/tools/get-stable-corridors.js.map +0 -1
  81. package/dist/src/tools/get-trend.d.ts +0 -2
  82. package/dist/src/tools/get-trend.js +0 -75
  83. package/dist/src/tools/get-trend.js.map +0 -1
  84. package/dist/src/tools/log-interaction.d.ts +0 -3
  85. package/dist/src/tools/log-interaction.js +0 -177
  86. package/dist/src/tools/log-interaction.js.map +0 -1
  87. package/dist/src/tools/register-agent.d.ts +0 -2
  88. package/dist/src/tools/register-agent.js +0 -102
  89. package/dist/src/tools/register-agent.js.map +0 -1
  90. package/dist/src/tools/search-skills.d.ts +0 -2
  91. package/dist/src/tools/search-skills.js +0 -78
  92. package/dist/src/tools/search-skills.js.map +0 -1
  93. package/dist/src/tools/summarize-my-agent.d.ts +0 -2
  94. package/dist/src/tools/summarize-my-agent.js +0 -100
  95. package/dist/src/tools/summarize-my-agent.js.map +0 -1
  96. package/dist/src/tools/update-composition.d.ts +0 -3
  97. package/dist/src/tools/update-composition.js +0 -89
  98. package/dist/src/tools/update-composition.js.map +0 -1
@@ -1,6 +0,0 @@
1
- export declare function writeAcrStateFile(agentId: string, apiUrl: string, apiKey?: string): void;
2
- export declare function readAcrStateFile(): {
3
- agent_id: string;
4
- api_url: string;
5
- api_key?: string;
6
- } | null;
@@ -1,32 +0,0 @@
1
- /**
2
- * Writes ~/.claude/.acr-state.json so host plugins (claude-code-plugin)
3
- * can discover the agent_id, API URL, and API key. Fire-and-forget — never throws.
4
- */
5
- import { readFileSync, writeFileSync, mkdirSync } from 'node:fs';
6
- import { join } from 'node:path';
7
- import { homedir } from 'node:os';
8
- export function writeAcrStateFile(agentId, apiUrl, apiKey) {
9
- try {
10
- const stateDir = join(homedir(), '.claude');
11
- mkdirSync(stateDir, { recursive: true });
12
- writeFileSync(join(stateDir, '.acr-state.json'), JSON.stringify({
13
- agent_id: agentId,
14
- api_url: apiUrl,
15
- ...(apiKey && { api_key: apiKey }),
16
- }));
17
- }
18
- catch { /* fire-and-forget */ }
19
- }
20
- export function readAcrStateFile() {
21
- try {
22
- const stateFile = join(homedir(), '.claude', '.acr-state.json');
23
- const data = JSON.parse(readFileSync(stateFile, 'utf-8'));
24
- if (data?.agent_id)
25
- return data;
26
- return null;
27
- }
28
- catch {
29
- return null;
30
- }
31
- }
32
- //# sourceMappingURL=acr-state-file.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"acr-state-file.js","sourceRoot":"","sources":["../../src/acr-state-file.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AACjE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAElC,MAAM,UAAU,iBAAiB,CAAC,OAAe,EAAE,MAAc,EAAE,MAAe;IAChF,IAAI,CAAC;QACH,MAAM,QAAQ,GAAG,IAAI,CAAC,OAAO,EAAE,EAAE,SAAS,CAAC,CAAC;QAC5C,SAAS,CAAC,QAAQ,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;QACzC,aAAa,CACX,IAAI,CAAC,QAAQ,EAAE,iBAAiB,CAAC,EACjC,IAAI,CAAC,SAAS,CAAC;YACb,QAAQ,EAAE,OAAO;YACjB,OAAO,EAAE,MAAM;YACf,GAAG,CAAC,MAAM,IAAI,EAAE,OAAO,EAAE,MAAM,EAAE,CAAC;SACnC,CAAC,CACH,CAAC;IACJ,CAAC;IAAC,MAAM,CAAC,CAAC,qBAAqB,CAAC,CAAC;AACnC,CAAC;AAED,MAAM,UAAU,gBAAgB;IAC9B,IAAI,CAAC;QACH,MAAM,SAAS,GAAG,IAAI,CAAC,OAAO,EAAE,EAAE,SAAS,EAAE,iBAAiB,CAAC,CAAC;QAChE,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC,CAAC;QAC1D,IAAI,IAAI,EAAE,QAAQ;YAAE,OAAO,IAAI,CAAC;QAChC,OAAO,IAAI,CAAC;IACd,CAAC;IAAC,MAAM,CAAC;QAAC,OAAO,IAAI,CAAC;IAAC,CAAC;AAC1B,CAAC"}
@@ -1,25 +0,0 @@
1
- export interface EnvironmentContext {
2
- device_class: 'desktop' | 'server' | 'sbc' | 'mobile' | 'unknown';
3
- platform: string;
4
- arch: string;
5
- client_type?: string;
6
- transport_type: 'stdio' | 'streamable-http';
7
- }
8
- export declare function detectEnvironment(transportType: 'stdio' | 'streamable-http'): EnvironmentContext;
9
- /** OS release string, useful for debugging but not stored by default. */
10
- export declare function getOsRelease(): string;
11
- /**
12
- * Observe the agent's composition from the MCP's vantage point.
13
- *
14
- * This is the MCP-observed side of the two-source composition pattern.
15
- * The MCP doesn't have a portable way to enumerate an agent's skills and
16
- * MCPs across all MCP hosts — that requires host integration (Claude Code
17
- * plugin in Phase 2, similar plugins for other hosts). In Phase 1 this
18
- * is a stub that returns empty: the plumbing is in place so the
19
- * agent_composition_sources table and the profile's composition_delta
20
- * computation work as soon as any observation is populated.
21
- *
22
- * Keep this pure and fast. No file I/O, no network, no parsing of
23
- * arbitrary files. It should always return in <1ms.
24
- */
25
- export declare function observeComposition(): Record<string, unknown>;
@@ -1,52 +0,0 @@
1
- /**
2
- * Auto-detect execution environment for ACR observability.
3
- * Captures device class, platform, architecture at startup.
4
- * Env var overrides: ACR_DEVICE_CLASS, ACR_PLATFORM, ACR_ARCH.
5
- */
6
- import { totalmem, release } from 'node:os';
7
- function inferDeviceClass() {
8
- const override = process.env.ACR_DEVICE_CLASS;
9
- if (override)
10
- return override;
11
- const memGB = totalmem() / (1024 ** 3);
12
- if (memGB < 2)
13
- return 'sbc';
14
- if (memGB < 4)
15
- return 'mobile';
16
- return 'desktop';
17
- }
18
- export function detectEnvironment(transportType) {
19
- return {
20
- device_class: inferDeviceClass(),
21
- platform: process.env.ACR_PLATFORM ?? process.platform,
22
- arch: process.env.ACR_ARCH ?? process.arch,
23
- transport_type: transportType,
24
- };
25
- }
26
- /** OS release string, useful for debugging but not stored by default. */
27
- export function getOsRelease() {
28
- return release();
29
- }
30
- /**
31
- * Observe the agent's composition from the MCP's vantage point.
32
- *
33
- * This is the MCP-observed side of the two-source composition pattern.
34
- * The MCP doesn't have a portable way to enumerate an agent's skills and
35
- * MCPs across all MCP hosts — that requires host integration (Claude Code
36
- * plugin in Phase 2, similar plugins for other hosts). In Phase 1 this
37
- * is a stub that returns empty: the plumbing is in place so the
38
- * agent_composition_sources table and the profile's composition_delta
39
- * computation work as soon as any observation is populated.
40
- *
41
- * Keep this pure and fast. No file I/O, no network, no parsing of
42
- * arbitrary files. It should always return in <1ms.
43
- */
44
- export function observeComposition() {
45
- // Phase 1: MCP observation returns an empty composition. Phase 2's
46
- // host plugins (Claude Code, Cursor, etc.) populate the mcp_observed
47
- // source directly by calling the server API, bypassing this function.
48
- // This keeps the MCP compute-thin and the observation source
49
- // correctly attributed to whichever host integration produced it.
50
- return {};
51
- }
52
- //# sourceMappingURL=env-detect.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"env-detect.js","sourceRoot":"","sources":["../../src/env-detect.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAU5C,SAAS,gBAAgB;IACvB,MAAM,QAAQ,GAAG,OAAO,CAAC,GAAG,CAAC,gBAAgB,CAAC;IAC9C,IAAI,QAAQ;QAAE,OAAO,QAA8C,CAAC;IAEpE,MAAM,KAAK,GAAG,QAAQ,EAAE,GAAG,CAAC,IAAI,IAAI,CAAC,CAAC,CAAC;IACvC,IAAI,KAAK,GAAG,CAAC;QAAE,OAAO,KAAK,CAAC;IAC5B,IAAI,KAAK,GAAG,CAAC;QAAE,OAAO,QAAQ,CAAC;IAC/B,OAAO,SAAS,CAAC;AACnB,CAAC;AAED,MAAM,UAAU,iBAAiB,CAC/B,aAA0C;IAE1C,OAAO;QACL,YAAY,EAAE,gBAAgB,EAAE;QAChC,QAAQ,EAAE,OAAO,CAAC,GAAG,CAAC,YAAY,IAAI,OAAO,CAAC,QAAQ;QACtD,IAAI,EAAE,OAAO,CAAC,GAAG,CAAC,QAAQ,IAAI,OAAO,CAAC,IAAI;QAC1C,cAAc,EAAE,aAAa;KAC9B,CAAC;AACJ,CAAC;AAED,yEAAyE;AACzE,MAAM,UAAU,YAAY;IAC1B,OAAO,OAAO,EAAE,CAAC;AACnB,CAAC;AAED;;;;;;;;;;;;;GAaG;AACH,MAAM,UAAU,kBAAkB;IAChC,mEAAmE;IACnE,qEAAqE;IACrE,sEAAsE;IACtE,6DAA6D;IAC7D,kEAAkE;IAClE,OAAO,EAAE,CAAC;AACZ,CAAC"}
@@ -1,2 +0,0 @@
1
- #!/usr/bin/env node
2
- export {};
package/dist/src/http.js DELETED
@@ -1,112 +0,0 @@
1
- #!/usr/bin/env node
2
- /**
3
- * ACR MCP server — Streamable HTTP entry point.
4
- * For browser-based clients (claude.ai) and remote MCP connections.
5
- * For stdio transport, see index.ts.
6
- */
7
- import { createServer } from 'node:http';
8
- import { randomUUID } from 'node:crypto';
9
- import { StreamableHTTPServerTransport } from '@modelcontextprotocol/sdk/server/streamableHttp.js';
10
- import { createAcrServer } from './server.js';
11
- import { SessionState } from './session-state.js';
12
- const PORT = parseInt(process.env.ACR_MCP_HTTP_PORT ?? '3001', 10);
13
- const AUTH_TOKEN = process.env.ACR_MCP_AUTH_TOKEN;
14
- const STATELESS = process.env.ACR_MCP_STATELESS === 'true';
15
- // Track active transports per session for cleanup
16
- const sessions = new Map();
17
- function createTransport() {
18
- const transport = new StreamableHTTPServerTransport({
19
- sessionIdGenerator: STATELESS ? undefined : () => randomUUID(),
20
- onsessioninitialized: (sessionId) => {
21
- sessions.set(sessionId, transport);
22
- },
23
- });
24
- return transport;
25
- }
26
- const httpServer = createServer(async (req, res) => {
27
- const url = new URL(req.url ?? '/', `http://localhost:${PORT}`);
28
- // CORS headers for browser access
29
- res.setHeader('Access-Control-Allow-Origin', '*');
30
- res.setHeader('Access-Control-Allow-Methods', 'GET, POST, DELETE, OPTIONS');
31
- res.setHeader('Access-Control-Allow-Headers', 'Content-Type, Authorization, Mcp-Session-Id');
32
- res.setHeader('Access-Control-Expose-Headers', 'Mcp-Session-Id');
33
- if (req.method === 'OPTIONS') {
34
- res.writeHead(204);
35
- res.end();
36
- return;
37
- }
38
- // Health check
39
- if (url.pathname === '/health') {
40
- res.writeHead(200, { 'Content-Type': 'application/json' });
41
- res.end(JSON.stringify({ status: 'ok', sessions: sessions.size }));
42
- return;
43
- }
44
- // Only handle /mcp endpoint
45
- if (url.pathname !== '/mcp') {
46
- res.writeHead(404, { 'Content-Type': 'application/json' });
47
- res.end(JSON.stringify({ error: 'Not found. Use /mcp for MCP protocol.' }));
48
- return;
49
- }
50
- // Optional bearer auth
51
- if (AUTH_TOKEN) {
52
- const auth = req.headers.authorization;
53
- if (!auth || auth !== `Bearer ${AUTH_TOKEN}`) {
54
- res.writeHead(401, { 'Content-Type': 'application/json' });
55
- res.end(JSON.stringify({ error: 'Unauthorized' }));
56
- return;
57
- }
58
- }
59
- // Route by session: existing session or new initialization
60
- const sessionId = req.headers['mcp-session-id'];
61
- if (sessionId && sessions.has(sessionId)) {
62
- // Existing session — route to its transport
63
- const transport = sessions.get(sessionId);
64
- await transport.handleRequest(req, res);
65
- return;
66
- }
67
- if (req.method === 'POST' && !sessionId) {
68
- // New session — create transport with its own session state, connect server
69
- const transport = createTransport();
70
- const session = new SessionState('streamable-http');
71
- const server = createAcrServer({ session });
72
- transport.onclose = () => {
73
- const sid = transport.sessionId;
74
- if (sid)
75
- sessions.delete(sid);
76
- server.close().catch((err) => { console.error('Failed to close MCP server on session end', err); });
77
- };
78
- await server.connect(transport);
79
- await transport.handleRequest(req, res);
80
- return;
81
- }
82
- if (req.method === 'DELETE' && sessionId) {
83
- // Session cleanup
84
- const transport = sessions.get(sessionId);
85
- if (transport) {
86
- await transport.close();
87
- sessions.delete(sessionId);
88
- }
89
- res.writeHead(200, { 'Content-Type': 'application/json' });
90
- res.end(JSON.stringify({ closed: true }));
91
- return;
92
- }
93
- // Unknown session ID
94
- res.writeHead(404, { 'Content-Type': 'application/json' });
95
- res.end(JSON.stringify({ error: 'Session not found' }));
96
- });
97
- httpServer.listen(PORT, () => {
98
- console.error(`ACR MCP HTTP server listening on port ${PORT}`);
99
- console.error(` Endpoint: http://localhost:${PORT}/mcp`);
100
- console.error(` Mode: ${STATELESS ? 'stateless' : 'stateful (session-based)'}`);
101
- if (AUTH_TOKEN)
102
- console.error(' Auth: bearer token required');
103
- });
104
- // Graceful shutdown
105
- process.on('SIGTERM', () => {
106
- console.error('Shutting down...');
107
- for (const transport of sessions.values()) {
108
- transport.close().catch((err) => { console.error('Failed to close transport during shutdown', err); });
109
- }
110
- httpServer.close();
111
- });
112
- //# sourceMappingURL=http.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"http.js","sourceRoot":"","sources":["../../src/http.ts"],"names":[],"mappings":";AACA;;;;GAIG;AACH,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,6BAA6B,EAAE,MAAM,oDAAoD,CAAC;AACnG,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAElD,MAAM,IAAI,GAAG,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,iBAAiB,IAAI,MAAM,EAAE,EAAE,CAAC,CAAC;AACnE,MAAM,UAAU,GAAG,OAAO,CAAC,GAAG,CAAC,kBAAkB,CAAC;AAClD,MAAM,SAAS,GAAG,OA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E,EAAE,cAAc,EAAE,kBAAkB,EAAE,CAAC,CAAC;IAC3D,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE,KAAK,EAAE,mBAAmB,EAAE,CAAC,CAAC,CAAC;AAC1D,CAAC,CAAC,CAAC;AAEH,UAAU,CAAC,MAAM,CAAC,IAAI,EAAE,GAAG,EAAE;IAC3B,OAAO,CAAC,KAAK,CAAC,yCAAyC,IAAI,EAAE,CAAC,CAAC;IAC/D,OAAO,CAAC,KAAK,CAAC,gCAAgC,IAAI,MAAM,CAAC,CAAC;IAC1D,OAAO,CAAC,KAAK,CAAC,WAAW,SAAS,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,0BAA0B,EAAE,CAAC,CAAC;IACjF,IAAI,UAAU;QAAE,OAAO,CAAC,KAAK,CAAC,+BAA+B,CAAC,CAAC;AACjE,CAAC,CAAC,CAAC;AAEH,oBAAoB;AACpB,OAAO,CAAC,EAAE,CAAC,SAAS,EAAE,GAAG,EAAE;IACzB,OAAO,CAAC,KAAK,CAAC,kBAAkB,CAAC,CAAC;IAClC,KAAK,MAAM,SAAS,IAAI,QAAQ,CAAC,MAAM,EAAE,EAAE,CAAC;QAC1C,SAAS,CAAC,KAAK,EAAE,CAAC,KAAK,CAAC,CAAC,GAAG,EAAE,EAAE,GAAG,OAAO,CAAC,KAAK,CAAC,2CAA2C,EAAE,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IACzG,CAAC;IACD,UAAU,CAAC,KAAK,EAAE,CAAC;AACrB,CAAC,CAAC,CAAC"}
@@ -1,2 +0,0 @@
1
- #!/usr/bin/env node
2
- export {};
package/dist/src/index.js DELETED
@@ -1,17 +0,0 @@
1
- #!/usr/bin/env node
2
- /**
3
- * ACR MCP server — stdio entry point.
4
- * For HTTP transport, see http.ts.
5
- */
6
- import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
7
- import { createAcrServer } from './server.js';
8
- async function main() {
9
- const server = createAcrServer();
10
- const transport = new StdioServerTransport();
11
- await server.connect(transport);
12
- }
13
- main().catch((err) => {
14
- console.error('ACR MCP server failed to start:', err);
15
- process.exit(1);
16
- });
17
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";AACA;;;GAGG;AACH,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AACjF,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAE9C,KAAK,UAAU,IAAI;IACjB,MAAM,MAAM,GAAG,eAAe,EAAE,CAAC;IACjC,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,KAAK,CAAC,iCAAiC,EAAE,GAAG,CAAC,CAAC;IACtD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC"}
@@ -1,68 +0,0 @@
1
- /**
2
- * Correlation window for the ACR MCP.
3
- *
4
- * A passive in-process buffer of ~60 seconds of recent receipt correlation
5
- * keys. The window is used at receipt emit time to tag a new receipt with a
6
- * `preceded_by` link when it's part of the same in-flight workflow as a
7
- * recent prior receipt. Beyond 60 seconds, correlation is the server's job.
8
- *
9
- * Design choices and their rationale (see proposals/mcp-compute-boundary.md
10
- * constraint #3):
11
- *
12
- * - In-process only. No disk, no persistence, no tmpfile. The window is lost
13
- * on process restart, which is fine: the authoritative record lives on
14
- * the server, and 60 seconds is short enough that restart rarely matters.
15
- * - Passive. No pattern matching forward or reverse. No aggregation. No
16
- * prediction. The window holds correlation keys and nothing else.
17
- * - Eager eviction on insert. No setInterval, no background sweeper, no
18
- * timers. Eviction runs once per insert, O(n) over at-most-hundreds of
19
- * entries. No background work.
20
- * - One window per session. Instantiated in server.ts and passed by
21
- * reference into the tools that need it. Not a module-level singleton, so
22
- * the HTTP transport with concurrent sessions doesn't share state across
23
- * agents.
24
- * - Framed as a privacy + lightweight design choice. Users get useful
25
- * interaction data without persistent surveillance state on their machine.
26
- */
27
- export interface CorrelationEntry {
28
- receipt_id: string;
29
- chain_id: string | null;
30
- target_system_id: string;
31
- /** Unix ms timestamp when the receipt was produced. */
32
- created_at_ms: number;
33
- }
34
- export declare class CorrelationWindow {
35
- private readonly entries;
36
- private readonly windowMs;
37
- private readonly maxEntries;
38
- constructor(windowMs?: number, maxEntries?: number);
39
- /**
40
- * Record a receipt's correlation keys into the window. Runs eviction of
41
- * expired entries on every insert — no background sweeper.
42
- *
43
- * If the window is at its hard cap after eviction (indicates either a
44
- * very high tool-call rate or a bug), the oldest entries are dropped.
45
- * This is a safety net, not a normal path.
46
- */
47
- record(entry: CorrelationEntry): void;
48
- /**
49
- * Find a recent receipt that should be linked as `preceded_by` for a new
50
- * receipt. Prefers the most recent entry in the same chain_id. Returns the
51
- * target_system_id of the match (that's what `preceded_by` stores), or
52
- * null if nothing links.
53
- *
54
- * If currentChainId is null, we don't attempt cross-chain linking — the
55
- * agent didn't declare a chain, so the server will reconstruct any
56
- * linkage from its full history.
57
- */
58
- findPrecededBy(currentChainId: string | null, nowMs: number): string | null;
59
- /**
60
- * Evict entries older than the window. Called on every record() and
61
- * every findPrecededBy() call. No background timers.
62
- */
63
- private evictExpired;
64
- /** Current number of entries in the window. Used by tests and observability. */
65
- size(): number;
66
- /** Clear the window. Used by tests; not expected in production code paths. */
67
- clear(): void;
68
- }
@@ -1,113 +0,0 @@
1
- /**
2
- * Correlation window for the ACR MCP.
3
- *
4
- * A passive in-process buffer of ~60 seconds of recent receipt correlation
5
- * keys. The window is used at receipt emit time to tag a new receipt with a
6
- * `preceded_by` link when it's part of the same in-flight workflow as a
7
- * recent prior receipt. Beyond 60 seconds, correlation is the server's job.
8
- *
9
- * Design choices and their rationale (see proposals/mcp-compute-boundary.md
10
- * constraint #3):
11
- *
12
- * - In-process only. No disk, no persistence, no tmpfile. The window is lost
13
- * on process restart, which is fine: the authoritative record lives on
14
- * the server, and 60 seconds is short enough that restart rarely matters.
15
- * - Passive. No pattern matching forward or reverse. No aggregation. No
16
- * prediction. The window holds correlation keys and nothing else.
17
- * - Eager eviction on insert. No setInterval, no background sweeper, no
18
- * timers. Eviction runs once per insert, O(n) over at-most-hundreds of
19
- * entries. No background work.
20
- * - One window per session. Instantiated in server.ts and passed by
21
- * reference into the tools that need it. Not a module-level singleton, so
22
- * the HTTP transport with concurrent sessions doesn't share state across
23
- * agents.
24
- * - Framed as a privacy + lightweight design choice. Users get useful
25
- * interaction data without persistent surveillance state on their machine.
26
- */
27
- /** Defaults to 60 seconds. Overridable for tests only. */
28
- const DEFAULT_WINDOW_MS = 60_000;
29
- /**
30
- * Hard cap on entries held in the window, as a safety net in case eviction
31
- * has a bug or the MCP is under unusual load. 500 is plenty for a 60s
32
- * window at realistic tool-call rates.
33
- */
34
- const DEFAULT_MAX_ENTRIES = 500;
35
- export class CorrelationWindow {
36
- entries = new Map();
37
- windowMs;
38
- maxEntries;
39
- constructor(windowMs = DEFAULT_WINDOW_MS, maxEntries = DEFAULT_MAX_ENTRIES) {
40
- this.windowMs = windowMs;
41
- this.maxEntries = maxEntries;
42
- }
43
- /**
44
- * Record a receipt's correlation keys into the window. Runs eviction of
45
- * expired entries on every insert — no background sweeper.
46
- *
47
- * If the window is at its hard cap after eviction (indicates either a
48
- * very high tool-call rate or a bug), the oldest entries are dropped.
49
- * This is a safety net, not a normal path.
50
- */
51
- record(entry) {
52
- this.evictExpired(entry.created_at_ms);
53
- this.entries.set(entry.receipt_id, entry);
54
- // Hard-cap safety: if we're somehow over the limit, drop oldest.
55
- if (this.entries.size > this.maxEntries) {
56
- const excess = this.entries.size - this.maxEntries;
57
- let dropped = 0;
58
- for (const key of this.entries.keys()) {
59
- if (dropped >= excess)
60
- break;
61
- this.entries.delete(key);
62
- dropped++;
63
- }
64
- }
65
- }
66
- /**
67
- * Find a recent receipt that should be linked as `preceded_by` for a new
68
- * receipt. Prefers the most recent entry in the same chain_id. Returns the
69
- * target_system_id of the match (that's what `preceded_by` stores), or
70
- * null if nothing links.
71
- *
72
- * If currentChainId is null, we don't attempt cross-chain linking — the
73
- * agent didn't declare a chain, so the server will reconstruct any
74
- * linkage from its full history.
75
- */
76
- findPrecededBy(currentChainId, nowMs) {
77
- if (!currentChainId)
78
- return null;
79
- this.evictExpired(nowMs);
80
- // Walk entries newest-first by iterating in reverse insertion order.
81
- // Map preserves insertion order, so the newest entry is last. Convert
82
- // to an array and scan from the end.
83
- const allEntries = Array.from(this.entries.values());
84
- for (let i = allEntries.length - 1; i >= 0; i--) {
85
- const entry = allEntries[i];
86
- if (entry.chain_id === currentChainId) {
87
- return entry.target_system_id;
88
- }
89
- }
90
- return null;
91
- }
92
- /**
93
- * Evict entries older than the window. Called on every record() and
94
- * every findPrecededBy() call. No background timers.
95
- */
96
- evictExpired(nowMs) {
97
- const cutoff = nowMs - this.windowMs;
98
- for (const [key, entry] of this.entries) {
99
- if (entry.created_at_ms < cutoff) {
100
- this.entries.delete(key);
101
- }
102
- }
103
- }
104
- /** Current number of entries in the window. Used by tests and observability. */
105
- size() {
106
- return this.entries.size;
107
- }
108
- /** Clear the window. Used by tests; not expected in production code paths. */
109
- clear() {
110
- this.entries.clear();
111
- }
112
- }
113
- //# sourceMappingURL=correlation-window.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"correlation-window.js","sourceRoot":"","sources":["../../../src/middleware/correlation-window.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAUH,0DAA0D;AAC1D,MAAM,iBAAiB,GAAG,MAAM,CAAC;AAEjC;;;;GAIG;AACH,MAAM,mBAAmB,GAAG,GAAG,CAAC;AAEhC,MAAM,OAAO,iBAAiB;IACX,OAAO,GAAkC,IAAI,GAAG,EAAE,CAAC;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E,CAAC;YAChD,MAAM,KAAK,GAAG,UAAU,CAAC,CAAC,CAAE,CAAC;YAC7B,IAAI,KAAK,CAAC,QAAQ,KAAK,cAAc,EAAE,CAAC;gBACtC,OAAO,KAAK,CAAC,gBAAgB,CAAC;YAChC,CAAC;QACH,CAAC;QACD,OAAO,IAAI,CAAC;IACd,CAAC;IAED;;;OAGG;IACK,YAAY,CAAC,KAAa;QAChC,MAAM,MAAM,GAAG,KAAK,GAAG,IAAI,CAAC,QAAQ,CAAC;QACrC,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,IAAI,CAAC,OAAO,EAAE,CAAC;YACxC,IAAI,KAAK,CAAC,aAAa,GAAG,MAAM,EAAE,CAAC;gBACjC,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;YAC3B,CAAC;QACH,CAAC;IACH,CAAC;IAED,gFAAgF;IAChF,IAAI;QACF,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC;IAC3B,CAAC;IAED,8EAA8E;IAC9E,KAAK;QACH,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,CAAC;IACvB,CAAC;CACF"}
@@ -1,22 +0,0 @@
1
- /**
2
- * Self-logging middleware for ACR MCP tools.
3
- * Wraps each tool handler to automatically log timing and status,
4
- * without relying on the LLM to call log_interaction.
5
- *
6
- * Self-logged receipts use source='server' to distinguish from
7
- * LLM-initiated logs (source='agent').
8
- */
9
- import type { SessionState } from '../session-state.js';
10
- type ToolResult = {
11
- content: Array<{
12
- type: string;
13
- text: string;
14
- }>;
15
- };
16
- type ToolHandler = (params: Record<string, unknown>, extra: unknown) => Promise<ToolResult>;
17
- /**
18
- * Wrap a tool handler with automatic interaction logging.
19
- * Fires a non-blocking POST to the receipts API after each call.
20
- */
21
- export declare function withSelfLog(toolName: string, handler: ToolHandler, getState: () => SessionState, apiUrl: string): ToolHandler;
22
- export {};
@@ -1,72 +0,0 @@
1
- import { defaultSession } from '../session-state.js';
2
- // Re-entrancy guard to prevent the self-log POST from triggering another self-log
3
- let selfLogging = false;
4
- /**
5
- * Wrap a tool handler with automatic interaction logging.
6
- * Fires a non-blocking POST to the receipts API after each call.
7
- */
8
- export function withSelfLog(toolName, handler, getState, apiUrl) {
9
- return async (params, extra) => {
10
- const startMs = Date.now();
11
- let status = 'success';
12
- let result;
13
- try {
14
- result = await handler(params, extra);
15
- }
16
- catch (err) {
17
- status = 'failure';
18
- throw err;
19
- }
20
- finally {
21
- // Fire-and-forget self-log (never block or fail the tool call)
22
- if (!selfLogging) {
23
- const durationMs = Date.now() - startMs;
24
- const state = getState();
25
- // Tools currently store agentId on defaultSession (via state.ts compat layer).
26
- // Check both the provided session and defaultSession as fallback.
27
- const agentId = state.agentId ?? defaultSession.agentId;
28
- if (agentId) {
29
- selfLogging = true;
30
- fireAndForgetLog(apiUrl, agentId, toolName, status, durationMs, state.transportType)
31
- .finally(() => { selfLogging = false; });
32
- }
33
- }
34
- }
35
- return result;
36
- };
37
- }
38
- async function fireAndForgetLog(apiUrl, agentId, toolName, status, durationMs, transportType) {
39
- try {
40
- const controller = new AbortController();
41
- const timeout = setTimeout(() => controller.abort(), 2000);
42
- const res = await fetch(`${apiUrl}/api/v1/receipts`, {
43
- method: 'POST',
44
- headers: { 'Content-Type': 'application/json' },
45
- signal: controller.signal,
46
- body: JSON.stringify({
47
- emitter: {
48
- agent_id: agentId,
49
- provider_class: 'unknown',
50
- },
51
- target: {
52
- system_id: `mcp:acr-registry`,
53
- system_type: 'mcp_server',
54
- },
55
- interaction: {
56
- category: 'tool_call',
57
- status,
58
- duration_ms: durationMs,
59
- request_timestamp_ms: Date.now() - durationMs,
60
- },
61
- anomaly: { flagged: false },
62
- transport_type: transportType,
63
- source: 'server',
64
- }),
65
- });
66
- clearTimeout(timeout);
67
- }
68
- catch {
69
- // Silently ignore — self-logging must never break tool calls
70
- }
71
- }
72
- //# sourceMappingURL=self-log.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"self-log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AC;AAED,KAAK,UAAU,gBAAgB,CAC7B,MAAc,EACd,OAAe,EACf,QAAgB,EAChB,MAAc,EACd,UAAkB,EAClB,aAAqB;IAErB,IAAI,CAAC;QACH,MAAM,UAAU,GAAG,IAAI,eAAe,EAAE,CAAC;QACzC,MAAM,OAAO,GAAG,UAAU,CAAC,GAAG,EAAE,CAAC,UAAU,CAAC,KAAK,EAAE,EAAE,IAAI,CAAC,CAAC;QAE3D,MAAM,GAAG,GAAG,MAAM,KAAK,CAAC,GAAG,MAAM,kBAAkB,EAAE;YACnD,MAAM,EAAE,MAAM;YACd,OAAO,EAAE,EAAE,cAAc,EAAE,kBAAkB,EAAE;YAC/C,MAAM,EAAE,UAAU,CAAC,MAAM;YACzB,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC;gBACnB,OAAO,EAAE;oBACP,QAAQ,EAAE,OAAO;oBACjB,cAAc,EAAE,SAAS;iBAC1B;gBACD,MAAM,EAAE;oBACN,SAAS,EAAE,kBAAkB;oBAC7B,WAAW,EAAE,YAAY;iBAC1B;gBACD,WAAW,EAAE;oBACX,QAAQ,EAAE,WAAW;oBACrB,MAAM;oBACN,WAAW,EAAE,UAAU;oBACvB,oBAAoB,EAAE,IAAI,CAAC,GAAG,EAAE,GAAG,UAAU;iBAC9C;gBACD,OAAO,EAAE,EAAE,OAAO,EAAE,KAAK,EAAE;gBAC3B,cAAc,EAAE,aAAa;gBAC7B,MAAM,EAAE,QAAQ;aACjB,CAAC;SACH,CAAC,CAAC;QAEH,YAAY,CAAC,OAAO,CAAC,CAAC;IACxB,CAAC;IAAC,MAAM,CAAC;QACP,6DAA6D;IAC/D,CAAC;AACH,CAAC"}
@@ -1,17 +0,0 @@
1
- /**
2
- * Shared server factory for the ACR MCP server.
3
- * Creates and configures the McpServer with all tools registered.
4
- * Used by both stdio (index.ts) and HTTP (http.ts) entry points.
5
- */
6
- import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
7
- import { CorrelationWindow } from './middleware/correlation-window.js';
8
- import { SessionState } from './session-state.js';
9
- export interface AcrServerOptions {
10
- apiUrl?: string;
11
- resolverUrl?: string;
12
- /** Session state for this server instance. Defaults to the stdio singleton. */
13
- session?: SessionState;
14
- /** Correlation window for in-flight receipt linkage. One per session. */
15
- correlationWindow?: CorrelationWindow;
16
- }
17
- export declare function createAcrServer(options?: AcrServerOptions): McpServer;