@getmarrow/mcp 2.0.1 → 2.2.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 +14 -2
- package/dist/cli.js +4 -2
- package/dist/cli.js.map +1 -1
- package/dist/index.d.ts +47 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +15 -1
- package/dist/index.js.map +1 -1
- package/package.json +7 -3
- package/src/cli.ts +0 -235
- package/src/index.ts +0 -103
- package/tsconfig.json +0 -18
package/README.md
CHANGED
|
@@ -81,15 +81,27 @@ Call this before every significant action. Returns collective intelligence from
|
|
|
81
81
|
"similar": [
|
|
82
82
|
{ "outcome": "Used incremental approach. Shipped in 2 days, 0 rollbacks.", "confidence": 0.91 }
|
|
83
83
|
],
|
|
84
|
+
"similar_count": 3,
|
|
84
85
|
"patterns": [
|
|
85
|
-
{ "
|
|
86
|
+
{ "pattern_id": "a1b2c3", "decision_type": "implementation", "frequency": 84, "confidence": 0.9 }
|
|
86
87
|
],
|
|
88
|
+
"patterns_count": 2,
|
|
87
89
|
"templates": [
|
|
88
90
|
{ "steps": ["Plan", "Spec", "Build", "Test", "Deploy"], "success_rate": 0.89 }
|
|
89
91
|
],
|
|
90
92
|
"success_rate": 0.87,
|
|
91
93
|
"priority_score": 0.7,
|
|
92
|
-
"insight": "
|
|
94
|
+
"insight": "Workflow gap detected — barvis_audit missing after build",
|
|
95
|
+
"insights": [
|
|
96
|
+
{
|
|
97
|
+
"type": "workflow_gap",
|
|
98
|
+
"summary": "audit not logged after build (3 consecutive times)",
|
|
99
|
+
"action": "Run audit before reporting done",
|
|
100
|
+
"severity": "critical",
|
|
101
|
+
"count": 3
|
|
102
|
+
}
|
|
103
|
+
],
|
|
104
|
+
"cluster_id": "818df2fa-6365-49f6-b478-bc3dcb748469"
|
|
93
105
|
},
|
|
94
106
|
"stream_url": "/v1/stream?format=sse"
|
|
95
107
|
}
|
package/dist/cli.js
CHANGED
|
@@ -50,8 +50,10 @@ const TOOLS = [
|
|
|
50
50
|
{
|
|
51
51
|
name: 'marrow_think',
|
|
52
52
|
description: 'Get collective intelligence from the Marrow hive before acting. ' +
|
|
53
|
+
'Returns pattern insights, failure detection, workflow gaps, and semantic clustering. ' +
|
|
53
54
|
'Call this before every significant action. Pass previous_outcome ' +
|
|
54
|
-
'to auto-commit your last action and open a new memory session.'
|
|
55
|
+
'to auto-commit your last action and open a new memory session. ' +
|
|
56
|
+
'Response includes: decision_id, insight (string), insights[] (ActionableInsight[]), cluster_id.',
|
|
55
57
|
inputSchema: {
|
|
56
58
|
type: 'object',
|
|
57
59
|
properties: {
|
|
@@ -130,7 +132,7 @@ async function handleRequest(req) {
|
|
|
130
132
|
success(id, {
|
|
131
133
|
protocolVersion: '2024-11-05',
|
|
132
134
|
capabilities: { tools: {} },
|
|
133
|
-
serverInfo: { name: 'marrow', version: '2.
|
|
135
|
+
serverInfo: { name: 'marrow', version: '2.1.0' },
|
|
134
136
|
});
|
|
135
137
|
return;
|
|
136
138
|
}
|
package/dist/cli.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";;AAEA;;;GAGG;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,mDAAqC;AACrC,mCAAkE;AAElE,MAAM,OAAO,GAAG,OAAO,CAAC,GAAG,CAAC,cAAc,IAAI,EAAE,CAAC;AACjD,MAAM,QAAQ,GAAG,OAAO,CAAC,GAAG,CAAC,eAAe,IAAI,0BAA0B,CAAC;AAE3E,IAAI,CAAC,OAAO,EAAE,CAAC;IACb,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,0DAA0D,CAAC,CAAC;IACjF,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC;AAiBD,SAAS,IAAI,CAAC,QAAqB;IACjC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,QAA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QACP,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,4BAA4B,OAAO,IAAI,CAAC,CAAC;IAChE,CAAC;AACH,CAAC,CAAC,CAAC;AAEH,EAAE,CAAC,EAAE,CAAC,OAAO,EAAE,GAAG,EAAE;IAClB,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,12 +1,23 @@
|
|
|
1
|
+
export interface ActionableInsight {
|
|
2
|
+
type: 'frequency' | 'failure_pattern' | 'workflow_gap' | 'hive_trend';
|
|
3
|
+
summary: string;
|
|
4
|
+
action: string;
|
|
5
|
+
severity: 'info' | 'warning' | 'critical';
|
|
6
|
+
count: number;
|
|
7
|
+
}
|
|
1
8
|
export interface MarrowIntelligence {
|
|
2
9
|
similar: Array<{
|
|
3
10
|
outcome: string;
|
|
4
11
|
confidence: number;
|
|
5
12
|
}>;
|
|
13
|
+
similar_count: number;
|
|
6
14
|
patterns: Array<{
|
|
7
|
-
|
|
15
|
+
pattern_id: string;
|
|
16
|
+
decision_type: string;
|
|
8
17
|
frequency: number;
|
|
18
|
+
confidence: number;
|
|
9
19
|
}>;
|
|
20
|
+
patterns_count: number;
|
|
10
21
|
templates: Array<{
|
|
11
22
|
steps: unknown[];
|
|
12
23
|
success_rate: number;
|
|
@@ -17,12 +28,21 @@ export interface MarrowIntelligence {
|
|
|
17
28
|
causal_chain: unknown | null;
|
|
18
29
|
success_rate: number;
|
|
19
30
|
priority_score: number;
|
|
31
|
+
insight: string | null;
|
|
32
|
+
insights: ActionableInsight[];
|
|
33
|
+
cluster_id: string | null;
|
|
20
34
|
}
|
|
21
35
|
export interface ThinkResult {
|
|
22
36
|
decision_id: string;
|
|
23
37
|
intelligence: MarrowIntelligence;
|
|
24
38
|
stream_url: string;
|
|
25
39
|
previous_committed?: boolean;
|
|
40
|
+
sanitized?: boolean;
|
|
41
|
+
upgrade_hint?: {
|
|
42
|
+
message: string;
|
|
43
|
+
tier: string;
|
|
44
|
+
url: string;
|
|
45
|
+
};
|
|
26
46
|
}
|
|
27
47
|
export interface CommitResult {
|
|
28
48
|
committed: boolean;
|
|
@@ -49,5 +69,31 @@ export declare function marrowCommit(apiKey: string, baseUrl: string, params: {
|
|
|
49
69
|
outcome: string;
|
|
50
70
|
caused_by?: string;
|
|
51
71
|
}): Promise<CommitResult>;
|
|
72
|
+
export interface AgentPatternsResult {
|
|
73
|
+
failure_patterns: Array<{
|
|
74
|
+
decision_type: string;
|
|
75
|
+
failure_rate: number;
|
|
76
|
+
count: number;
|
|
77
|
+
last_seen: string;
|
|
78
|
+
}>;
|
|
79
|
+
recurring_decisions: Array<{
|
|
80
|
+
decision_type: string;
|
|
81
|
+
frequency: number;
|
|
82
|
+
avg_confidence: number;
|
|
83
|
+
trend: string;
|
|
84
|
+
}>;
|
|
85
|
+
behavioral_drift: {
|
|
86
|
+
success_rate_7d: number;
|
|
87
|
+
success_rate_30d: number;
|
|
88
|
+
drift: string;
|
|
89
|
+
direction: string;
|
|
90
|
+
};
|
|
91
|
+
top_failure_types: string[];
|
|
92
|
+
generated_at: string;
|
|
93
|
+
}
|
|
94
|
+
export declare function marrowAgentPatterns(apiKey: string, baseUrl: string, params?: {
|
|
95
|
+
type?: string;
|
|
96
|
+
limit?: number;
|
|
97
|
+
}): Promise<AgentPatternsResult>;
|
|
52
98
|
export declare function marrowStatus(apiKey: string, baseUrl: string): Promise<StatusResult>;
|
|
53
99
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,kBAAkB;IACjC,OAAO,EAAE,KAAK,CAAC;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,UAAU,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IACxD,QAAQ,EAAE,KAAK,CAAC;QAAE,
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,KAAK,EAAE,MAAM,CAAC;QAAC,SAAS,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAC3G,mBAAmB,EAAE,KAAK,CAAC;QAAE,aAAa,EAAE,MAAM,CAAC;QAAC,SAAS,EAAE,MAAM,CAAC;QAAC,cAAc,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAChH,gBAAgB,EAAE;QAAE,eAAe,EAAE,MAAM,CAAC;QAAC,gBAAgB,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAC;QAAC,SAAS,EAAE,MAAM,CAAA;KAAE,CAAC;IAC1G,iBAAiB,EAAE,MAAM,EAAE,CAAC;IAC5B,YAAY,EAAE,MAAM,CAAC;CACtB;AAED,wBAAsB,mBAAmB,CACvC,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,MAAM,EACf,MAAM,CAAC,EAAE;IAAE,IAAI,CAAC,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,GACzC,OAAO,CAAC,mBAAmB,CAAC,CAS9B;AAED,wBAAsB,YAAY,CAChC,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,MAAM,GACd,OAAO,CAAC,YAAY,CAAC,CAQvB"}
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.marrowStatus = exports.marrowCommit = exports.marrowThink = void 0;
|
|
3
|
+
exports.marrowStatus = exports.marrowAgentPatterns = exports.marrowCommit = exports.marrowThink = void 0;
|
|
4
4
|
async function marrowThink(apiKey, baseUrl, params) {
|
|
5
5
|
const body = {
|
|
6
6
|
action: params.action,
|
|
@@ -42,6 +42,20 @@ async function marrowCommit(apiKey, baseUrl, params) {
|
|
|
42
42
|
return json.data;
|
|
43
43
|
}
|
|
44
44
|
exports.marrowCommit = marrowCommit;
|
|
45
|
+
async function marrowAgentPatterns(apiKey, baseUrl, params) {
|
|
46
|
+
const qs = new URLSearchParams();
|
|
47
|
+
if (params?.type)
|
|
48
|
+
qs.set('type', params.type);
|
|
49
|
+
if (params?.limit)
|
|
50
|
+
qs.set('limit', String(params.limit));
|
|
51
|
+
const url = `${baseUrl}/v1/agent/patterns${qs.toString() ? '?' + qs.toString() : ''}`;
|
|
52
|
+
const res = await fetch(url, { headers: { 'Authorization': `Bearer ${apiKey}` } });
|
|
53
|
+
const json = await res.json();
|
|
54
|
+
if (json.error)
|
|
55
|
+
throw new Error(json.error);
|
|
56
|
+
return json.data;
|
|
57
|
+
}
|
|
58
|
+
exports.marrowAgentPatterns = marrowAgentPatterns;
|
|
45
59
|
async function marrowStatus(apiKey, baseUrl) {
|
|
46
60
|
const res = await fetch(`${baseUrl}/v1/health`, {
|
|
47
61
|
headers: { 'Authorization': `Bearer ${apiKey}` },
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AA6CO,KAAK,UAAU,WAAW,CAC/B,MAAc,EACd,OAAe,EACf,MAOC;IAED,MAAM,IAAI,GAA4B;QACpC,MAAM,EAAE,MAAM,CAAC,MAAM;QACrB,IAAI,EAAE,MAAM,CAAC,IAAI,IAAI,SAAS;KAC/B,CAAC;IACF,IAAI,MAAM,CAAC,OAAO;QAAE,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC;IAClD,IAAI,MAAM,CAAC,oBAAoB,EAAE,CAAC;QAChC,IAAI,CAAC,oBAAoB,GAAG,MAAM,CAAC,oBAAoB,CAAC;QACxD,IAAI,CAAC,gBAAgB,GAAG,MAAM,CAAC,gBAAgB,IAAI,IAAI,CAAC;QACxD,IAAI,CAAC,gBAAgB,GAAG,MAAM,CAAC,gB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AC;IAC9C,IAAI,MAAM,EAAE,KAAK;QAAE,EAAE,CAAC,GAAG,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;IACzD,MAAM,GAAG,GAAG,GAAG,OAAO,qBAAqB,EAAE,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,GAAG,GAAG,EAAE,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC;IACtF,MAAM,GAAG,GAAG,MAAM,KAAK,CAAC,GAAG,EAAE,EAAE,OAAO,EAAE,EAAE,eAAe,EAAE,UAAU,MAAM,EAAE,EAAE,EAAE,CAAC,CAAC;IACnF,MAAM,IAAI,GAAG,MAAM,GAAG,CAAC,IAAI,EAAmD,CAAC;IAC/E,IAAI,IAAI,CAAC,KAAK;QAAE,MAAM,IAAI,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IAC5C,OAAO,IAAI,CAAC,IAAI,CAAC;AACnB,CAAC;AAbD,kDAaC;AAEM,KAAK,UAAU,YAAY,CAChC,MAAc,EACd,OAAe;IAEf,MAAM,GAAG,GAAG,MAAM,KAAK,CAAC,GAAG,OAAO,YAAY,EAAE;QAC9C,OAAO,EAAE,EAAE,eAAe,EAAE,UAAU,MAAM,EAAE,EAAE;KACjD,CAAC,CAAC;IAEH,MAAM,IAAI,GAAG,MAAM,GAAG,CAAC,IAAI,EAA4C,CAAC;IACxE,IAAI,IAAI,CAAC,KAAK;QAAE,MAAM,IAAI,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IAC5C,OAAO,IAAI,CAAC,IAAI,CAAC;AACnB,CAAC;AAXD,oCAWC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@getmarrow/mcp",
|
|
3
|
-
"version": "2.0
|
|
3
|
+
"version": "2.2.0",
|
|
4
4
|
"description": "Your go-to memory provider for all agents, for any AI model.",
|
|
5
5
|
"bin": {
|
|
6
6
|
"marrow-mcp": "dist/cli.js"
|
|
@@ -16,5 +16,9 @@
|
|
|
16
16
|
"memory",
|
|
17
17
|
"agents"
|
|
18
18
|
],
|
|
19
|
-
"license": "MIT"
|
|
20
|
-
|
|
19
|
+
"license": "MIT",
|
|
20
|
+
"files": [
|
|
21
|
+
"dist",
|
|
22
|
+
"README.md"
|
|
23
|
+
]
|
|
24
|
+
}
|
package/src/cli.ts
DELETED
|
@@ -1,235 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Marrow MCP stdio server — collective memory for Claude and MCP agents.
|
|
5
|
-
* Exposes: marrow_think, marrow_commit, marrow_status
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
import * as readline from 'readline';
|
|
9
|
-
import { marrowThink, marrowCommit, marrowStatus } from './index';
|
|
10
|
-
|
|
11
|
-
const API_KEY = process.env.MARROW_API_KEY || '';
|
|
12
|
-
const BASE_URL = process.env.MARROW_BASE_URL || 'https://api.getmarrow.ai';
|
|
13
|
-
|
|
14
|
-
if (!API_KEY) {
|
|
15
|
-
process.stderr.write('Error: MARROW_API_KEY environment variable is required\n');
|
|
16
|
-
process.exit(1);
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
// MCP protocol types
|
|
20
|
-
interface MCPRequest {
|
|
21
|
-
jsonrpc: '2.0';
|
|
22
|
-
id: string | number;
|
|
23
|
-
method: string;
|
|
24
|
-
params?: Record<string, unknown>;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
interface MCPResponse {
|
|
28
|
-
jsonrpc: '2.0';
|
|
29
|
-
id: string | number;
|
|
30
|
-
result?: unknown;
|
|
31
|
-
error?: { code: number; message: string };
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
function send(response: MCPResponse): void {
|
|
35
|
-
process.stdout.write(JSON.stringify(response) + '\n');
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
function success(id: string | number, result: unknown): void {
|
|
39
|
-
send({ jsonrpc: '2.0', id, result });
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
function error(id: string | number, code: number, message: string): void {
|
|
43
|
-
send({ jsonrpc: '2.0', id, error: { code, message } });
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
// Tool definitions
|
|
47
|
-
const TOOLS = [
|
|
48
|
-
{
|
|
49
|
-
name: 'marrow_think',
|
|
50
|
-
description:
|
|
51
|
-
'Get collective intelligence from the Marrow hive before acting. ' +
|
|
52
|
-
'Call this before every significant action. Pass previous_outcome ' +
|
|
53
|
-
'to auto-commit your last action and open a new memory session.',
|
|
54
|
-
inputSchema: {
|
|
55
|
-
type: 'object',
|
|
56
|
-
properties: {
|
|
57
|
-
action: {
|
|
58
|
-
type: 'string',
|
|
59
|
-
description: 'What the agent is about to do',
|
|
60
|
-
},
|
|
61
|
-
type: {
|
|
62
|
-
type: 'string',
|
|
63
|
-
enum: ['implementation', 'security', 'architecture', 'process', 'general'],
|
|
64
|
-
description: 'Type of action (default: general)',
|
|
65
|
-
},
|
|
66
|
-
context: {
|
|
67
|
-
type: 'object',
|
|
68
|
-
description: 'Optional metadata about the current situation',
|
|
69
|
-
},
|
|
70
|
-
previous_decision_id: {
|
|
71
|
-
type: 'string',
|
|
72
|
-
description: 'decision_id from previous think() call — auto-commits that session',
|
|
73
|
-
},
|
|
74
|
-
previous_success: {
|
|
75
|
-
type: 'boolean',
|
|
76
|
-
description: 'Did the previous action succeed?',
|
|
77
|
-
},
|
|
78
|
-
previous_outcome: {
|
|
79
|
-
type: 'string',
|
|
80
|
-
description: 'What happened in the previous action (required if previous_decision_id provided)',
|
|
81
|
-
},
|
|
82
|
-
},
|
|
83
|
-
required: ['action'],
|
|
84
|
-
},
|
|
85
|
-
},
|
|
86
|
-
{
|
|
87
|
-
name: 'marrow_commit',
|
|
88
|
-
description:
|
|
89
|
-
'Explicitly commit the result of an action to Marrow. ' +
|
|
90
|
-
'Optional — marrow_think() auto-commits if you pass previous_outcome. ' +
|
|
91
|
-
'Use when you need explicit control over commit timing.',
|
|
92
|
-
inputSchema: {
|
|
93
|
-
type: 'object',
|
|
94
|
-
properties: {
|
|
95
|
-
decision_id: {
|
|
96
|
-
type: 'string',
|
|
97
|
-
description: 'decision_id from the marrow_think call',
|
|
98
|
-
},
|
|
99
|
-
success: {
|
|
100
|
-
type: 'boolean',
|
|
101
|
-
description: 'Did the action succeed?',
|
|
102
|
-
},
|
|
103
|
-
outcome: {
|
|
104
|
-
type: 'string',
|
|
105
|
-
description: 'What happened — be specific, this trains the hive',
|
|
106
|
-
},
|
|
107
|
-
caused_by: {
|
|
108
|
-
type: 'string',
|
|
109
|
-
description: 'Optional: what caused this action',
|
|
110
|
-
},
|
|
111
|
-
},
|
|
112
|
-
required: ['decision_id', 'success', 'outcome'],
|
|
113
|
-
},
|
|
114
|
-
},
|
|
115
|
-
{
|
|
116
|
-
name: 'marrow_status',
|
|
117
|
-
description: 'Check Marrow platform health and status.',
|
|
118
|
-
inputSchema: {
|
|
119
|
-
type: 'object',
|
|
120
|
-
properties: {},
|
|
121
|
-
required: [],
|
|
122
|
-
},
|
|
123
|
-
},
|
|
124
|
-
];
|
|
125
|
-
|
|
126
|
-
// Request handler
|
|
127
|
-
async function handleRequest(req: MCPRequest): Promise<void> {
|
|
128
|
-
const { id, method, params } = req;
|
|
129
|
-
|
|
130
|
-
try {
|
|
131
|
-
if (method === 'initialize') {
|
|
132
|
-
success(id, {
|
|
133
|
-
protocolVersion: '2024-11-05',
|
|
134
|
-
capabilities: { tools: {} },
|
|
135
|
-
serverInfo: { name: 'marrow', version: '2.0.0' },
|
|
136
|
-
});
|
|
137
|
-
return;
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
if (method === 'tools/list') {
|
|
141
|
-
success(id, { tools: TOOLS });
|
|
142
|
-
return;
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
if (method === 'tools/call') {
|
|
146
|
-
const toolName = (params as Record<string, unknown>)?.name as string;
|
|
147
|
-
const args = ((params as Record<string, unknown>)?.arguments || {}) as Record<string, unknown>;
|
|
148
|
-
|
|
149
|
-
if (toolName === 'marrow_think') {
|
|
150
|
-
const result = await marrowThink(API_KEY, BASE_URL, {
|
|
151
|
-
action: args.action as string,
|
|
152
|
-
type: args.type as string | undefined,
|
|
153
|
-
context: args.context as Record<string, unknown> | undefined,
|
|
154
|
-
previous_decision_id: args.previous_decision_id as string | undefined,
|
|
155
|
-
previous_success: args.previous_success as boolean | undefined,
|
|
156
|
-
previous_outcome: args.previous_outcome as string | undefined,
|
|
157
|
-
});
|
|
158
|
-
success(id, {
|
|
159
|
-
content: [
|
|
160
|
-
{
|
|
161
|
-
type: 'text',
|
|
162
|
-
text: JSON.stringify(result, null, 2),
|
|
163
|
-
},
|
|
164
|
-
],
|
|
165
|
-
});
|
|
166
|
-
return;
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
if (toolName === 'marrow_commit') {
|
|
170
|
-
const result = await marrowCommit(API_KEY, BASE_URL, {
|
|
171
|
-
decision_id: args.decision_id as string,
|
|
172
|
-
success: args.success as boolean,
|
|
173
|
-
outcome: args.outcome as string,
|
|
174
|
-
caused_by: args.caused_by as string | undefined,
|
|
175
|
-
});
|
|
176
|
-
success(id, {
|
|
177
|
-
content: [
|
|
178
|
-
{
|
|
179
|
-
type: 'text',
|
|
180
|
-
text: JSON.stringify(result, null, 2),
|
|
181
|
-
},
|
|
182
|
-
],
|
|
183
|
-
});
|
|
184
|
-
return;
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
if (toolName === 'marrow_status') {
|
|
188
|
-
const result = await marrowStatus(API_KEY, BASE_URL);
|
|
189
|
-
success(id, {
|
|
190
|
-
content: [
|
|
191
|
-
{
|
|
192
|
-
type: 'text',
|
|
193
|
-
text: JSON.stringify(result, null, 2),
|
|
194
|
-
},
|
|
195
|
-
],
|
|
196
|
-
});
|
|
197
|
-
return;
|
|
198
|
-
}
|
|
199
|
-
|
|
200
|
-
error(id, -32601, `Unknown tool: ${toolName}`);
|
|
201
|
-
return;
|
|
202
|
-
}
|
|
203
|
-
|
|
204
|
-
// Unknown method
|
|
205
|
-
error(id, -32601, `Method not found: ${method}`);
|
|
206
|
-
} catch (err) {
|
|
207
|
-
const message = err instanceof Error ? err.message : String(err);
|
|
208
|
-
error(id, -32603, `Internal error: ${message}`);
|
|
209
|
-
}
|
|
210
|
-
}
|
|
211
|
-
|
|
212
|
-
// stdio server
|
|
213
|
-
const rl = readline.createInterface({
|
|
214
|
-
input: process.stdin,
|
|
215
|
-
output: process.stdout,
|
|
216
|
-
terminal: false,
|
|
217
|
-
});
|
|
218
|
-
|
|
219
|
-
rl.on('line', (line) => {
|
|
220
|
-
const trimmed = line.trim();
|
|
221
|
-
if (!trimmed) return;
|
|
222
|
-
|
|
223
|
-
try {
|
|
224
|
-
const req = JSON.parse(trimmed) as MCPRequest;
|
|
225
|
-
handleRequest(req).catch((err) => {
|
|
226
|
-
process.stderr.write(`Unhandled error: ${err}\n`);
|
|
227
|
-
});
|
|
228
|
-
} catch {
|
|
229
|
-
process.stderr.write(`Failed to parse request: ${trimmed}\n`);
|
|
230
|
-
}
|
|
231
|
-
});
|
|
232
|
-
|
|
233
|
-
rl.on('close', () => {
|
|
234
|
-
process.exit(0);
|
|
235
|
-
});
|
package/src/index.ts
DELETED
|
@@ -1,103 +0,0 @@
|
|
|
1
|
-
export interface MarrowIntelligence {
|
|
2
|
-
similar: Array<{ outcome: string; confidence: number }>;
|
|
3
|
-
patterns: Array<{ pattern: string; frequency: number }>;
|
|
4
|
-
templates: Array<{ steps: unknown[]; success_rate: number }>;
|
|
5
|
-
shared: Array<{ outcome: string }>;
|
|
6
|
-
causal_chain: unknown | null;
|
|
7
|
-
success_rate: number;
|
|
8
|
-
priority_score: number;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
export interface ThinkResult {
|
|
12
|
-
decision_id: string;
|
|
13
|
-
intelligence: MarrowIntelligence;
|
|
14
|
-
stream_url: string;
|
|
15
|
-
previous_committed?: boolean;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
export interface CommitResult {
|
|
19
|
-
committed: boolean;
|
|
20
|
-
success_rate: number;
|
|
21
|
-
insight: string | null;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
export interface StatusResult {
|
|
25
|
-
status: string;
|
|
26
|
-
version: string;
|
|
27
|
-
tiers: number;
|
|
28
|
-
uptime_ms: number;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
export async function marrowThink(
|
|
32
|
-
apiKey: string,
|
|
33
|
-
baseUrl: string,
|
|
34
|
-
params: {
|
|
35
|
-
action: string;
|
|
36
|
-
type?: string;
|
|
37
|
-
context?: Record<string, unknown>;
|
|
38
|
-
previous_decision_id?: string;
|
|
39
|
-
previous_success?: boolean;
|
|
40
|
-
previous_outcome?: string;
|
|
41
|
-
}
|
|
42
|
-
): Promise<ThinkResult> {
|
|
43
|
-
const body: Record<string, unknown> = {
|
|
44
|
-
action: params.action,
|
|
45
|
-
type: params.type || 'general',
|
|
46
|
-
};
|
|
47
|
-
if (params.context) body.context = params.context;
|
|
48
|
-
if (params.previous_decision_id) {
|
|
49
|
-
body.previous_decision_id = params.previous_decision_id;
|
|
50
|
-
body.previous_success = params.previous_success ?? true;
|
|
51
|
-
body.previous_outcome = params.previous_outcome ?? '';
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
const res = await fetch(`${baseUrl}/v1/agent/think`, {
|
|
55
|
-
method: 'POST',
|
|
56
|
-
headers: {
|
|
57
|
-
'Authorization': `Bearer ${apiKey}`,
|
|
58
|
-
'Content-Type': 'application/json',
|
|
59
|
-
},
|
|
60
|
-
body: JSON.stringify(body),
|
|
61
|
-
});
|
|
62
|
-
|
|
63
|
-
const json = await res.json() as { data: ThinkResult; error?: string };
|
|
64
|
-
if (json.error) throw new Error(json.error);
|
|
65
|
-
return json.data;
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
export async function marrowCommit(
|
|
69
|
-
apiKey: string,
|
|
70
|
-
baseUrl: string,
|
|
71
|
-
params: {
|
|
72
|
-
decision_id: string;
|
|
73
|
-
success: boolean;
|
|
74
|
-
outcome: string;
|
|
75
|
-
caused_by?: string;
|
|
76
|
-
}
|
|
77
|
-
): Promise<CommitResult> {
|
|
78
|
-
const res = await fetch(`${baseUrl}/v1/agent/commit`, {
|
|
79
|
-
method: 'POST',
|
|
80
|
-
headers: {
|
|
81
|
-
'Authorization': `Bearer ${apiKey}`,
|
|
82
|
-
'Content-Type': 'application/json',
|
|
83
|
-
},
|
|
84
|
-
body: JSON.stringify(params),
|
|
85
|
-
});
|
|
86
|
-
|
|
87
|
-
const json = await res.json() as { data: CommitResult; error?: string };
|
|
88
|
-
if (json.error) throw new Error(json.error);
|
|
89
|
-
return json.data;
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
export async function marrowStatus(
|
|
93
|
-
apiKey: string,
|
|
94
|
-
baseUrl: string
|
|
95
|
-
): Promise<StatusResult> {
|
|
96
|
-
const res = await fetch(`${baseUrl}/v1/health`, {
|
|
97
|
-
headers: { 'Authorization': `Bearer ${apiKey}` },
|
|
98
|
-
});
|
|
99
|
-
|
|
100
|
-
const json = await res.json() as { data: StatusResult; error?: string };
|
|
101
|
-
if (json.error) throw new Error(json.error);
|
|
102
|
-
return json.data;
|
|
103
|
-
}
|
package/tsconfig.json
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"compilerOptions": {
|
|
3
|
-
"target": "ES2020",
|
|
4
|
-
"module": "commonjs",
|
|
5
|
-
"lib": ["ES2020"],
|
|
6
|
-
"declaration": true,
|
|
7
|
-
"declarationMap": true,
|
|
8
|
-
"sourceMap": true,
|
|
9
|
-
"outDir": "./dist",
|
|
10
|
-
"rootDir": "./src",
|
|
11
|
-
"strict": true,
|
|
12
|
-
"esModuleInterop": true,
|
|
13
|
-
"skipLibCheck": true,
|
|
14
|
-
"forceConsistentCasingInFileNames": true
|
|
15
|
-
},
|
|
16
|
-
"include": ["src/**/*"],
|
|
17
|
-
"exclude": ["node_modules", "dist"]
|
|
18
|
-
}
|