@heimdall-ai/heimdall 0.1.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/LICENSE +190 -0
- package/README.md +471 -0
- package/dist/config/constants.d.ts +24 -0
- package/dist/config/constants.d.ts.map +1 -0
- package/dist/config/constants.js +70 -0
- package/dist/config/constants.js.map +1 -0
- package/dist/core/bash-manager.d.ts +56 -0
- package/dist/core/bash-manager.d.ts.map +1 -0
- package/dist/core/bash-manager.js +106 -0
- package/dist/core/bash-manager.js.map +1 -0
- package/dist/core/pyodide-manager.d.ts +125 -0
- package/dist/core/pyodide-manager.d.ts.map +1 -0
- package/dist/core/pyodide-manager.js +669 -0
- package/dist/core/pyodide-manager.js.map +1 -0
- package/dist/core/pyodide-worker.d.ts +9 -0
- package/dist/core/pyodide-worker.d.ts.map +1 -0
- package/dist/core/pyodide-worker.js +295 -0
- package/dist/core/pyodide-worker.js.map +1 -0
- package/dist/core/secure-fs.d.ts +101 -0
- package/dist/core/secure-fs.d.ts.map +1 -0
- package/dist/core/secure-fs.js +279 -0
- package/dist/core/secure-fs.js.map +1 -0
- package/dist/integration.test.d.ts +10 -0
- package/dist/integration.test.d.ts.map +1 -0
- package/dist/integration.test.js +439 -0
- package/dist/integration.test.js.map +1 -0
- package/dist/resources/index.d.ts +12 -0
- package/dist/resources/index.d.ts.map +1 -0
- package/dist/resources/index.js +13 -0
- package/dist/resources/index.js.map +1 -0
- package/dist/resources/workspace.d.ts +12 -0
- package/dist/resources/workspace.d.ts.map +1 -0
- package/dist/resources/workspace.js +105 -0
- package/dist/resources/workspace.js.map +1 -0
- package/dist/server.d.ts +17 -0
- package/dist/server.d.ts.map +1 -0
- package/dist/server.js +51 -0
- package/dist/server.js.map +1 -0
- package/dist/tools/bash-execution.d.ts +13 -0
- package/dist/tools/bash-execution.d.ts.map +1 -0
- package/dist/tools/bash-execution.js +135 -0
- package/dist/tools/bash-execution.js.map +1 -0
- package/dist/tools/filesystem.d.ts +12 -0
- package/dist/tools/filesystem.d.ts.map +1 -0
- package/dist/tools/filesystem.js +104 -0
- package/dist/tools/filesystem.js.map +1 -0
- package/dist/tools/index.d.ts +13 -0
- package/dist/tools/index.d.ts.map +1 -0
- package/dist/tools/index.js +17 -0
- package/dist/tools/index.js.map +1 -0
- package/dist/tools/python-execution.d.ts +12 -0
- package/dist/tools/python-execution.d.ts.map +1 -0
- package/dist/tools/python-execution.js +77 -0
- package/dist/tools/python-execution.js.map +1 -0
- package/dist/types/index.d.ts +64 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +2 -0
- package/dist/types/index.js.map +1 -0
- package/dist/utils/async-lock.d.ts +35 -0
- package/dist/utils/async-lock.d.ts.map +1 -0
- package/dist/utils/async-lock.js +57 -0
- package/dist/utils/async-lock.js.map +1 -0
- package/dist/utils/index.d.ts +5 -0
- package/dist/utils/index.d.ts.map +1 -0
- package/dist/utils/index.js +5 -0
- package/dist/utils/index.js.map +1 -0
- package/package.json +61 -0
|
@@ -0,0 +1,439 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MCP Integration Tests for Heimdall Server
|
|
3
|
+
*
|
|
4
|
+
* These tests spin up the MCP server and connect with a client
|
|
5
|
+
* to verify all functionality works end-to-end.
|
|
6
|
+
*
|
|
7
|
+
* Run with: npm test
|
|
8
|
+
*/
|
|
9
|
+
import { Client } from "@modelcontextprotocol/sdk/client/index.js";
|
|
10
|
+
import { StdioClientTransport } from "@modelcontextprotocol/sdk/client/stdio.js";
|
|
11
|
+
import * as path from "path";
|
|
12
|
+
import * as fs from "fs";
|
|
13
|
+
import { fileURLToPath } from "url";
|
|
14
|
+
import assert from "assert";
|
|
15
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
16
|
+
const __dirname = path.dirname(__filename);
|
|
17
|
+
// Test workspace - use a temp directory to avoid conflicts
|
|
18
|
+
const TEST_WORKSPACE = path.join(__dirname, "..", "test-workspace");
|
|
19
|
+
// Colors for test output
|
|
20
|
+
const colors = {
|
|
21
|
+
green: "\x1b[32m",
|
|
22
|
+
red: "\x1b[31m",
|
|
23
|
+
yellow: "\x1b[33m",
|
|
24
|
+
blue: "\x1b[34m",
|
|
25
|
+
reset: "\x1b[0m",
|
|
26
|
+
bold: "\x1b[1m",
|
|
27
|
+
};
|
|
28
|
+
function log(message, color = colors.reset) {
|
|
29
|
+
console.log(`${color}${message}${colors.reset}`);
|
|
30
|
+
}
|
|
31
|
+
function logTest(name, passed, details) {
|
|
32
|
+
const icon = passed ? "β" : "β";
|
|
33
|
+
const color = passed ? colors.green : colors.red;
|
|
34
|
+
console.log(` ${color}${icon} ${name}${colors.reset}`);
|
|
35
|
+
if (details && !passed) {
|
|
36
|
+
console.log(` ${colors.yellow}${details}${colors.reset}`);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
class McpTestRunner {
|
|
40
|
+
client = null;
|
|
41
|
+
transport = null;
|
|
42
|
+
results = [];
|
|
43
|
+
/**
|
|
44
|
+
* Start the MCP server and connect client
|
|
45
|
+
*/
|
|
46
|
+
async setup() {
|
|
47
|
+
log("\nπ Starting MCP server...", colors.blue);
|
|
48
|
+
// Clean up test workspace
|
|
49
|
+
if (fs.existsSync(TEST_WORKSPACE)) {
|
|
50
|
+
fs.rmSync(TEST_WORKSPACE, { recursive: true });
|
|
51
|
+
}
|
|
52
|
+
fs.mkdirSync(TEST_WORKSPACE, { recursive: true });
|
|
53
|
+
// Spawn the server process
|
|
54
|
+
const serverPath = path.join(__dirname, "server.ts");
|
|
55
|
+
this.transport = new StdioClientTransport({
|
|
56
|
+
command: "npx",
|
|
57
|
+
args: ["tsx", serverPath],
|
|
58
|
+
env: {
|
|
59
|
+
...process.env,
|
|
60
|
+
HEIMDALL_WORKSPACE: TEST_WORKSPACE,
|
|
61
|
+
},
|
|
62
|
+
cwd: path.join(__dirname, ".."),
|
|
63
|
+
});
|
|
64
|
+
this.client = new Client({ name: "test-client", version: "1.0.0" }, { capabilities: {} });
|
|
65
|
+
await this.client.connect(this.transport);
|
|
66
|
+
log("β MCP client connected\n", colors.green);
|
|
67
|
+
// Wait a bit for Pyodide to initialize
|
|
68
|
+
log("β³ Waiting for Pyodide initialization...", colors.yellow);
|
|
69
|
+
await this.sleep(3000);
|
|
70
|
+
log("β Ready to run tests\n", colors.green);
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Disconnect client and cleanup
|
|
74
|
+
*/
|
|
75
|
+
async teardown() {
|
|
76
|
+
log("\nπ§Ή Cleaning up...", colors.blue);
|
|
77
|
+
if (this.client) {
|
|
78
|
+
await this.client.close();
|
|
79
|
+
}
|
|
80
|
+
if (this.transport) {
|
|
81
|
+
await this.transport.close();
|
|
82
|
+
}
|
|
83
|
+
// Clean up test workspace
|
|
84
|
+
if (fs.existsSync(TEST_WORKSPACE)) {
|
|
85
|
+
fs.rmSync(TEST_WORKSPACE, { recursive: true });
|
|
86
|
+
}
|
|
87
|
+
log("β Cleanup complete", colors.green);
|
|
88
|
+
}
|
|
89
|
+
sleep(ms) {
|
|
90
|
+
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Call an MCP tool
|
|
94
|
+
*/
|
|
95
|
+
async callTool(name, args) {
|
|
96
|
+
if (!this.client)
|
|
97
|
+
throw new Error("Client not connected");
|
|
98
|
+
const result = await this.client.callTool({ name, arguments: args });
|
|
99
|
+
return result;
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* Run a single test
|
|
103
|
+
*/
|
|
104
|
+
async runTest(name, testFn) {
|
|
105
|
+
const start = Date.now();
|
|
106
|
+
try {
|
|
107
|
+
await testFn();
|
|
108
|
+
const duration = Date.now() - start;
|
|
109
|
+
logTest(name, true);
|
|
110
|
+
return { name, passed: true, duration };
|
|
111
|
+
}
|
|
112
|
+
catch (e) {
|
|
113
|
+
const duration = Date.now() - start;
|
|
114
|
+
const error = e instanceof Error ? e.message : String(e);
|
|
115
|
+
logTest(name, false, error);
|
|
116
|
+
return { name, passed: false, error, duration };
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* Run all tests
|
|
121
|
+
*/
|
|
122
|
+
async runAllTests() {
|
|
123
|
+
log(`${colors.bold}Running Integration Tests${colors.reset}\n`, colors.blue);
|
|
124
|
+
// Test 1: Basic Python Execution
|
|
125
|
+
this.results.push(await this.runTest("Basic Python execution", async () => {
|
|
126
|
+
const result = (await this.callTool("execute_python", {
|
|
127
|
+
code: `
|
|
128
|
+
import sys
|
|
129
|
+
print(f"Python version: {sys.version_info.major}.{sys.version_info.minor}")
|
|
130
|
+
print("Hello from Pyodide!")
|
|
131
|
+
`,
|
|
132
|
+
}));
|
|
133
|
+
const output = result.content[0].text;
|
|
134
|
+
assert(output.includes("Python version: 3.12"), "Should show Python version");
|
|
135
|
+
assert(output.includes("Hello from Pyodide!"), "Should print hello message");
|
|
136
|
+
}));
|
|
137
|
+
// Test 2: Math operations
|
|
138
|
+
this.results.push(await this.runTest("Math operations", async () => {
|
|
139
|
+
const result = (await this.callTool("execute_python", {
|
|
140
|
+
code: `
|
|
141
|
+
import math
|
|
142
|
+
print(f"Pi: {math.pi}")
|
|
143
|
+
print(f"factorial(5): {math.factorial(5)}")
|
|
144
|
+
`,
|
|
145
|
+
}));
|
|
146
|
+
const output = result.content[0].text;
|
|
147
|
+
assert(output.includes("Pi: 3.14159"), "Should calculate pi");
|
|
148
|
+
assert(output.includes("factorial(5): 120"), "Should calculate factorial");
|
|
149
|
+
}));
|
|
150
|
+
// Test 3: Write file
|
|
151
|
+
this.results.push(await this.runTest("Write file", async () => {
|
|
152
|
+
const result = (await this.callTool("write_file", {
|
|
153
|
+
path: "test_module.py",
|
|
154
|
+
content: `
|
|
155
|
+
def add(a, b):
|
|
156
|
+
return a + b
|
|
157
|
+
|
|
158
|
+
def multiply(a, b):
|
|
159
|
+
return a * b
|
|
160
|
+
|
|
161
|
+
MESSAGE = "Hello from test module!"
|
|
162
|
+
`,
|
|
163
|
+
}));
|
|
164
|
+
const output = result.content[0].text;
|
|
165
|
+
assert(output.includes("β"), "Should succeed writing file");
|
|
166
|
+
}));
|
|
167
|
+
// Test 4: Read file
|
|
168
|
+
this.results.push(await this.runTest("Read file", async () => {
|
|
169
|
+
const result = (await this.callTool("read_file", {
|
|
170
|
+
path: "test_module.py",
|
|
171
|
+
}));
|
|
172
|
+
const output = result.content[0].text;
|
|
173
|
+
assert(output.includes("def add(a, b)"), "Should contain add function");
|
|
174
|
+
assert(output.includes("MESSAGE"), "Should contain MESSAGE constant");
|
|
175
|
+
}));
|
|
176
|
+
// Test 5: List files
|
|
177
|
+
this.results.push(await this.runTest("List files", async () => {
|
|
178
|
+
const result = (await this.callTool("list_files", {
|
|
179
|
+
path: "",
|
|
180
|
+
}));
|
|
181
|
+
const output = result.content[0].text;
|
|
182
|
+
assert(output.includes("test_module.py"), "Should list test_module.py");
|
|
183
|
+
}));
|
|
184
|
+
// Test 6: Import custom module (tests sys.path fix)
|
|
185
|
+
this.results.push(await this.runTest("Import custom module", async () => {
|
|
186
|
+
const result = (await this.callTool("execute_python", {
|
|
187
|
+
code: `
|
|
188
|
+
import test_module
|
|
189
|
+
print(test_module.MESSAGE)
|
|
190
|
+
print(f"add(2, 3) = {test_module.add(2, 3)}")
|
|
191
|
+
print(f"multiply(4, 5) = {test_module.multiply(4, 5)}")
|
|
192
|
+
`,
|
|
193
|
+
}));
|
|
194
|
+
const output = result.content[0].text;
|
|
195
|
+
assert(output.includes("Hello from test module!"), "Should import MESSAGE");
|
|
196
|
+
assert(output.includes("add(2, 3) = 5"), "Should call add function");
|
|
197
|
+
assert(output.includes("multiply(4, 5) = 20"), "Should call multiply function");
|
|
198
|
+
}));
|
|
199
|
+
// Test 7: Create nested directory structure
|
|
200
|
+
this.results.push(await this.runTest("Create nested directories", async () => {
|
|
201
|
+
await this.callTool("write_file", {
|
|
202
|
+
path: "data/config/settings.json",
|
|
203
|
+
content: JSON.stringify({ debug: true, version: "1.0.0" }, null, 2),
|
|
204
|
+
});
|
|
205
|
+
const listResult = (await this.callTool("list_files", {
|
|
206
|
+
path: "data",
|
|
207
|
+
}));
|
|
208
|
+
const output = listResult.content[0].text;
|
|
209
|
+
assert(output.includes("config"), "Should have config directory");
|
|
210
|
+
}));
|
|
211
|
+
// Test 8: File I/O from Python
|
|
212
|
+
this.results.push(await this.runTest("File I/O from Python", async () => {
|
|
213
|
+
const result = (await this.callTool("execute_python", {
|
|
214
|
+
code: `
|
|
215
|
+
import json
|
|
216
|
+
|
|
217
|
+
# Read the config file we created
|
|
218
|
+
with open('data/config/settings.json') as f:
|
|
219
|
+
config = json.load(f)
|
|
220
|
+
|
|
221
|
+
print(f"Debug: {config['debug']}")
|
|
222
|
+
print(f"Version: {config['version']}")
|
|
223
|
+
|
|
224
|
+
# Write a new file
|
|
225
|
+
with open('output.txt', 'w') as f:
|
|
226
|
+
f.write("Generated from Python!\\n")
|
|
227
|
+
f.write(f"Config version: {config['version']}")
|
|
228
|
+
|
|
229
|
+
print("File written successfully!")
|
|
230
|
+
`,
|
|
231
|
+
}));
|
|
232
|
+
const output = result.content[0].text;
|
|
233
|
+
assert(output.includes("Debug: True"), "Should read debug setting");
|
|
234
|
+
assert(output.includes("Version: 1.0.0"), "Should read version");
|
|
235
|
+
assert(output.includes("File written successfully"), "Should write file");
|
|
236
|
+
}));
|
|
237
|
+
// Test 9: Verify Python-written file via MCP
|
|
238
|
+
this.results.push(await this.runTest("Verify Python-written file", async () => {
|
|
239
|
+
const result = (await this.callTool("read_file", {
|
|
240
|
+
path: "output.txt",
|
|
241
|
+
}));
|
|
242
|
+
const output = result.content[0].text;
|
|
243
|
+
assert(output.includes("Generated from Python!"), "Should contain generated content");
|
|
244
|
+
assert(output.includes("Config version: 1.0.0"), "Should contain config version");
|
|
245
|
+
}));
|
|
246
|
+
// Test 10: Install and use package (numpy)
|
|
247
|
+
this.results.push(await this.runTest("Install and use NumPy", async () => {
|
|
248
|
+
// Install numpy
|
|
249
|
+
const installResult = (await this.callTool("install_packages", {
|
|
250
|
+
packages: ["numpy"],
|
|
251
|
+
}));
|
|
252
|
+
const installOutput = installResult.content[0].text;
|
|
253
|
+
assert(installOutput.includes("numpy: β installed"), "Should install numpy");
|
|
254
|
+
// Use numpy
|
|
255
|
+
const execResult = (await this.callTool("execute_python", {
|
|
256
|
+
code: `
|
|
257
|
+
import numpy as np
|
|
258
|
+
arr = np.array([1, 2, 3, 4, 5])
|
|
259
|
+
print(f"Array: {arr}")
|
|
260
|
+
print(f"Mean: {np.mean(arr)}")
|
|
261
|
+
print(f"Sum: {np.sum(arr)}")
|
|
262
|
+
print(f"Std: {np.std(arr):.2f}")
|
|
263
|
+
`,
|
|
264
|
+
}));
|
|
265
|
+
const output = execResult.content[0].text;
|
|
266
|
+
assert(output.includes("Mean: 3.0"), "Should calculate mean");
|
|
267
|
+
assert(output.includes("Sum: 15"), "Should calculate sum");
|
|
268
|
+
}));
|
|
269
|
+
// Test 11: Install and use pandas
|
|
270
|
+
this.results.push(await this.runTest("Install and use Pandas", async () => {
|
|
271
|
+
const installResult = (await this.callTool("install_packages", {
|
|
272
|
+
packages: ["pandas"],
|
|
273
|
+
}));
|
|
274
|
+
const installOutput = installResult.content[0].text;
|
|
275
|
+
assert(installOutput.includes("pandas"), "Should show pandas in output");
|
|
276
|
+
const execResult = (await this.callTool("execute_python", {
|
|
277
|
+
code: `
|
|
278
|
+
import pandas as pd
|
|
279
|
+
data = {'name': ['Alice', 'Bob'], 'score': [85, 92]}
|
|
280
|
+
df = pd.DataFrame(data)
|
|
281
|
+
print(f"Names: {list(df['name'])}")
|
|
282
|
+
print(f"Mean: {df['score'].mean()}")
|
|
283
|
+
`,
|
|
284
|
+
}));
|
|
285
|
+
const output = execResult.content[0].text;
|
|
286
|
+
assert(output.includes("Alice"), "Should have Alice in output");
|
|
287
|
+
assert(output.includes("Mean:") && output.includes("88"), "Should calculate mean");
|
|
288
|
+
}));
|
|
289
|
+
// Test 12: Error handling
|
|
290
|
+
this.results.push(await this.runTest("Error handling", async () => {
|
|
291
|
+
const result = (await this.callTool("execute_python", {
|
|
292
|
+
code: `
|
|
293
|
+
x = 1 / 0 # This will raise ZeroDivisionError
|
|
294
|
+
`,
|
|
295
|
+
}));
|
|
296
|
+
const output = result.content[0].text;
|
|
297
|
+
assert(output.includes("ZeroDivisionError"), "Should catch division error");
|
|
298
|
+
}));
|
|
299
|
+
// Test 13: Delete file
|
|
300
|
+
this.results.push(await this.runTest("Delete file", async () => {
|
|
301
|
+
// Create a file specifically for this test
|
|
302
|
+
await this.callTool("write_file", {
|
|
303
|
+
path: "to_delete.txt",
|
|
304
|
+
content: "This file will be deleted",
|
|
305
|
+
});
|
|
306
|
+
// Verify file exists
|
|
307
|
+
const beforeList = (await this.callTool("list_files", {
|
|
308
|
+
path: "",
|
|
309
|
+
}));
|
|
310
|
+
assert(beforeList.content[0].text.includes("to_delete.txt"), "File should exist before delete");
|
|
311
|
+
// Delete file
|
|
312
|
+
const deleteResult = (await this.callTool("delete_file", {
|
|
313
|
+
path: "to_delete.txt",
|
|
314
|
+
}));
|
|
315
|
+
assert(deleteResult.content[0].text.includes("β"), "Should delete successfully");
|
|
316
|
+
// Small delay to ensure sync completes
|
|
317
|
+
await this.sleep(100);
|
|
318
|
+
// Verify file is gone
|
|
319
|
+
const afterList = (await this.callTool("list_files", {
|
|
320
|
+
path: "",
|
|
321
|
+
}));
|
|
322
|
+
assert(!afterList.content[0].text.includes("to_delete.txt"), "File should be deleted");
|
|
323
|
+
}));
|
|
324
|
+
// Test 14: Read resources
|
|
325
|
+
this.results.push(await this.runTest("Read heimdall info resource", async () => {
|
|
326
|
+
const resources = await this.client.listResources();
|
|
327
|
+
const infoResource = resources.resources.find((r) => r.uri === "heimdall://info");
|
|
328
|
+
assert(infoResource, "Should have heimdall://info resource");
|
|
329
|
+
const content = await this.client.readResource({ uri: "heimdall://info" });
|
|
330
|
+
const text = content.contents[0];
|
|
331
|
+
assert("text" in text && text.text.includes("Heimdall"), "Should contain Heimdall info");
|
|
332
|
+
}));
|
|
333
|
+
// Test 15: List workspace resource
|
|
334
|
+
this.results.push(await this.runTest("Read workspace files resource", async () => {
|
|
335
|
+
const content = await this.client.readResource({ uri: "workspace://files" });
|
|
336
|
+
const text = content.contents[0];
|
|
337
|
+
assert("text" in text && text.text.includes("test_module.py"), "Should list test_module.py");
|
|
338
|
+
}));
|
|
339
|
+
// Test 16: Network is always blocked (WASM security boundary)
|
|
340
|
+
this.results.push(await this.runTest("Network requests always fail", async () => {
|
|
341
|
+
const result = (await this.callTool("execute_python", {
|
|
342
|
+
code: `
|
|
343
|
+
import urllib.request
|
|
344
|
+
|
|
345
|
+
try:
|
|
346
|
+
# This should fail - Pyodide in WASM cannot make network requests
|
|
347
|
+
response = urllib.request.urlopen("https://example.com", timeout=5)
|
|
348
|
+
print(f"UNEXPECTED: Network request succeeded with status {response.status}")
|
|
349
|
+
except Exception as e:
|
|
350
|
+
# Expected: network access fails in WASM sandbox
|
|
351
|
+
print(f"EXPECTED: Network blocked - {type(e).__name__}: {str(e)[:100]}")
|
|
352
|
+
`,
|
|
353
|
+
}));
|
|
354
|
+
const output = result.content[0].text;
|
|
355
|
+
// The request should fail with some error (URLError, OSError, etc.)
|
|
356
|
+
// It should NOT succeed
|
|
357
|
+
assert(output.includes("EXPECTED: Network blocked") || output.includes("Error"), "Network requests should fail in WASM sandbox");
|
|
358
|
+
assert(!output.includes("UNEXPECTED"), "Network request should not succeed");
|
|
359
|
+
}));
|
|
360
|
+
// Test 17: Concurrent tool calls (regression test for race condition)
|
|
361
|
+
this.results.push(await this.runTest("Concurrent tool calls with micropip", async () => {
|
|
362
|
+
// Fire multiple concurrent requests that all use micropip
|
|
363
|
+
const promises = [
|
|
364
|
+
this.callTool("execute_python", {
|
|
365
|
+
code: `import micropip; print("Call 1: micropip available")`,
|
|
366
|
+
}),
|
|
367
|
+
this.callTool("execute_python", {
|
|
368
|
+
code: `import micropip; print("Call 2: micropip available")`,
|
|
369
|
+
}),
|
|
370
|
+
this.callTool("execute_python", {
|
|
371
|
+
code: `import micropip; print("Call 3: micropip available")`,
|
|
372
|
+
}),
|
|
373
|
+
];
|
|
374
|
+
const results = (await Promise.all(promises));
|
|
375
|
+
// All three should succeed - no "No module named 'micropip'" errors
|
|
376
|
+
for (let i = 0; i < results.length; i++) {
|
|
377
|
+
const output = results[i].content[0].text;
|
|
378
|
+
// Check that it contains the expected output OR executed successfully
|
|
379
|
+
const hasExpectedOutput = output.includes(`Call ${i + 1}: micropip available`);
|
|
380
|
+
const executedSuccessfully = output.includes("micropip available") || output.includes("successfully");
|
|
381
|
+
const hasMicropipError = output.includes("No module named 'micropip'");
|
|
382
|
+
assert(!hasMicropipError, `Concurrent call ${i + 1} failed with micropip error: ${output}`);
|
|
383
|
+
assert(hasExpectedOutput || executedSuccessfully || !output.includes("Error"), `Concurrent call ${i + 1} should succeed. Got: ${output.substring(0, 200)}`);
|
|
384
|
+
}
|
|
385
|
+
}));
|
|
386
|
+
// Print summary
|
|
387
|
+
this.printSummary();
|
|
388
|
+
}
|
|
389
|
+
/**
|
|
390
|
+
* Print test summary
|
|
391
|
+
*/
|
|
392
|
+
printSummary() {
|
|
393
|
+
const passed = this.results.filter((r) => r.passed).length;
|
|
394
|
+
const failed = this.results.filter((r) => !r.passed).length;
|
|
395
|
+
const total = this.results.length;
|
|
396
|
+
const totalTime = this.results.reduce((sum, r) => sum + r.duration, 0);
|
|
397
|
+
log("\n" + "=".repeat(50), colors.blue);
|
|
398
|
+
log(`${colors.bold}Test Summary${colors.reset}`, colors.blue);
|
|
399
|
+
log("=".repeat(50), colors.blue);
|
|
400
|
+
log(`\nTotal: ${total} tests`, colors.reset);
|
|
401
|
+
log(`Passed: ${passed}`, colors.green);
|
|
402
|
+
if (failed > 0) {
|
|
403
|
+
log(`Failed: ${failed}`, colors.red);
|
|
404
|
+
log("\nFailed tests:", colors.red);
|
|
405
|
+
this.results
|
|
406
|
+
.filter((r) => !r.passed)
|
|
407
|
+
.forEach((r) => {
|
|
408
|
+
log(` - ${r.name}: ${r.error}`, colors.red);
|
|
409
|
+
});
|
|
410
|
+
}
|
|
411
|
+
log(`\nTotal time: ${(totalTime / 1000).toFixed(2)}s`, colors.yellow);
|
|
412
|
+
if (failed === 0) {
|
|
413
|
+
log("\nπ All tests passed!", colors.green);
|
|
414
|
+
}
|
|
415
|
+
else {
|
|
416
|
+
log(`\nβ ${failed} test(s) failed`, colors.red);
|
|
417
|
+
}
|
|
418
|
+
}
|
|
419
|
+
}
|
|
420
|
+
// Main entry point
|
|
421
|
+
async function main() {
|
|
422
|
+
const runner = new McpTestRunner();
|
|
423
|
+
try {
|
|
424
|
+
await runner.setup();
|
|
425
|
+
await runner.runAllTests();
|
|
426
|
+
}
|
|
427
|
+
catch (e) {
|
|
428
|
+
log(`\nβ Fatal error: ${e}`, colors.red);
|
|
429
|
+
process.exit(1);
|
|
430
|
+
}
|
|
431
|
+
finally {
|
|
432
|
+
await runner.teardown();
|
|
433
|
+
}
|
|
434
|
+
// Exit with appropriate code
|
|
435
|
+
const failed = runner["results"].filter((r) => !r.passed).length;
|
|
436
|
+
process.exit(failed > 0 ? 1 : 0);
|
|
437
|
+
}
|
|
438
|
+
void main();
|
|
439
|
+
//# sourceMappingURL=integration.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"integration.test.js","sourceRoot":"","sources":["../src/integration.test.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,2CAA2C,CAAC;AACnE,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AACjF,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAC7B,OAAO,KAAK,EAAE,MAAM,IAAI,CAAC;AACzB,OAAO,EAAE,aAAa,EAAE,MAAM,KAAK,CAAC;AACpC,OAAO,MAAM,MAAM,QAAQ,CAAC;AAE5B,MAAM,UAAU,GAAG,aAAa,CAAC,MAAM,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protocol/sdk/server/mcp.js";
|
|
7
|
+
import type { PyodideManager } from "../core/pyodide-manager.js";
|
|
8
|
+
/**
|
|
9
|
+
* Register all resources with the MCP server
|
|
10
|
+
*/
|
|
11
|
+
export declare function registerAllResources(server: McpServer, pyodideManager: PyodideManager): void;
|
|
12
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/resources/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACzE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAGjE;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,SAAS,EAAE,cAAc,EAAE,cAAc,GAAG,IAAI,CAE5F"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Resources Registration
|
|
3
|
+
*
|
|
4
|
+
* Central module for registering all MCP resources
|
|
5
|
+
*/
|
|
6
|
+
import { registerWorkspaceResources } from "./workspace.js";
|
|
7
|
+
/**
|
|
8
|
+
* Register all resources with the MCP server
|
|
9
|
+
*/
|
|
10
|
+
export function registerAllResources(server, pyodideManager) {
|
|
11
|
+
registerWorkspaceResources(server, pyodideManager);
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/resources/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH,OAAO,EAAE,0BAA0B,EAAE,MAAM,gBAAgB,CAAC;AAE5D;;GAEG;AACH,MAAM,UAAU,oBAAoB,CAAC,MAAiB,EAAE,cAA8B;IACpF,0BAA0B,CAAC,MAAM,EAAE,cAAc,CAAC,CAAC;AACrD,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Workspace Resources
|
|
3
|
+
*
|
|
4
|
+
* MCP resources for accessing workspace information and Heimdall environment details
|
|
5
|
+
*/
|
|
6
|
+
import type { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
7
|
+
import type { PyodideManager } from "../core/pyodide-manager.js";
|
|
8
|
+
/**
|
|
9
|
+
* Register workspace resources with the MCP server
|
|
10
|
+
*/
|
|
11
|
+
export declare function registerWorkspaceResources(server: McpServer, pyodideManager: PyodideManager): void;
|
|
12
|
+
//# sourceMappingURL=workspace.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"workspace.d.ts","sourceRoot":"","sources":["../../src/resources/workspace.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACzE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAGjE;;GAEG;AACH,wBAAgB,0BAA0B,CAAC,MAAM,EAAE,SAAS,EAAE,cAAc,EAAE,cAAc,QAgH3F"}
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Workspace Resources
|
|
3
|
+
*
|
|
4
|
+
* MCP resources for accessing workspace information and Heimdall environment details
|
|
5
|
+
*/
|
|
6
|
+
import { ResourceTemplate } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
7
|
+
import { WORKSPACE_DIR, VIRTUAL_WORKSPACE } from "../config/constants.js";
|
|
8
|
+
/**
|
|
9
|
+
* Register workspace resources with the MCP server
|
|
10
|
+
*/
|
|
11
|
+
export function registerWorkspaceResources(server, pyodideManager) {
|
|
12
|
+
// Workspace files list
|
|
13
|
+
server.registerResource("workspace-files", "workspace://files", {
|
|
14
|
+
title: "Workspace Files",
|
|
15
|
+
description: "List all files in the Heimdall workspace",
|
|
16
|
+
mimeType: "text/plain",
|
|
17
|
+
}, async () => {
|
|
18
|
+
const result = await pyodideManager.listFiles("");
|
|
19
|
+
let text;
|
|
20
|
+
if (!result.success) {
|
|
21
|
+
text = `Error: ${result.error}`;
|
|
22
|
+
}
|
|
23
|
+
else if (result.files.length === 0) {
|
|
24
|
+
text = "Workspace is empty";
|
|
25
|
+
}
|
|
26
|
+
else {
|
|
27
|
+
text =
|
|
28
|
+
"# Workspace Files\n\n" +
|
|
29
|
+
result.files
|
|
30
|
+
.map((f) => {
|
|
31
|
+
const icon = f.isDirectory ? "π" : "π";
|
|
32
|
+
const size = f.isDirectory ? "" : ` (${f.size} bytes)`;
|
|
33
|
+
return `- ${icon} ${f.name}${size}`;
|
|
34
|
+
})
|
|
35
|
+
.join("\n");
|
|
36
|
+
}
|
|
37
|
+
return {
|
|
38
|
+
contents: [{ uri: "workspace://files", text }],
|
|
39
|
+
};
|
|
40
|
+
});
|
|
41
|
+
// Individual workspace file
|
|
42
|
+
server.registerResource("workspace-file", new ResourceTemplate("workspace://file/{path}", { list: undefined }), {
|
|
43
|
+
title: "Workspace File Content",
|
|
44
|
+
description: "Read a specific file from the workspace",
|
|
45
|
+
}, async (uri, { path: filePath }) => {
|
|
46
|
+
const result = await pyodideManager.readFile(filePath);
|
|
47
|
+
return {
|
|
48
|
+
contents: [
|
|
49
|
+
{
|
|
50
|
+
uri: uri.href,
|
|
51
|
+
text: result.success ? result.content : `Error: ${result.error}`,
|
|
52
|
+
mimeType: "text/plain",
|
|
53
|
+
},
|
|
54
|
+
],
|
|
55
|
+
};
|
|
56
|
+
});
|
|
57
|
+
// Heimdall environment information
|
|
58
|
+
server.registerResource("heimdall-info", "heimdall://info", {
|
|
59
|
+
title: "Heimdall Information",
|
|
60
|
+
description: "Information about the Heimdall execution environment",
|
|
61
|
+
mimeType: "text/markdown",
|
|
62
|
+
}, async () => {
|
|
63
|
+
const info = `# Heimdall Execution Environment
|
|
64
|
+
|
|
65
|
+
## Workspace
|
|
66
|
+
- **Host path:** ${WORKSPACE_DIR}
|
|
67
|
+
- **Virtual path:** ${VIRTUAL_WORKSPACE}
|
|
68
|
+
|
|
69
|
+
## Capabilities
|
|
70
|
+
- β
Python code execution (WebAssembly sandbox)
|
|
71
|
+
- β
File system operations (read, write, list, delete)
|
|
72
|
+
- β
Package installation via micropip
|
|
73
|
+
|
|
74
|
+
## Standard Library
|
|
75
|
+
Most Python standard library modules are available:
|
|
76
|
+
- os, sys, io, pathlib
|
|
77
|
+
- json, csv, re
|
|
78
|
+
- math, random, statistics
|
|
79
|
+
- datetime, time
|
|
80
|
+
- collections, itertools, functools
|
|
81
|
+
- urllib, http (limited networking)
|
|
82
|
+
|
|
83
|
+
## Popular Packages Available
|
|
84
|
+
Install via \`install_packages\` tool:
|
|
85
|
+
- **Data Science:** numpy, pandas, scipy, scikit-learn
|
|
86
|
+
- **Visualization:** matplotlib, seaborn, plotly
|
|
87
|
+
- **Web/HTTP:** requests, beautifulsoup4, lxml
|
|
88
|
+
- **Text:** regex, nltk
|
|
89
|
+
- **Math:** sympy, statsmodels
|
|
90
|
+
- **Image:** pillow
|
|
91
|
+
|
|
92
|
+
## Limitations
|
|
93
|
+
- β No native C extensions (unless compiled to WASM)
|
|
94
|
+
- β Limited networking (no raw sockets)
|
|
95
|
+
- β No multiprocessing/threading
|
|
96
|
+
- β Memory limited by Node.js heap
|
|
97
|
+
|
|
98
|
+
See [Pyodide Packages](https://pyodide.org/en/stable/usage/packages-in-pyodide.html) for full list.
|
|
99
|
+
`;
|
|
100
|
+
return {
|
|
101
|
+
contents: [{ uri: "heimdall://info", text: info }],
|
|
102
|
+
};
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
//# sourceMappingURL=workspace.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"workspace.js","sourceRoot":"","sources":["../../src/resources/workspace.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,gBAAgB,EAAE,MAAM,yCAAyC,CAAC;AAG3E,OAAO,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,wBAAw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gBAAgB,CAAC,yBAAyB,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC,EACpE;QACE,KAAK,EAAE,wBAAwB;QAC/B,WAAW,EAAE,yCAAyC;KACvD,EACD,KAAK,EAAE,GAAG,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,EAAE,EAAE;QAChC,MAAM,MAAM,GAAG,MAAM,cAAc,CAAC,QAAQ,CAAC,QAAkB,CAAC,CAAC;QAEjE,OAAO;YACL,QAAQ,EAAE;gBACR;oBACE,GAAG,EAAE,GAAG,CAAC,IAAI;oBACb,IAAI,EAAE,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,OAAQ,CAAC,CAAC,CAAC,UAAU,MAAM,CAAC,KAAK,EAAE;oBACjE,QAAQ,EAAE,YAAY;iBACvB;aACF;SACF,CAAC;IACJ,CAAC,CACF,CAAC;IAEF,mCAAmC;IACnC,MAAM,CAAC,gBAAgB,CACrB,eAAe,EACf,iBAAiB,EACjB;QACE,KAAK,EAAE,sBAAsB;QAC7B,WAAW,EAAE,sDAAsD;QACnE,QAAQ,EAAE,eAAe;KAC1B,EACD,KAAK,IAAI,EAAE;QACT,MAAM,IAAI,GAAG;;;mBAGA,aAAa;sBACV,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAgCtC,CAAC;QAEI,OAAO;YACL,QAAQ,EAAE,CAAC,EAAE,GAAG,EAAE,iBAAiB,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC;SACnD,CAAC;IACJ,CAAC,CACF,CAAC;AACJ,CAAC"}
|
package/dist/server.d.ts
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* Heimdall MCP Server
|
|
4
|
+
*
|
|
5
|
+
* A TypeScript MCP server providing sandboxed Python and Bash execution.
|
|
6
|
+
* Named after the Norse god who guards the BifrΓΆst bridge, Heimdall watches
|
|
7
|
+
* over code execution with security and vigilance.
|
|
8
|
+
*
|
|
9
|
+
* Features:
|
|
10
|
+
* - Secure Python execution via Pyodide (WebAssembly sandbox)
|
|
11
|
+
* - Bash command execution via just-bash
|
|
12
|
+
* - Virtual filesystem with host sync
|
|
13
|
+
* - Package installation via micropip
|
|
14
|
+
* - Session persistence
|
|
15
|
+
*/
|
|
16
|
+
export {};
|
|
17
|
+
//# sourceMappingURL=server.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":";AACA;;;;;;;;;;;;;GAaG"}
|