Skip to content

Commit 9d6b180

Browse files
committed
remove fetch for now
1 parent 2e79f63 commit 9d6b180

File tree

6 files changed

+64
-401
lines changed

6 files changed

+64
-401
lines changed

cmd/root.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ var availableModules = []string{
2222
"console",
2323
"fs",
2424
"http",
25-
"fetch",
2625
"timers",
2726
"process",
2827
"require",
@@ -33,7 +32,7 @@ var rootCmd = &cobra.Command{
3332
Use: "codebench-mcp",
3433
Short: "JavaScript Executor MCP Server",
3534
Long: `A Model Context Protocol (MCP) server that provides JavaScript execution capabilities
36-
with a Node.js-like environment including console, fs, http, fetch, timers, process, and require modules.`,
35+
with a Node.js-like environment including console, fs, http, timers, process, and require modules.`,
3736
Run: func(cmd *cobra.Command, args []string) {
3837
// Validate module configuration
3938
if len(enabledModules) > 0 && len(disabledModules) > 0 {

codebench-mcp

-20.3 MB
Binary file not shown.

jsserver/description_test.go

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,14 @@ func TestBuildToolDescription(t *testing.T) {
1515
}{
1616
{
1717
name: "All modules enabled",
18-
enabledModules: []string{"console", "fs", "http", "fetch", "timers", "process", "require"},
18+
enabledModules: []string{"console", "fs", "http", "timers", "process", "require"},
1919
expectedContent: []string{
2020
"simplified JavaScript VM (goja)",
2121
"NOT a full Node.js environment",
2222
"📦 Available modules:",
2323
"• console: Console logging",
2424
"• fs: File system operations",
2525
"• http: HTTP server creation",
26-
"• fetch: HTTP client requests",
2726
"• timers: Timer functions",
2827
"• process: Process information",
2928
"• require: Module loading system",
@@ -44,7 +43,6 @@ func TestBuildToolDescription(t *testing.T) {
4443
notExpected: []string{
4544
"• fs:",
4645
"• http:",
47-
"• fetch:",
4846
"• process:",
4947
"• require:",
5048
},
@@ -64,17 +62,16 @@ func TestBuildToolDescription(t *testing.T) {
6462
},
6563
},
6664
{
67-
name: "Only fetch enabled",
68-
enabledModules: []string{"fetch"},
65+
name: "Only timers enabled",
66+
enabledModules: []string{"timers"},
6967
expectedContent: []string{
7068
"📦 Available modules:",
71-
"• fetch: HTTP client requests (fetch API with Promise support for GET/POST/etc)",
69+
"• timers: Timer functions",
7270
},
7371
notExpected: []string{
7472
"• console:",
7573
"• fs:",
7674
"• http:",
77-
"• timers:",
7875
"• process:",
7976
"• require:",
8077
},
@@ -101,7 +98,7 @@ func TestBuildToolDescription(t *testing.T) {
10198
func TestToolDescriptionDynamicUpdate(t *testing.T) {
10299
// Test that different configurations produce different descriptions
103100
config1 := ModuleConfig{EnabledModules: []string{"console", "fs"}}
104-
config2 := ModuleConfig{EnabledModules: []string{"fetch", "timers"}}
101+
config2 := ModuleConfig{EnabledModules: []string{"timers"}}
105102

106103
server1, err := NewJSServerWithConfig(config1)
107104
assert.NoError(t, err)
@@ -120,11 +117,9 @@ func TestToolDescriptionDynamicUpdate(t *testing.T) {
120117
// Config1 should mention console and fs
121118
assert.Contains(t, desc1, "• console:")
122119
assert.Contains(t, desc1, "• fs:")
123-
assert.NotContains(t, desc1, "• fetch:")
124120
assert.NotContains(t, desc1, "• timers:")
125121

126-
// Config2 should mention fetch and timers
127-
assert.Contains(t, desc2, "• fetch:")
122+
// Config2 should mention timers
128123
assert.Contains(t, desc2, "• timers:")
129124
assert.NotContains(t, desc2, "• console:")
130125
assert.NotContains(t, desc2, "• fs:")

jsserver/module_test.go

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,10 @@ func TestModuleConfiguration_EnabledModules(t *testing.T) {
2727
// These should not be available
2828
const fsAvailable = typeof fs !== 'undefined';
2929
const httpAvailable = typeof http !== 'undefined';
30-
const fetchAvailable = typeof fetch !== 'undefined';
3130
const processAvailable = typeof process !== 'undefined';
3231
3332
console.log("fs available:", fsAvailable);
3433
console.log("http available:", httpAvailable);
35-
console.log("fetch available:", fetchAvailable);
3634
console.log("process available:", processAvailable);
3735
3836
"module test completed";
@@ -51,15 +49,14 @@ func TestModuleConfiguration_EnabledModules(t *testing.T) {
5149
// Should not have other modules
5250
assert.Contains(t, text, "fs available: false")
5351
assert.Contains(t, text, "http available: false")
54-
assert.Contains(t, text, "fetch available: false")
5552
assert.Contains(t, text, "process available: false")
5653
assert.Contains(t, text, "Result: module test completed")
5754
}
5855

5956
func TestModuleConfiguration_DisabledModules(t *testing.T) {
6057
// Test with all modules except fs and http
6158
config := ModuleConfig{
62-
EnabledModules: []string{"console", "fetch", "timers", "process"},
59+
EnabledModules: []string{"console", "timers", "process"},
6360
}
6461
handler := NewJSHandlerWithConfig(config)
6562

@@ -69,7 +66,6 @@ func TestModuleConfiguration_DisabledModules(t *testing.T) {
6966
"code": `
7067
// These should work
7168
console.log("Console works");
72-
console.log("fetch available:", typeof fetch !== 'undefined');
7369
console.log("process available:", typeof process !== 'undefined');
7470
7571
// These should not be available
@@ -88,7 +84,6 @@ func TestModuleConfiguration_DisabledModules(t *testing.T) {
8884

8985
// Should have enabled modules
9086
assert.Contains(t, text, "Console works")
91-
assert.Contains(t, text, "fetch available: true")
9287
assert.Contains(t, text, "process available: true")
9388

9489
// Should not have disabled modules

0 commit comments

Comments
 (0)