11# JavaScript Executor MCP Server
22
3- This MCP server provides JavaScript execution capabilities with ski runtime.
3+ This MCP server provides JavaScript execution capabilities with a modern runtime.
44
55## Features
66
77The ` executeJS ` tool provides:
88
99- ** Console API** : ` console.log() ` , ` console.error() ` , ` console.warn() ` (built-in)
10- - ** HTTP Server** : ` serve() ` for server creation (via ` require('ski/ http/server') ` )
10+ - ** HTTP Server** : ` serve() ` for server creation (via ` require('http/server') ` )
1111- ** Fetch API** : Modern ` fetch() ` with Request, Response, Headers, FormData (global)
1212- ** Timers** : ` setTimeout() ` , ` setInterval() ` , ` clearTimeout() ` , ` clearInterval() ` (global)
1313- ** Buffer** : Buffer, Blob, File APIs for binary data handling (global)
14- - ** Crypto** : Cryptographic functions - hashing, encryption, HMAC (via ` require('ski/ crypto') ` )
15- - ** Cache** : In-memory caching with TTL support (via ` require('ski/ cache') ` )
16- - ** Additional modules** : dom, encoding (global), ext, html, signal (global), stream (global), url (global)
14+ - ** Crypto** : Cryptographic functions - hashing, encryption, HMAC (via ` require('crypto') ` )
15+ - ** Cache** : In-memory caching with TTL support (via ` require('cache') ` )
16+ - ** Additional modules** : encoding (global), url (global)
1717
1818## Getting Started
1919
@@ -47,21 +47,16 @@ codebench-mcp --help
4747```
4848
4949** Available modules:**
50- - ` http ` - HTTP server creation and client requests (import serve from 'ski/ http/server')
50+ - ` http ` - HTTP server creation and client requests (require(' http/server') )
5151- ` fetch ` - Modern fetch API with Request, Response, Headers, FormData (available globally)
5252- ` timers ` - setTimeout, setInterval, clearTimeout, clearInterval (available globally)
5353- ` buffer ` - Buffer, Blob, File APIs for binary data handling (available globally)
54- - ` cache ` - In-memory caching with TTL support (import cache from 'ski/cache')
55- - ` crypto ` - Cryptographic functions (hashing, encryption, HMAC) (import crypto from 'ski/crypto')
56- - ` dom ` - DOM Event and EventTarget APIs
54+ - ` cache ` - In-memory caching with TTL support (require('cache'))
55+ - ` crypto ` - Cryptographic functions (hashing, encryption, HMAC) (require('crypto'))
5756- ` encoding ` - TextEncoder, TextDecoder for text encoding/decoding (available globally)
58- - ` ext ` - Extended context and utility functions
59- - ` html ` - HTML parsing and manipulation
60- - ` signal ` - AbortController and AbortSignal for cancellation (available globally)
61- - ` stream ` - ReadableStream and streaming APIs (available globally)
6257- ` url ` - URL and URLSearchParams APIs (available globally)
6358
64- ** Default modules: ** ` http ` , ` fetch ` , ` timers ` , ` buffer ` , ` crypto `
59+ All modules are enabled by default. You can selectively enable or disable modules using CLI flags.
6560
6661** Note:** The ` executeJS ` tool description dynamically updates to show only the enabled modules and includes detailed information about what each module provides.
6762
@@ -73,13 +68,13 @@ package main
7368import (
7469 " log"
7570
76- " github.com/mark3labs/codebench-mcp/jsserver "
71+ " github.com/mark3labs/codebench-mcp/server "
7772 " github.com/mark3labs/mcp-go/server"
7873)
7974
8075func main () {
8176 // Create a new JavaScript executor server
82- jss , err := jsserver .NewJSServer ()
77+ jss , err := server .NewJSServer ()
8378 if err != nil {
8479 log.Fatalf (" Failed to create server: %v " , err)
8580 }
@@ -100,17 +95,17 @@ import (
10095 " context"
10196 " log"
10297
103- " github.com/mark3labs/codebench-mcp/jsserver "
98+ " github.com/mark3labs/codebench-mcp/server "
10499 " github.com/mark3labs/mcp-go/client"
105100 " github.com/mark3labs/mcp-go/mcp"
106101)
107102
108103func main () {
109104 // Create the JS server with custom module configuration
110- config := jsserver .ModuleConfig {
105+ config := server .ModuleConfig {
111106 EnabledModules: []string {" fetch" , " crypto" , " buffer" },
112107 }
113- jsServer , err := jsserver .NewJSServerWithConfig (config)
108+ jsServer , err := server .NewJSServerWithConfig (config)
114109 if err != nil {
115110 log.Fatalf (" Failed to create server: %v " , err)
116111 }
@@ -212,7 +207,7 @@ To integrate the Docker image with apps that support MCP:
212207
213208### executeJS
214209
215- Execute JavaScript code with ski runtime environment.
210+ Execute JavaScript code with a modern runtime environment.
216211
217212** Parameters:**
218213- ` code ` (required): JavaScript code to execute
@@ -230,18 +225,18 @@ const response = await fetch('https://api.example.com/data');
230225const data = await response .json ();
231226
232227// HTTP server (require import)
233- const serve = require (' ski/ http/server' );
228+ const serve = require (' http/server' );
234229serve (8000 , async (req ) => {
235230 return new Response (' Hello World' );
236231});
237232
238233// Cache operations (require import)
239- const cache = require (' ski/ cache' );
234+ const cache = require (' cache' );
240235cache .set (' key' , ' value' );
241236console .log (cache .get (' key' ));
242237
243238// Crypto operations (require import)
244- const crypto = require (' ski/ crypto' );
239+ const crypto = require (' crypto' );
245240const hash = crypto .md5 (' hello' ).hex ();
246241console .log (' MD5 hash:' , hash);
247242
@@ -260,7 +255,7 @@ console.log('Pathname:', url.pathname);
260255
261256## Limitations
262257
263- - ** No fs or process modules** - File system and process APIs are not available in ski runtime
258+ - ** No fs or process modules** - File system and process APIs are not available in the runtime
264259- ** Module access varies** - Some modules are global (fetch, http), others may need require()
265260- ** Each execution creates a fresh VM** - For isolation, each execution starts with a clean state
266261- ** Module filtering** - Configuration exists but actual runtime filtering not fully implemented
0 commit comments