@kalera/munin-runtime 0.1.0 → 1.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/.turbo/turbo-build.log +1 -1
- package/dist/index.d.ts +0 -1
- package/dist/index.js +1 -6
- package/dist/mcp-server.js +24 -12
- package/package.json +2 -2
- package/src/index.ts +1 -8
- package/src/mcp-server.ts +27 -12
package/.turbo/turbo-build.log
CHANGED
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -18,13 +18,8 @@ export function parseCliArgs(argv, usage) {
|
|
|
18
18
|
}
|
|
19
19
|
}
|
|
20
20
|
export function loadCliEnv() {
|
|
21
|
-
const baseUrl = process.env.MUNIN_BASE_URL;
|
|
22
|
-
if (!baseUrl) {
|
|
23
|
-
throw new Error("MUNIN_BASE_URL is required");
|
|
24
|
-
}
|
|
25
21
|
return {
|
|
26
|
-
baseUrl,
|
|
27
|
-
project: process.env.MUNIN_PROJECT ?? "default",
|
|
22
|
+
baseUrl: "https://munin.kalera.dev",
|
|
28
23
|
apiKey: process.env.MUNIN_API_KEY,
|
|
29
24
|
timeoutMs: Number(process.env.MUNIN_TIMEOUT_MS ?? 15000),
|
|
30
25
|
retries: Number(process.env.MUNIN_RETRIES ?? 3),
|
package/dist/mcp-server.js
CHANGED
|
@@ -7,13 +7,12 @@ export async function startMcpServer() {
|
|
|
7
7
|
const env = loadCliEnv();
|
|
8
8
|
const client = new MuninClient({
|
|
9
9
|
baseUrl: env.baseUrl,
|
|
10
|
-
project: env.project,
|
|
11
10
|
apiKey: env.apiKey,
|
|
12
11
|
timeoutMs: env.timeoutMs,
|
|
13
12
|
});
|
|
14
13
|
const server = new Server({
|
|
15
14
|
name: "munin-mcp-server",
|
|
16
|
-
version: "
|
|
15
|
+
version: "1.0.0",
|
|
17
16
|
}, {
|
|
18
17
|
capabilities: {
|
|
19
18
|
tools: {},
|
|
@@ -24,10 +23,11 @@ export async function startMcpServer() {
|
|
|
24
23
|
tools: [
|
|
25
24
|
{
|
|
26
25
|
name: "munin_store_memory",
|
|
27
|
-
description: "Store or update a memory in Munin.
|
|
26
|
+
description: "Store or update a memory in Munin Context Core. It will automatically use the active project from environment if projectId is omitted. IMPORTANT: Call this as an MCP tool, NOT as a shell command.",
|
|
28
27
|
inputSchema: {
|
|
29
28
|
type: "object",
|
|
30
29
|
properties: {
|
|
30
|
+
projectId: { type: "string", description: "Optional. Only use if cross-saving to a different Context Core ID." },
|
|
31
31
|
key: { type: "string", description: "Unique identifier for this memory" },
|
|
32
32
|
content: { type: "string", description: "The content to remember" },
|
|
33
33
|
title: { type: "string", description: "Optional title" },
|
|
@@ -42,10 +42,11 @@ export async function startMcpServer() {
|
|
|
42
42
|
},
|
|
43
43
|
{
|
|
44
44
|
name: "munin_retrieve_memory",
|
|
45
|
-
description: "Retrieve a memory by its unique key.",
|
|
45
|
+
description: "Retrieve a memory by its unique key from the current Munin Context Core. IMPORTANT: Call this as an MCP tool, NOT as a shell command.",
|
|
46
46
|
inputSchema: {
|
|
47
47
|
type: "object",
|
|
48
48
|
properties: {
|
|
49
|
+
projectId: { type: "string", description: "Optional. The Munin Context Core ID." },
|
|
49
50
|
key: { type: "string", description: "Unique identifier" },
|
|
50
51
|
},
|
|
51
52
|
required: ["key"],
|
|
@@ -53,10 +54,11 @@ export async function startMcpServer() {
|
|
|
53
54
|
},
|
|
54
55
|
{
|
|
55
56
|
name: "munin_search_memories",
|
|
56
|
-
description: "Search for memories using semantic search or keywords.",
|
|
57
|
+
description: "Search for memories using semantic search or keywords. Returns formatted, token-efficient GraphRAG context. IMPORTANT: Call this as an MCP tool, NOT as a shell command.",
|
|
57
58
|
inputSchema: {
|
|
58
59
|
type: "object",
|
|
59
60
|
properties: {
|
|
61
|
+
projectId: { type: "string", description: "Optional. The Munin Context Core ID." },
|
|
60
62
|
query: { type: "string", description: "Search query" },
|
|
61
63
|
tags: { type: "array", items: { type: "string" } },
|
|
62
64
|
limit: { type: "number", description: "Max results (default: 10)" },
|
|
@@ -66,23 +68,27 @@ export async function startMcpServer() {
|
|
|
66
68
|
},
|
|
67
69
|
{
|
|
68
70
|
name: "munin_list_memories",
|
|
69
|
-
description: "List all memories with pagination.",
|
|
71
|
+
description: "List all memories with pagination. IMPORTANT: Call this as an MCP tool, NOT as a shell command.",
|
|
70
72
|
inputSchema: {
|
|
71
73
|
type: "object",
|
|
72
74
|
properties: {
|
|
75
|
+
projectId: { type: "string", description: "Optional. The Munin Context Core ID." },
|
|
73
76
|
limit: { type: "number" },
|
|
74
77
|
offset: { type: "number" },
|
|
75
78
|
},
|
|
79
|
+
required: [],
|
|
76
80
|
},
|
|
77
81
|
},
|
|
78
82
|
{
|
|
79
83
|
name: "munin_recent_memories",
|
|
80
|
-
description: "Get the most recently updated memories.",
|
|
84
|
+
description: "Get the most recently updated memories. IMPORTANT: Call this as an MCP tool, NOT as a shell command.",
|
|
81
85
|
inputSchema: {
|
|
82
86
|
type: "object",
|
|
83
87
|
properties: {
|
|
88
|
+
projectId: { type: "string", description: "Optional. The Munin Context Core ID." },
|
|
84
89
|
limit: { type: "number" },
|
|
85
90
|
},
|
|
91
|
+
required: [],
|
|
86
92
|
},
|
|
87
93
|
},
|
|
88
94
|
],
|
|
@@ -91,22 +97,28 @@ export async function startMcpServer() {
|
|
|
91
97
|
server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
92
98
|
try {
|
|
93
99
|
const args = request.params.arguments || {};
|
|
100
|
+
const projectId = args.projectId || process.env.MUNIN_PROJECT;
|
|
101
|
+
if (!projectId) {
|
|
102
|
+
throw new Error("projectId is required in arguments or MUNIN_PROJECT environment variable");
|
|
103
|
+
}
|
|
104
|
+
// Remove projectId from args before sending as payload
|
|
105
|
+
const { projectId: _ignored, ...payload } = args;
|
|
94
106
|
let result;
|
|
95
107
|
switch (request.params.name) {
|
|
96
108
|
case "munin_store_memory":
|
|
97
|
-
result = await client.store(
|
|
109
|
+
result = await client.store(projectId, payload);
|
|
98
110
|
break;
|
|
99
111
|
case "munin_retrieve_memory":
|
|
100
|
-
result = await client.retrieve(
|
|
112
|
+
result = await client.retrieve(projectId, payload);
|
|
101
113
|
break;
|
|
102
114
|
case "munin_search_memories":
|
|
103
|
-
result = await client.search(
|
|
115
|
+
result = await client.search(projectId, payload);
|
|
104
116
|
break;
|
|
105
117
|
case "munin_list_memories":
|
|
106
|
-
result = await client.list(
|
|
118
|
+
result = await client.list(projectId, payload);
|
|
107
119
|
break;
|
|
108
120
|
case "munin_recent_memories":
|
|
109
|
-
result = await client.recent(
|
|
121
|
+
result = await client.recent(projectId, payload);
|
|
110
122
|
break;
|
|
111
123
|
default:
|
|
112
124
|
throw new Error(`Unknown tool: ${request.params.name}`);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kalera/munin-runtime",
|
|
3
|
-
"version": "0.1
|
|
3
|
+
"version": "1.0.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
},
|
|
13
13
|
"dependencies": {
|
|
14
14
|
"@modelcontextprotocol/sdk": "^1.27.1",
|
|
15
|
-
"@kalera/munin-sdk": "0.1
|
|
15
|
+
"@kalera/munin-sdk": "1.0.1"
|
|
16
16
|
},
|
|
17
17
|
"scripts": {
|
|
18
18
|
"build": "tsc -p tsconfig.json",
|
package/src/index.ts
CHANGED
|
@@ -5,7 +5,6 @@ export interface ParsedCliArgs {
|
|
|
5
5
|
|
|
6
6
|
export interface CliEnv {
|
|
7
7
|
baseUrl: string;
|
|
8
|
-
project: string;
|
|
9
8
|
apiKey?: string;
|
|
10
9
|
timeoutMs: number;
|
|
11
10
|
retries: number;
|
|
@@ -35,14 +34,8 @@ export function parseCliArgs(argv: string[], usage: string): ParsedCliArgs {
|
|
|
35
34
|
}
|
|
36
35
|
|
|
37
36
|
export function loadCliEnv(): CliEnv {
|
|
38
|
-
const baseUrl = process.env.MUNIN_BASE_URL;
|
|
39
|
-
if (!baseUrl) {
|
|
40
|
-
throw new Error("MUNIN_BASE_URL is required");
|
|
41
|
-
}
|
|
42
|
-
|
|
43
37
|
return {
|
|
44
|
-
baseUrl,
|
|
45
|
-
project: process.env.MUNIN_PROJECT ?? "default",
|
|
38
|
+
baseUrl: "https://munin.kalera.dev",
|
|
46
39
|
apiKey: process.env.MUNIN_API_KEY,
|
|
47
40
|
timeoutMs: Number(process.env.MUNIN_TIMEOUT_MS ?? 15000),
|
|
48
41
|
retries: Number(process.env.MUNIN_RETRIES ?? 3),
|
package/src/mcp-server.ts
CHANGED
|
@@ -12,7 +12,6 @@ export async function startMcpServer() {
|
|
|
12
12
|
|
|
13
13
|
const client = new MuninClient({
|
|
14
14
|
baseUrl: env.baseUrl,
|
|
15
|
-
project: env.project,
|
|
16
15
|
apiKey: env.apiKey,
|
|
17
16
|
timeoutMs: env.timeoutMs,
|
|
18
17
|
});
|
|
@@ -20,7 +19,7 @@ export async function startMcpServer() {
|
|
|
20
19
|
const server = new Server(
|
|
21
20
|
{
|
|
22
21
|
name: "munin-mcp-server",
|
|
23
|
-
version: "
|
|
22
|
+
version: "1.0.0",
|
|
24
23
|
},
|
|
25
24
|
{
|
|
26
25
|
capabilities: {
|
|
@@ -34,10 +33,11 @@ export async function startMcpServer() {
|
|
|
34
33
|
tools: [
|
|
35
34
|
{
|
|
36
35
|
name: "munin_store_memory",
|
|
37
|
-
description: "Store or update a memory in Munin.
|
|
36
|
+
description: "Store or update a memory in Munin Context Core. It will automatically use the active project from environment if projectId is omitted. IMPORTANT: Call this as an MCP tool, NOT as a shell command.",
|
|
38
37
|
inputSchema: {
|
|
39
38
|
type: "object",
|
|
40
39
|
properties: {
|
|
40
|
+
projectId: { type: "string", description: "Optional. Only use if cross-saving to a different Context Core ID." },
|
|
41
41
|
key: { type: "string", description: "Unique identifier for this memory" },
|
|
42
42
|
content: { type: "string", description: "The content to remember" },
|
|
43
43
|
title: { type: "string", description: "Optional title" },
|
|
@@ -52,10 +52,11 @@ export async function startMcpServer() {
|
|
|
52
52
|
},
|
|
53
53
|
{
|
|
54
54
|
name: "munin_retrieve_memory",
|
|
55
|
-
description: "Retrieve a memory by its unique key.",
|
|
55
|
+
description: "Retrieve a memory by its unique key from the current Munin Context Core. IMPORTANT: Call this as an MCP tool, NOT as a shell command.",
|
|
56
56
|
inputSchema: {
|
|
57
57
|
type: "object",
|
|
58
58
|
properties: {
|
|
59
|
+
projectId: { type: "string", description: "Optional. The Munin Context Core ID." },
|
|
59
60
|
key: { type: "string", description: "Unique identifier" },
|
|
60
61
|
},
|
|
61
62
|
required: ["key"],
|
|
@@ -63,10 +64,11 @@ export async function startMcpServer() {
|
|
|
63
64
|
},
|
|
64
65
|
{
|
|
65
66
|
name: "munin_search_memories",
|
|
66
|
-
description: "Search for memories using semantic search or keywords.",
|
|
67
|
+
description: "Search for memories using semantic search or keywords. Returns formatted, token-efficient GraphRAG context. IMPORTANT: Call this as an MCP tool, NOT as a shell command.",
|
|
67
68
|
inputSchema: {
|
|
68
69
|
type: "object",
|
|
69
70
|
properties: {
|
|
71
|
+
projectId: { type: "string", description: "Optional. The Munin Context Core ID." },
|
|
70
72
|
query: { type: "string", description: "Search query" },
|
|
71
73
|
tags: { type: "array", items: { type: "string" } },
|
|
72
74
|
limit: { type: "number", description: "Max results (default: 10)" },
|
|
@@ -76,23 +78,27 @@ export async function startMcpServer() {
|
|
|
76
78
|
},
|
|
77
79
|
{
|
|
78
80
|
name: "munin_list_memories",
|
|
79
|
-
description: "List all memories with pagination.",
|
|
81
|
+
description: "List all memories with pagination. IMPORTANT: Call this as an MCP tool, NOT as a shell command.",
|
|
80
82
|
inputSchema: {
|
|
81
83
|
type: "object",
|
|
82
84
|
properties: {
|
|
85
|
+
projectId: { type: "string", description: "Optional. The Munin Context Core ID." },
|
|
83
86
|
limit: { type: "number" },
|
|
84
87
|
offset: { type: "number" },
|
|
85
88
|
},
|
|
89
|
+
required: [],
|
|
86
90
|
},
|
|
87
91
|
},
|
|
88
92
|
{
|
|
89
93
|
name: "munin_recent_memories",
|
|
90
|
-
description: "Get the most recently updated memories.",
|
|
94
|
+
description: "Get the most recently updated memories. IMPORTANT: Call this as an MCP tool, NOT as a shell command.",
|
|
91
95
|
inputSchema: {
|
|
92
96
|
type: "object",
|
|
93
97
|
properties: {
|
|
98
|
+
projectId: { type: "string", description: "Optional. The Munin Context Core ID." },
|
|
94
99
|
limit: { type: "number" },
|
|
95
100
|
},
|
|
101
|
+
required: [],
|
|
96
102
|
},
|
|
97
103
|
},
|
|
98
104
|
],
|
|
@@ -102,23 +108,32 @@ export async function startMcpServer() {
|
|
|
102
108
|
server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
103
109
|
try {
|
|
104
110
|
const args = request.params.arguments || {};
|
|
111
|
+
const projectId = (args.projectId as string) || process.env.MUNIN_PROJECT;
|
|
112
|
+
|
|
113
|
+
if (!projectId) {
|
|
114
|
+
throw new Error("projectId is required in arguments or MUNIN_PROJECT environment variable");
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
// Remove projectId from args before sending as payload
|
|
118
|
+
const { projectId: _ignored, ...payload } = args;
|
|
119
|
+
|
|
105
120
|
let result;
|
|
106
121
|
|
|
107
122
|
switch (request.params.name) {
|
|
108
123
|
case "munin_store_memory":
|
|
109
|
-
result = await client.store(
|
|
124
|
+
result = await client.store(projectId, payload);
|
|
110
125
|
break;
|
|
111
126
|
case "munin_retrieve_memory":
|
|
112
|
-
result = await client.retrieve(
|
|
127
|
+
result = await client.retrieve(projectId, payload);
|
|
113
128
|
break;
|
|
114
129
|
case "munin_search_memories":
|
|
115
|
-
result = await client.search(
|
|
130
|
+
result = await client.search(projectId, payload);
|
|
116
131
|
break;
|
|
117
132
|
case "munin_list_memories":
|
|
118
|
-
result = await client.list(
|
|
133
|
+
result = await client.list(projectId, payload);
|
|
119
134
|
break;
|
|
120
135
|
case "munin_recent_memories":
|
|
121
|
-
result = await client.recent(
|
|
136
|
+
result = await client.recent(projectId, payload);
|
|
122
137
|
break;
|
|
123
138
|
default:
|
|
124
139
|
throw new Error(`Unknown tool: ${request.params.name}`);
|