@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/dist/index.d.ts CHANGED
@@ -1,55 +1,53 @@
1
- /**
2
- * Marrow MCP Server
3
- * Model Context Protocol server for Marrow collective intelligence
4
- *
5
- * Exposes tools: log_decision, get_lessons, check_safety, get_consensus
6
- */
7
- export interface MCPTool {
8
- name: string;
9
- description: string;
10
- inputSchema: {
11
- type: string;
12
- properties: Record<string, any>;
13
- required: string[];
14
- };
1
+ export interface MarrowIntelligence {
2
+ similar: Array<{
3
+ outcome: string;
4
+ confidence: number;
5
+ }>;
6
+ patterns: Array<{
7
+ pattern: string;
8
+ frequency: number;
9
+ }>;
10
+ templates: Array<{
11
+ steps: unknown[];
12
+ success_rate: number;
13
+ }>;
14
+ shared: Array<{
15
+ outcome: string;
16
+ }>;
17
+ causal_chain: unknown | null;
18
+ success_rate: number;
19
+ priority_score: number;
15
20
  }
16
- export interface MCPRequest {
17
- jsonrpc: string;
18
- id: string | number;
19
- method: string;
20
- params?: any;
21
+ export interface ThinkResult {
22
+ decision_id: string;
23
+ intelligence: MarrowIntelligence;
24
+ stream_url: string;
25
+ previous_committed?: boolean;
21
26
  }
22
- export interface MCPResponse {
23
- jsonrpc: string;
24
- id: string | number;
25
- result?: any;
26
- error?: {
27
- code: number;
28
- message: string;
29
- data?: any;
30
- };
27
+ export interface CommitResult {
28
+ committed: boolean;
29
+ success_rate: number;
30
+ insight: string | null;
31
31
  }
32
- export declare class MarrowMCPServer {
33
- private apiKey;
34
- private baseUrl;
35
- constructor(apiKey?: string);
36
- /**
37
- * Get available tools (MCP protocol)
38
- */
39
- getTools(): MCPTool[];
40
- /**
41
- * Handle tool calls (MCP protocol)
42
- */
43
- callTool(toolName: string, params: Record<string, any>): Promise<any>;
44
- /**
45
- * Process MCP request
46
- */
47
- processRequest(request: MCPRequest): Promise<MCPResponse>;
48
- private logDecision;
49
- private getLessons;
50
- private getConsensus;
51
- private checkSafety;
52
- private publishLesson;
53
- private getReputation;
32
+ export interface StatusResult {
33
+ status: string;
34
+ version: string;
35
+ tiers: number;
36
+ uptime_ms: number;
54
37
  }
55
- export default MarrowMCPServer;
38
+ export declare function marrowThink(apiKey: string, baseUrl: string, params: {
39
+ action: string;
40
+ type?: string;
41
+ context?: Record<string, unknown>;
42
+ previous_decision_id?: string;
43
+ previous_success?: boolean;
44
+ previous_outcome?: string;
45
+ }): Promise<ThinkResult>;
46
+ export declare function marrowCommit(apiKey: string, baseUrl: string, params: {
47
+ decision_id: string;
48
+ success: boolean;
49
+ outcome: string;
50
+ caused_by?: string;
51
+ }): Promise<CommitResult>;
52
+ export declare function marrowStatus(apiKey: string, baseUrl: string): Promise<StatusResult>;
53
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +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,OAAO,EAAE,MAAM,CAAC;QAAC,SAAS,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IACxD,SAAS,EAAE,KAAK,CAAC;QAAE,KAAK,EAAE,OAAO,EAAE,CAAC;QAAC,YAAY,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAC7D,MAAM,EAAE,KAAK,CAAC;QAAE,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IACnC,YAAY,EAAE,OAAO,GAAG,IAAI,CAAC;IAC7B,YAAY,EAAE,MAAM,CAAC;IACrB,cAAc,EAAE,MAAM,CAAC;CACxB;AAED,MAAM,WAAW,WAAW;IAC1B,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,kBAAkB,CAAC;IACjC,UAAU,EAAE,MAAM,CAAC;IACnB,kBAAkB,CAAC,EAAE,OAAO,CAAC;CAC9B;AAED,MAAM,WAAW,YAAY;IAC3B,SAAS,EAAE,OAAO,CAAC;IACnB,YAAY,EAAE,MAAM,CAAC;IACrB,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;CACxB;AAED,MAAM,WAAW,YAAY;IAC3B,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,wBAAsB,WAAW,CAC/B,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,MAAM,EACf,MAAM,EAAE;IACN,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAClC,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,gBAAgB,CAAC,EAAE,MAAM,CAAC;CAC3B,GACA,OAAO,CAAC,WAAW,CAAC,CAwBtB;AAED,wBAAsB,YAAY,CAChC,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,MAAM,EACf,MAAM,EAAE;IACN,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,OAAO,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,GACA,OAAO,CAAC,YAAY,CAAC,CAavB;AAED,wBAAsB,YAAY,CAChC,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,MAAM,GACd,OAAO,CAAC,YAAY,CAAC,CAQvB"}
package/dist/index.js CHANGED
@@ -1,223 +1,55 @@
1
1
  "use strict";
2
- /**
3
- * Marrow MCP Server
4
- * Model Context Protocol server for Marrow collective intelligence
5
- *
6
- * Exposes tools: log_decision, get_lessons, check_safety, get_consensus
7
- */
8
2
  Object.defineProperty(exports, "__esModule", { value: true });
9
- exports.MarrowMCPServer = void 0;
10
- class MarrowMCPServer {
11
- constructor(apiKey = process.env.MARROW_API_KEY || '') {
12
- if (!apiKey) {
13
- throw new Error('MARROW_API_KEY environment variable not set');
14
- }
15
- this.apiKey = apiKey;
16
- this.baseUrl = process.env.MARROW_API_URL || 'https://api.getmarrow.ai/v1';
17
- }
18
- /**
19
- * Get available tools (MCP protocol)
20
- */
21
- getTools() {
22
- return [
23
- {
24
- name: 'log_decision',
25
- description: 'Log a decision to Marrow. The hive learns from your decisions.',
26
- inputSchema: {
27
- type: 'object',
28
- properties: {
29
- decision_type: { type: 'string', description: 'Type of decision (e.g., "trade", "classification")' },
30
- context: { type: 'object', description: 'Decision context and input data' },
31
- outcome: { type: 'object', description: 'Decision outcome and result' },
32
- tags: { type: 'array', items: { type: 'string' }, description: 'Optional tags for categorization' }
33
- },
34
- required: ['decision_type', 'context', 'outcome']
35
- }
36
- },
37
- {
38
- name: 'get_lessons',
39
- description: 'Get published lessons (patterns) for a decision type',
40
- inputSchema: {
41
- type: 'object',
42
- properties: {
43
- decision_type: { type: 'string', description: 'Decision type to get lessons for' }
44
- },
45
- required: ['decision_type']
46
- }
47
- },
48
- {
49
- name: 'get_consensus',
50
- description: 'Get hive consensus recommendation for a decision type',
51
- inputSchema: {
52
- type: 'object',
53
- properties: {
54
- decision_type: { type: 'string', description: 'Decision type to get consensus for' }
55
- },
56
- required: ['decision_type']
57
- }
58
- },
59
- {
60
- name: 'check_safety',
61
- description: 'Check if a decision passes safety and alignment checks',
62
- inputSchema: {
63
- type: 'object',
64
- properties: {
65
- decision_type: { type: 'string', description: 'Type of decision' },
66
- context: { type: 'object', description: 'Decision context' },
67
- outcome: { type: 'object', description: 'Decision outcome' }
68
- },
69
- required: ['decision_type', 'context', 'outcome']
70
- }
71
- },
72
- {
73
- name: 'publish_lesson',
74
- description: 'Publish a lesson to the marketplace',
75
- inputSchema: {
76
- type: 'object',
77
- properties: {
78
- decision_type: { type: 'string', description: 'Type of decision' },
79
- pattern: { type: 'string', description: 'Pattern description' },
80
- success_rate: { type: 'number', description: 'Success rate (0-1)' },
81
- description: { type: 'string', description: 'Human-readable description' }
82
- },
83
- required: ['decision_type', 'pattern', 'success_rate', 'description']
84
- }
85
- },
86
- {
87
- name: 'get_reputation',
88
- description: 'Get your agent\'s reputation score in the hive',
89
- inputSchema: {
90
- type: 'object',
91
- properties: {},
92
- required: []
93
- }
94
- }
95
- ];
96
- }
97
- /**
98
- * Handle tool calls (MCP protocol)
99
- */
100
- async callTool(toolName, params) {
101
- switch (toolName) {
102
- case 'log_decision':
103
- return this.logDecision(params);
104
- case 'get_lessons':
105
- return this.getLessons(params.decision_type);
106
- case 'get_consensus':
107
- return this.getConsensus(params.decision_type);
108
- case 'check_safety':
109
- return this.checkSafety(params);
110
- case 'publish_lesson':
111
- return this.publishLesson(params);
112
- case 'get_reputation':
113
- return this.getReputation();
114
- default:
115
- throw new Error(`Unknown tool: ${toolName}`);
116
- }
117
- }
118
- /**
119
- * Process MCP request
120
- */
121
- async processRequest(request) {
122
- try {
123
- if (request.method === 'tools/list') {
124
- return {
125
- jsonrpc: '2.0',
126
- id: request.id,
127
- result: { tools: this.getTools() }
128
- };
129
- }
130
- if (request.method === 'tools/call') {
131
- const { name, arguments: args } = request.params;
132
- const result = await this.callTool(name, args);
133
- return {
134
- jsonrpc: '2.0',
135
- id: request.id,
136
- result
137
- };
138
- }
139
- throw new Error(`Unknown method: ${request.method}`);
140
- }
141
- catch (error) {
142
- return {
143
- jsonrpc: '2.0',
144
- id: request.id,
145
- error: {
146
- code: -32603,
147
- message: error instanceof Error ? error.message : 'Internal error'
148
- }
149
- };
150
- }
151
- }
152
- async logDecision(params) {
153
- const response = await fetch(`${this.baseUrl}/decisions`, {
154
- method: 'POST',
155
- headers: {
156
- 'Authorization': `Bearer ${this.apiKey}`,
157
- 'Content-Type': 'application/json'
158
- },
159
- body: JSON.stringify(params)
160
- });
161
- if (!response.ok) {
162
- throw new Error(`API error: ${response.statusText}`);
163
- }
164
- return await response.json();
165
- }
166
- async getLessons(decisionType) {
167
- const response = await fetch(`${this.baseUrl}/lessons?decision_type=${decisionType}`, {
168
- headers: { 'Authorization': `Bearer ${this.apiKey}` }
169
- });
170
- if (!response.ok) {
171
- throw new Error(`API error: ${response.statusText}`);
172
- }
173
- return await response.json();
174
- }
175
- async getConsensus(decisionType) {
176
- const response = await fetch(`${this.baseUrl}/hive/consensus/${decisionType}`, {
177
- headers: { 'Authorization': `Bearer ${this.apiKey}` }
178
- });
179
- if (!response.ok) {
180
- throw new Error(`API error: ${response.statusText}`);
181
- }
182
- return await response.json();
183
- }
184
- async checkSafety(params) {
185
- const response = await fetch(`${this.baseUrl}/safety/check`, {
186
- method: 'POST',
187
- headers: {
188
- 'Authorization': `Bearer ${this.apiKey}`,
189
- 'Content-Type': 'application/json'
190
- },
191
- body: JSON.stringify(params)
192
- });
193
- if (!response.ok) {
194
- throw new Error(`API error: ${response.statusText}`);
195
- }
196
- return await response.json();
197
- }
198
- async publishLesson(params) {
199
- const response = await fetch(`${this.baseUrl}/marketplace/lessons`, {
200
- method: 'POST',
201
- headers: {
202
- 'Authorization': `Bearer ${this.apiKey}`,
203
- 'Content-Type': 'application/json'
204
- },
205
- body: JSON.stringify(params)
206
- });
207
- if (!response.ok) {
208
- throw new Error(`API error: ${response.statusText}`);
209
- }
210
- return await response.json();
211
- }
212
- async getReputation() {
213
- const response = await fetch(`${this.baseUrl}/agent/reputation`, {
214
- headers: { 'Authorization': `Bearer ${this.apiKey}` }
215
- });
216
- if (!response.ok) {
217
- throw new Error(`API error: ${response.statusText}`);
218
- }
219
- return await response.json();
220
- }
3
+ exports.marrowStatus = exports.marrowCommit = exports.marrowThink = void 0;
4
+ async function marrowThink(apiKey, baseUrl, params) {
5
+ const body = {
6
+ action: params.action,
7
+ type: params.type || 'general',
8
+ };
9
+ if (params.context)
10
+ body.context = params.context;
11
+ if (params.previous_decision_id) {
12
+ body.previous_decision_id = params.previous_decision_id;
13
+ body.previous_success = params.previous_success ?? true;
14
+ body.previous_outcome = params.previous_outcome ?? '';
15
+ }
16
+ const res = await fetch(`${baseUrl}/v1/agent/think`, {
17
+ method: 'POST',
18
+ headers: {
19
+ 'Authorization': `Bearer ${apiKey}`,
20
+ 'Content-Type': 'application/json',
21
+ },
22
+ body: JSON.stringify(body),
23
+ });
24
+ const json = await res.json();
25
+ if (json.error)
26
+ throw new Error(json.error);
27
+ return json.data;
28
+ }
29
+ exports.marrowThink = marrowThink;
30
+ async function marrowCommit(apiKey, baseUrl, params) {
31
+ const res = await fetch(`${baseUrl}/v1/agent/commit`, {
32
+ method: 'POST',
33
+ headers: {
34
+ 'Authorization': `Bearer ${apiKey}`,
35
+ 'Content-Type': 'application/json',
36
+ },
37
+ body: JSON.stringify(params),
38
+ });
39
+ const json = await res.json();
40
+ if (json.error)
41
+ throw new Error(json.error);
42
+ return json.data;
43
+ }
44
+ exports.marrowCommit = marrowCommit;
45
+ async function marrowStatus(apiKey, baseUrl) {
46
+ const res = await fetch(`${baseUrl}/v1/health`, {
47
+ headers: { 'Authorization': `Bearer ${apiKey}` },
48
+ });
49
+ const json = await res.json();
50
+ if (json.error)
51
+ throw new Error(json.error);
52
+ return json.data;
221
53
  }
222
- exports.MarrowMCPServer = MarrowMCPServer;
223
- exports.default = MarrowMCPServer;
54
+ exports.marrowStatus = marrowStatus;
55
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AA8BO,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,MAA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AAC;AACnB,CAAC;AAtBD,oCAsBC;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,49 +1,20 @@
1
1
  {
2
2
  "name": "@getmarrow/mcp",
3
- "version": "1.1.1",
4
- "description": "Marrow MCP Server Bring collective intelligence to Claude, Cline, and AI agents via Model Context Protocol. Connect to the hive.",
3
+ "version": "2.0.1",
4
+ "description": "Your go-to memory provider for all agents, for any AI model.",
5
+ "bin": {
6
+ "marrow-mcp": "dist/cli.js"
7
+ },
5
8
  "main": "dist/index.js",
6
- "types": "dist/index.d.ts",
7
- "files": [
8
- "dist",
9
- "README.md",
10
- "LICENSE"
11
- ],
12
9
  "scripts": {
13
- "build": "tsc",
14
- "prepublishOnly": "npm run build"
10
+ "build": "tsc"
15
11
  },
16
12
  "keywords": [
17
- "collective-intelligence",
18
- "ai-agents",
19
- "hive",
20
- "shared-learning",
21
13
  "mcp",
22
- "model-context-protocol",
14
+ "claude",
23
15
  "ai",
24
- "agents",
25
- "memory"
16
+ "memory",
17
+ "agents"
26
18
  ],
27
- "author": "Buu (Marrow)",
28
- "license": "MIT",
29
- "repository": {
30
- "type": "git",
31
- "url": "https://github.com/getmarrow/mcp-server.git"
32
- },
33
- "publishConfig": {
34
- "registry": "https://registry.npmjs.org",
35
- "access": "public"
36
- },
37
- "bin": {
38
- "marrow-mcp": "dist/cli.js"
39
- },
40
- "devDependencies": {
41
- "@types/jest": "^29.5.0",
42
- "@types/node": "^20.0.0",
43
- "jest": "^29.5.0",
44
- "typescript": "^5.0.0"
45
- },
46
- "engines": {
47
- "node": ">=18.0.0"
48
- }
49
- }
19
+ "license": "MIT"
20
+ }