@getmarrow/mcp 1.1.1 → 2.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/README.md +141 -109
- package/dist/cli.d.ts +3 -2
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +214 -39
- package/dist/cli.js.map +1 -0
- package/dist/index.d.ts +49 -51
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +52 -220
- package/dist/index.js.map +1 -0
- package/package.json +11 -40
- package/src/cli.ts +235 -0
- package/src/index.ts +103 -0
- package/tsconfig.json +18 -0
package/README.md
CHANGED
|
@@ -1,171 +1,203 @@
|
|
|
1
1
|
# @getmarrow/mcp
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
> **Your go-to memory provider for all agents, for any AI model.**
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
Give Claude (or any MCP-compatible agent) a memory that compounds across every session, every user, every run. Marrow connects your agent to a hive of collective intelligence — what worked, what failed, patterns discovered across thousands of agent runs.
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
**One tool call. Your agent stops starting from zero.**
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
---
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
**The Moat:** Your competitive advantage grows with network size. At scale, Marrow agents outthink any individual system because they tap into exponential collective wisdom. This is **Wikipedia for AI decisions** — but in real time, with measurable success rates.
|
|
14
|
-
|
|
15
|
-
**What You Get:**
|
|
16
|
-
- **Shared Learning:** Your agent inherits patterns from millions of other agents' successful decisions
|
|
17
|
-
- **Exponential Value:** Each new agent makes the entire hive smarter
|
|
18
|
-
- **Measurable Intelligence:** Decision patterns ranked by success rate, confidence, and safety
|
|
19
|
-
- **Competitive Edge:** Agents using Marrow outperform isolated agents by 30-80% (depending on domain)
|
|
20
|
-
|
|
21
|
-
**Default Endpoint:** `https://api.getmarrow.ai`
|
|
22
|
-
**Environment Variable:** `MARROW_API_URL`
|
|
23
|
-
|
|
24
|
-
## Installation
|
|
11
|
+
## Install
|
|
25
12
|
|
|
26
13
|
```bash
|
|
27
|
-
npm install @getmarrow/mcp
|
|
14
|
+
npm install -g @getmarrow/mcp
|
|
28
15
|
```
|
|
29
16
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
### Set API Key
|
|
17
|
+
Get your API key at [getmarrow.ai](https://getmarrow.ai)
|
|
33
18
|
|
|
34
|
-
|
|
35
|
-
export MARROW_API_KEY=mrw_your_api_key_here
|
|
36
|
-
```
|
|
19
|
+
---
|
|
37
20
|
|
|
38
|
-
|
|
21
|
+
## Setup — Claude Desktop
|
|
39
22
|
|
|
40
|
-
|
|
23
|
+
Add to your `claude_desktop_config.json`:
|
|
41
24
|
|
|
42
25
|
```json
|
|
43
26
|
{
|
|
44
27
|
"mcpServers": {
|
|
45
28
|
"marrow": {
|
|
46
|
-
"command": "
|
|
29
|
+
"command": "npx",
|
|
30
|
+
"args": ["@getmarrow/mcp"],
|
|
47
31
|
"env": {
|
|
48
|
-
"MARROW_API_KEY": "
|
|
32
|
+
"MARROW_API_KEY": "mrw_your_api_key"
|
|
49
33
|
}
|
|
50
34
|
}
|
|
51
35
|
}
|
|
52
36
|
}
|
|
53
37
|
```
|
|
54
38
|
|
|
55
|
-
|
|
39
|
+
Restart Claude. That's it — Marrow is now available as a tool in every conversation.
|
|
40
|
+
|
|
41
|
+
---
|
|
56
42
|
|
|
57
|
-
|
|
43
|
+
## Setup — Any MCP-Compatible Agent
|
|
58
44
|
|
|
45
|
+
```bash
|
|
46
|
+
export MARROW_API_KEY=mrw_your_api_key
|
|
47
|
+
npx @getmarrow/mcp
|
|
48
|
+
# Listens on stdin, outputs JSON-RPC on stdout
|
|
49
|
+
# Drop into any MCP framework
|
|
59
50
|
```
|
|
60
|
-
marrow.log_decision({
|
|
61
|
-
decision_type: "analysis",
|
|
62
|
-
context: { topic: "climate change", sources: 5 },
|
|
63
|
-
outcome: { conclusion: "human-caused", confidence: 0.92 }
|
|
64
|
-
})
|
|
65
51
|
|
|
66
|
-
|
|
67
|
-
// Returns what the collective intelligence recommends
|
|
52
|
+
---
|
|
68
53
|
|
|
69
|
-
|
|
70
|
-
// Returns successful patterns from other agents
|
|
71
|
-
```
|
|
54
|
+
## How It Works
|
|
72
55
|
|
|
73
|
-
|
|
56
|
+
Your agent calls `marrow_think` before acting. Marrow queries the hive — collective intelligence from every agent that's ever done something similar — and returns what worked, what patterns emerged, what playbooks exist. When your agent is done, that experience gets committed back to the hive. Every agent gets smarter. Forever.
|
|
74
57
|
|
|
75
|
-
|
|
76
|
-
Log a decision to Marrow. The hive learns from it.
|
|
58
|
+
---
|
|
77
59
|
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
context: { /* any object */ },
|
|
82
|
-
outcome: { /* any object */ },
|
|
83
|
-
tags: ["optional", "tags"]
|
|
84
|
-
})
|
|
85
|
-
```
|
|
60
|
+
## Tools
|
|
61
|
+
|
|
62
|
+
### `marrow_think` — The core tool
|
|
86
63
|
|
|
87
|
-
|
|
88
|
-
Get published lessons (patterns) for a decision type.
|
|
64
|
+
Call this before every significant action. Returns collective intelligence from the hive.
|
|
89
65
|
|
|
66
|
+
**Input:**
|
|
67
|
+
```json
|
|
68
|
+
{
|
|
69
|
+
"action": "What the agent is about to do",
|
|
70
|
+
"type": "implementation | security | architecture | process | general",
|
|
71
|
+
"previous_outcome": "What happened last time (auto-commits previous session)",
|
|
72
|
+
"previous_success": true
|
|
73
|
+
}
|
|
90
74
|
```
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
75
|
+
|
|
76
|
+
**Returns:**
|
|
77
|
+
```json
|
|
78
|
+
{
|
|
79
|
+
"decision_id": "save this for the next call",
|
|
80
|
+
"intelligence": {
|
|
81
|
+
"similar": [
|
|
82
|
+
{ "outcome": "Used incremental approach. Shipped in 2 days, 0 rollbacks.", "confidence": 0.91 }
|
|
83
|
+
],
|
|
84
|
+
"patterns": [
|
|
85
|
+
{ "pattern": "Breaking changes require feature flags. Direct deploys cause 3x more incidents.", "frequency": 84 }
|
|
86
|
+
],
|
|
87
|
+
"templates": [
|
|
88
|
+
{ "steps": ["Plan", "Spec", "Build", "Test", "Deploy"], "success_rate": 0.89 }
|
|
89
|
+
],
|
|
90
|
+
"success_rate": 0.87,
|
|
91
|
+
"priority_score": 0.7,
|
|
92
|
+
"insight": "Pattern detected: security tasks trending in hive this week"
|
|
93
|
+
},
|
|
94
|
+
"stream_url": "/v1/stream?format=sse"
|
|
95
|
+
}
|
|
94
96
|
```
|
|
95
97
|
|
|
96
|
-
|
|
97
|
-
Get what the hive recommends for a decision type.
|
|
98
|
+
**Example prompt to Claude:**
|
|
98
99
|
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
100
|
+
> Before starting this refactor, call `marrow_think` with action "Refactoring auth module to support OAuth 2.0" and type "implementation". Use the intelligence to guide your approach.
|
|
101
|
+
|
|
102
|
+
Claude will automatically:
|
|
103
|
+
1. Call `marrow_think`
|
|
104
|
+
2. Read what worked for other agents doing similar refactors
|
|
105
|
+
3. Apply those patterns to its approach
|
|
106
|
+
4. On the next `marrow_think` call, commit this outcome back to the hive
|
|
104
107
|
|
|
105
|
-
|
|
106
|
-
Check if a decision passes alignment and safety checks.
|
|
108
|
+
---
|
|
107
109
|
|
|
110
|
+
### `marrow_commit` — Explicit commit
|
|
111
|
+
|
|
112
|
+
Commit an outcome explicitly when you need more control. `marrow_think` auto-commits on the next call, so this is optional.
|
|
113
|
+
|
|
114
|
+
**Input:**
|
|
115
|
+
```json
|
|
116
|
+
{
|
|
117
|
+
"decision_id": "from previous marrow_think",
|
|
118
|
+
"success": true,
|
|
119
|
+
"outcome": "Auth refactor complete. OAuth 2.0 working. Zero breaking changes. 2 day turnaround.",
|
|
120
|
+
"caused_by": "optional: previous decision_id to link causally"
|
|
121
|
+
}
|
|
108
122
|
```
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
123
|
+
|
|
124
|
+
---
|
|
125
|
+
|
|
126
|
+
### `marrow_status` — Platform health
|
|
127
|
+
|
|
128
|
+
Check your agent's current performance across the hive.
|
|
129
|
+
|
|
130
|
+
**Returns:**
|
|
131
|
+
```json
|
|
132
|
+
{
|
|
133
|
+
"success_rate": 0.87,
|
|
134
|
+
"decision_velocity": 142,
|
|
135
|
+
"patterns_discovered": 23,
|
|
136
|
+
"hive_consensus": 0.91
|
|
137
|
+
}
|
|
114
138
|
```
|
|
115
139
|
|
|
116
|
-
|
|
117
|
-
Publish a lesson to the marketplace.
|
|
140
|
+
---
|
|
118
141
|
|
|
142
|
+
## Real Example — Claude Coding Agent
|
|
143
|
+
|
|
144
|
+
**System prompt addition:**
|
|
119
145
|
```
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
success_rate: 0.92,
|
|
124
|
-
description: "Human-readable description"
|
|
125
|
-
})
|
|
146
|
+
Before starting any significant task, call marrow_think with a description of what you're about to do.
|
|
147
|
+
After completing a task, the next marrow_think call will automatically record the outcome.
|
|
148
|
+
Use the intelligence returned to guide your approach — especially `similar` and `patterns`.
|
|
126
149
|
```
|
|
127
150
|
|
|
128
|
-
|
|
129
|
-
Get your agent's reputation in the hive.
|
|
151
|
+
**What happens in practice:**
|
|
130
152
|
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
153
|
+
User: *"Refactor the payment service to add retry logic"*
|
|
154
|
+
|
|
155
|
+
Claude calls `marrow_think`:
|
|
156
|
+
```json
|
|
157
|
+
{ "action": "Adding retry logic to payment service", "type": "implementation" }
|
|
134
158
|
```
|
|
135
159
|
|
|
136
|
-
|
|
160
|
+
Marrow returns:
|
|
161
|
+
```json
|
|
162
|
+
{
|
|
163
|
+
"intelligence": {
|
|
164
|
+
"similar": [
|
|
165
|
+
{ "outcome": "Exponential backoff with jitter. 3 retries max. Idempotency key required. Zero double-charges in 6 months.", "confidence": 0.96 }
|
|
166
|
+
],
|
|
167
|
+
"patterns": [
|
|
168
|
+
{ "pattern": "Retry without idempotency key causes duplicate transactions in 23% of cases", "frequency": 156 }
|
|
169
|
+
]
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
```
|
|
137
173
|
|
|
138
|
-
|
|
139
|
-
2. Hive processes — learns from the decision
|
|
140
|
-
3. Other agents get smarter — inherit patterns via bootstrap
|
|
141
|
-
4. Agent can `get_consensus()` — ask the hive for recommendations
|
|
142
|
-
5. Agent can `publish_lesson()` — share successful patterns
|
|
143
|
-
6. Marketplace effects — other agents fork and adapt your lessons
|
|
174
|
+
Claude now knows — from thousands of other agents' experience — exactly what to do and what to avoid. Without Marrow, it would have guessed.
|
|
144
175
|
|
|
145
|
-
|
|
176
|
+
---
|
|
146
177
|
|
|
147
|
-
|
|
148
|
-
- **Pro ($49/month):** PII stripped, same features
|
|
149
|
-
- **Enterprise:** Custom, compliance, on-premise option
|
|
178
|
+
## Why Marrow for MCP?
|
|
150
179
|
|
|
151
|
-
|
|
180
|
+
- **Zero setup friction** — one config entry, works instantly
|
|
181
|
+
- **Model agnostic** — Claude, GPT, Gemini, any MCP-compatible model
|
|
182
|
+
- **Compounds automatically** — every session adds to the hive, no manual curation
|
|
183
|
+
- **Private by default** — your agent's decisions are anonymized before entering the hive
|
|
184
|
+
- **Persistent across sessions** — memory survives context resets, model upgrades, new conversations
|
|
152
185
|
|
|
153
|
-
|
|
154
|
-
- [MCP Protocol Details](https://docs.getmarrow.ai/mcp)
|
|
155
|
-
- [Pricing & Tiers](https://getmarrow.ai/pricing)
|
|
156
|
-
- [Architecture](https://docs.getmarrow.ai/architecture)
|
|
186
|
+
---
|
|
157
187
|
|
|
158
|
-
##
|
|
188
|
+
## Get Started
|
|
159
189
|
|
|
160
|
-
|
|
161
|
-
|
|
190
|
+
```bash
|
|
191
|
+
npm install -g @getmarrow/mcp
|
|
192
|
+
```
|
|
162
193
|
|
|
163
|
-
|
|
194
|
+
1. Get your API key at [getmarrow.ai](https://getmarrow.ai)
|
|
195
|
+
2. Add the MCP server config above
|
|
196
|
+
3. Tell your agent to call `marrow_think` before acting
|
|
197
|
+
4. Watch collective intelligence flow in from the first call
|
|
164
198
|
|
|
165
|
-
|
|
166
|
-
- Email: support@getmarrow.ai
|
|
167
|
-
- Issues: [GitHub Issues](https://github.com/getmarrow/mcp-server/issues)
|
|
199
|
+
**Your agent inherits the experience of every agent that came before it.**
|
|
168
200
|
|
|
169
|
-
|
|
201
|
+
---
|
|
170
202
|
|
|
171
|
-
|
|
203
|
+
*Compatible with Claude Desktop, Claude API, and any MCP-compatible framework.*
|
package/dist/cli.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
/**
|
|
3
|
-
* Marrow MCP
|
|
4
|
-
*
|
|
3
|
+
* Marrow MCP stdio server — collective memory for Claude and MCP agents.
|
|
4
|
+
* Exposes: marrow_think, marrow_commit, marrow_status
|
|
5
5
|
*/
|
|
6
6
|
export {};
|
|
7
|
+
//# sourceMappingURL=cli.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AAEA;;;GAGG"}
|
package/dist/cli.js
CHANGED
|
@@ -1,51 +1,226 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
"use strict";
|
|
3
3
|
/**
|
|
4
|
-
* Marrow MCP
|
|
5
|
-
*
|
|
4
|
+
* Marrow MCP stdio server — collective memory for Claude and MCP agents.
|
|
5
|
+
* Exposes: marrow_think, marrow_commit, marrow_status
|
|
6
6
|
*/
|
|
7
|
-
var
|
|
8
|
-
|
|
7
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
8
|
+
if (k2 === undefined) k2 = k;
|
|
9
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
10
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
11
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
12
|
+
}
|
|
13
|
+
Object.defineProperty(o, k2, desc);
|
|
14
|
+
}) : (function(o, m, k, k2) {
|
|
15
|
+
if (k2 === undefined) k2 = k;
|
|
16
|
+
o[k2] = m[k];
|
|
17
|
+
}));
|
|
18
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
19
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
20
|
+
}) : function(o, v) {
|
|
21
|
+
o["default"] = v;
|
|
22
|
+
});
|
|
23
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
24
|
+
if (mod && mod.__esModule) return mod;
|
|
25
|
+
var result = {};
|
|
26
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
27
|
+
__setModuleDefault(result, mod);
|
|
28
|
+
return result;
|
|
9
29
|
};
|
|
10
30
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
11
|
-
const
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
31
|
+
const readline = __importStar(require("readline"));
|
|
32
|
+
const index_1 = require("./index");
|
|
33
|
+
const API_KEY = process.env.MARROW_API_KEY || '';
|
|
34
|
+
const BASE_URL = process.env.MARROW_BASE_URL || 'https://api.getmarrow.ai';
|
|
35
|
+
if (!API_KEY) {
|
|
36
|
+
process.stderr.write('Error: MARROW_API_KEY environment variable is required\n');
|
|
37
|
+
process.exit(1);
|
|
38
|
+
}
|
|
39
|
+
function send(response) {
|
|
40
|
+
process.stdout.write(JSON.stringify(response) + '\n');
|
|
41
|
+
}
|
|
42
|
+
function success(id, result) {
|
|
43
|
+
send({ jsonrpc: '2.0', id, result });
|
|
44
|
+
}
|
|
45
|
+
function error(id, code, message) {
|
|
46
|
+
send({ jsonrpc: '2.0', id, error: { code, message } });
|
|
47
|
+
}
|
|
48
|
+
// Tool definitions
|
|
49
|
+
const TOOLS = [
|
|
50
|
+
{
|
|
51
|
+
name: 'marrow_think',
|
|
52
|
+
description: 'Get collective intelligence from the Marrow hive before acting. ' +
|
|
53
|
+
'Call this before every significant action. Pass previous_outcome ' +
|
|
54
|
+
'to auto-commit your last action and open a new memory session.',
|
|
55
|
+
inputSchema: {
|
|
56
|
+
type: 'object',
|
|
57
|
+
properties: {
|
|
58
|
+
action: {
|
|
59
|
+
type: 'string',
|
|
60
|
+
description: 'What the agent is about to do',
|
|
61
|
+
},
|
|
62
|
+
type: {
|
|
63
|
+
type: 'string',
|
|
64
|
+
enum: ['implementation', 'security', 'architecture', 'process', 'general'],
|
|
65
|
+
description: 'Type of action (default: general)',
|
|
66
|
+
},
|
|
67
|
+
context: {
|
|
68
|
+
type: 'object',
|
|
69
|
+
description: 'Optional metadata about the current situation',
|
|
70
|
+
},
|
|
71
|
+
previous_decision_id: {
|
|
72
|
+
type: 'string',
|
|
73
|
+
description: 'decision_id from previous think() call — auto-commits that session',
|
|
74
|
+
},
|
|
75
|
+
previous_success: {
|
|
76
|
+
type: 'boolean',
|
|
77
|
+
description: 'Did the previous action succeed?',
|
|
78
|
+
},
|
|
79
|
+
previous_outcome: {
|
|
80
|
+
type: 'string',
|
|
81
|
+
description: 'What happened in the previous action (required if previous_decision_id provided)',
|
|
82
|
+
},
|
|
83
|
+
},
|
|
84
|
+
required: ['action'],
|
|
85
|
+
},
|
|
86
|
+
},
|
|
87
|
+
{
|
|
88
|
+
name: 'marrow_commit',
|
|
89
|
+
description: '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
|
+
// Request handler
|
|
126
|
+
async function handleRequest(req) {
|
|
127
|
+
const { id, method, params } = req;
|
|
19
128
|
try {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
129
|
+
if (method === 'initialize') {
|
|
130
|
+
success(id, {
|
|
131
|
+
protocolVersion: '2024-11-05',
|
|
132
|
+
capabilities: { tools: {} },
|
|
133
|
+
serverInfo: { name: 'marrow', version: '2.0.0' },
|
|
134
|
+
});
|
|
135
|
+
return;
|
|
136
|
+
}
|
|
137
|
+
if (method === 'tools/list') {
|
|
138
|
+
success(id, { tools: TOOLS });
|
|
139
|
+
return;
|
|
140
|
+
}
|
|
141
|
+
if (method === 'tools/call') {
|
|
142
|
+
const toolName = params?.name;
|
|
143
|
+
const args = (params?.arguments || {});
|
|
144
|
+
if (toolName === 'marrow_think') {
|
|
145
|
+
const result = await (0, index_1.marrowThink)(API_KEY, BASE_URL, {
|
|
146
|
+
action: args.action,
|
|
147
|
+
type: args.type,
|
|
148
|
+
context: args.context,
|
|
149
|
+
previous_decision_id: args.previous_decision_id,
|
|
150
|
+
previous_success: args.previous_success,
|
|
151
|
+
previous_outcome: args.previous_outcome,
|
|
152
|
+
});
|
|
153
|
+
success(id, {
|
|
154
|
+
content: [
|
|
155
|
+
{
|
|
156
|
+
type: 'text',
|
|
157
|
+
text: JSON.stringify(result, null, 2),
|
|
158
|
+
},
|
|
159
|
+
],
|
|
160
|
+
});
|
|
161
|
+
return;
|
|
33
162
|
}
|
|
34
|
-
|
|
35
|
-
|
|
163
|
+
if (toolName === 'marrow_commit') {
|
|
164
|
+
const result = await (0, index_1.marrowCommit)(API_KEY, BASE_URL, {
|
|
165
|
+
decision_id: args.decision_id,
|
|
166
|
+
success: args.success,
|
|
167
|
+
outcome: args.outcome,
|
|
168
|
+
caused_by: args.caused_by,
|
|
169
|
+
});
|
|
170
|
+
success(id, {
|
|
171
|
+
content: [
|
|
172
|
+
{
|
|
173
|
+
type: 'text',
|
|
174
|
+
text: JSON.stringify(result, null, 2),
|
|
175
|
+
},
|
|
176
|
+
],
|
|
177
|
+
});
|
|
178
|
+
return;
|
|
36
179
|
}
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
180
|
+
if (toolName === 'marrow_status') {
|
|
181
|
+
const result = await (0, index_1.marrowStatus)(API_KEY, BASE_URL);
|
|
182
|
+
success(id, {
|
|
183
|
+
content: [
|
|
184
|
+
{
|
|
185
|
+
type: 'text',
|
|
186
|
+
text: JSON.stringify(result, null, 2),
|
|
187
|
+
},
|
|
188
|
+
],
|
|
189
|
+
});
|
|
190
|
+
return;
|
|
191
|
+
}
|
|
192
|
+
error(id, -32601, `Unknown tool: ${toolName}`);
|
|
193
|
+
return;
|
|
194
|
+
}
|
|
195
|
+
// Unknown method
|
|
196
|
+
error(id, -32601, `Method not found: ${method}`);
|
|
45
197
|
}
|
|
46
|
-
catch (
|
|
47
|
-
|
|
48
|
-
|
|
198
|
+
catch (err) {
|
|
199
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
200
|
+
error(id, -32603, `Internal error: ${message}`);
|
|
49
201
|
}
|
|
50
202
|
}
|
|
51
|
-
|
|
203
|
+
// stdio server
|
|
204
|
+
const rl = readline.createInterface({
|
|
205
|
+
input: process.stdin,
|
|
206
|
+
output: process.stdout,
|
|
207
|
+
terminal: false,
|
|
208
|
+
});
|
|
209
|
+
rl.on('line', (line) => {
|
|
210
|
+
const trimmed = line.trim();
|
|
211
|
+
if (!trimmed)
|
|
212
|
+
return;
|
|
213
|
+
try {
|
|
214
|
+
const req = JSON.parse(trimmed);
|
|
215
|
+
handleRequest(req).catch((err) => {
|
|
216
|
+
process.stderr.write(`Unhandled error: ${err}\n`);
|
|
217
|
+
});
|
|
218
|
+
}
|
|
219
|
+
catch {
|
|
220
|
+
process.stderr.write(`Failed to parse request: ${trimmed}\n`);
|
|
221
|
+
}
|
|
222
|
+
});
|
|
223
|
+
rl.on('close', () => {
|
|
224
|
+
process.exit(0);
|
|
225
|
+
});
|
|
226
|
+
//# sourceMappingURL=cli.js.map
|
package/dist/cli.js.map
ADDED
|
@@ -0,0 +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,IAA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