🎩 You're Invited:Meet the Socket team at Black Hat in Las Vegas, August 3-6.RSVP
Sign In

mcp-server-code-runner

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mcp-server-code-runner - npm Package Compare versions

Comparing version
0.1.6
to
0.1.7
+3
dist/cli.d.ts
#!/usr/bin/env node
export {};
//# sourceMappingURL=cli.d.ts.map
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":""}
#!/usr/bin/env node
import { program } from 'commander';
import { startMcpServer } from './index.js';
import { createRequire } from 'module';
const require = createRequire(import.meta.url);
const pkg = require('../package.json');
program
.name('mcp-server-code-runner')
.description(pkg.description)
.version(pkg.version)
.option('-t, --transport <transport>', 'Transport (stdio or http)', 'stdio')
.option('-p, --port <port>', 'Port number for HTTP server')
.action(async (options) => {
try {
await startMcpServer(options.transport, { port: parseInt(options.port) });
}
catch (error) {
console.error('Error: ', error);
process.exit(1);
}
});
program.parse();
//# sourceMappingURL=cli.js.map
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAC5C,OAAO,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAC;AACvC,MAAM,OAAO,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAC/C,MAAM,GAAG,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAAC;AAEvC,OAAO;KACJ,IAAI,CAAC,wBAAwB,CAAC;KAC9B,WAAW,CAAC,GAAG,CAAC,WAAW,CAAC;KAC5B,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC;KACpB,MAAM,CAAC,6BAA6B,EAAE,2BAA2B,EAAE,OAAO,CAAC;KAC3E,MAAM,CAAC,mBAAmB,EAAE,6BAA6B,CAAC;KAC1D,MAAM,CAAC,KAAK,EAAE,OAAO,EAAE,EAAE;IACxB,IAAI,CAAC;QACH,MAAM,cAAc,CAAC,OAAO,CAAC,SAAS,EAAE,EAAE,IAAI,EAAE,QAAQ,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IAC5E,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,CAAC,KAAK,CAAC,SAAS,EAAE,KAAK,CAAC,CAAC;QAChC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;AACH,CAAC,CAAC,CAAC;AAEL,OAAO,CAAC,KAAK,EAAE,CAAC"}
export declare const languageIdToExecutorMap: {
javascript: string;
php: string;
python: string;
perl: string;
perl6: string;
ruby: string;
go: string;
lua: string;
groovy: string;
powershell: string;
bat: string;
shellscript: string;
fsharp: string;
csharp: string;
vbscript: string;
typescript: string;
coffeescript: string;
scala: string;
swift: string;
julia: string;
crystal: string;
ocaml: string;
r: string;
applescript: string;
clojure: string;
racket: string;
scheme: string;
ahk: string;
autoit: string;
dart: string;
haskell: string;
nim: string;
lisp: string;
kit: string;
v: string;
sass: string;
scss: string;
};
export declare const languageIdToFileExtensionMap: {
javascript: string;
typescript: string;
powershell: string;
};
//# sourceMappingURL=constants.d.ts.map
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,uBAAuB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAsCnC,CAAC;AAEF,eAAO,MAAM,4BAA4B;;;;CAIxC,CAAC"}
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,uBAAuB,GAAG;IACnC,UAAU,EAAE,MAAM;IAClB,GAAG,EAAE,KAAK;IACV,MAAM,EAAE,WAAW;IACnB,IAAI,EAAE,MAAM;IACZ,KAAK,EAAE,OAAO;IACd,IAAI,EAAE,MAAM;IACZ,EAAE,EAAE,QAAQ;IACZ,GAAG,EAAE,KAAK;IACV,MAAM,EAAE,QAAQ;IAChB,UAAU,EAAE,0CAA0C;IACtD,GAAG,EAAE,QAAQ;IACb,WAAW,EAAE,MAAM;IACnB,MAAM,EAAE,KAAK;IACb,MAAM,EAAE,UAAU;IAClB,QAAQ,EAAE,kBAAkB;IAC5B,UAAU,EAAE,SAAS;IACrB,YAAY,EAAE,QAAQ;IACtB,KAAK,EAAE,OAAO;IACd,KAAK,EAAE,OAAO;IACd,KAAK,EAAE,OAAO;IACd,OAAO,EAAE,SAAS;IAClB,KAAK,EAAE,OAAO;IACd,CAAC,EAAE,SAAS;IACZ,WAAW,EAAE,WAAW;IACxB,OAAO,EAAE,WAAW;IACpB,MAAM,EAAE,QAAQ;IAChB,MAAM,EAAE,aAAa;IACrB,GAAG,EAAE,YAAY;IACjB,MAAM,EAAE,SAAS;IACjB,IAAI,EAAE,MAAM;IACZ,OAAO,EAAE,YAAY;IACrB,GAAG,EAAE,6CAA6C;IAClD,IAAI,EAAE,eAAe;IACrB,GAAG,EAAE,YAAY;IACjB,CAAC,EAAE,OAAO;IACV,IAAI,EAAE,uBAAuB;IAC7B,IAAI,EAAE,uBAAuB;CAChC,CAAC;AAEF,MAAM,CAAC,MAAM,4BAA4B,GAAG;IACxC,UAAU,EAAE,IAAI;IAChB,UAAU,EAAE,IAAI;IAChB,UAAU,EAAE,KAAK;CACpB,CAAC"}
import { McpServerEndpoint } from "./streamableHttp.js";
export type Transport = 'stdio' | 'http';
export interface HttpServerOptions {
port?: number;
}
export declare function startMcpServer(transport: Transport, options?: HttpServerOptions): Promise<void | McpServerEndpoint>;
//# sourceMappingURL=index.d.ts.map
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAgC,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAEtF,MAAM,MAAM,SAAS,GAAG,OAAO,GAAG,MAAM,CAAC;AAEzC,MAAM,WAAW,iBAAiB;IAC9B,IAAI,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,wBAAsB,cAAc,CAAC,SAAS,EAAE,SAAS,EAAE,OAAO,CAAC,EAAE,iBAAiB,GAAG,OAAO,CAAC,IAAI,GAAG,iBAAiB,CAAC,CAQzH"}
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AACjD,OAAO,EAAE,4BAA4B,EAAqB,MAAM,qBAAqB,CAAC;AAQtF,MAAM,CAAC,KAAK,UAAU,cAAc,CAAC,SAAoB,EAAE,OAA2B;IAClF,IAAI,SAAS,KAAK,OAAO,EAAE,CAAC;QACxB,OAAO,mBAAmB,EAAE,CAAC;IACjC,CAAC;SAAM,IAAI,SAAS,KAAK,MAAM,EAAE,CAAC;QAC9B,OAAO,4BAA4B,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;IACvD,CAAC;SAAM,CAAC;QACJ,MAAM,IAAI,KAAK,CAAC,qDAAqD,CAAC,CAAC;IAC3E,CAAC;AACL,CAAC"}
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
export declare function createServer(): McpServer;
//# sourceMappingURL=server.d.ts.map
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAQpE,wBAAgB,YAAY,IAAI,SAAS,CA6CxC"}
{"version":3,"file":"server.js","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACpE,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,MAAM,IAAI,CAAC;AACzB,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAC7B,OAAO,KAAK,EAAE,MAA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McpServer(): Promise<void>;
//# sourceMappingURL=stdio.d.ts.map
{"version":3,"file":"stdio.d.ts","sourceRoot":"","sources":["../src/stdio.ts"],"names":[],"mappings":"AAIA,wBAAsB,mBAAmB,IAAI,OAAO,CAAC,IAAI,CAAC,CAKzD"}
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
import { createServer } from "./server.js";
export async function startStdioMcpServer() {
const server = createServer();
const transport = new StdioServerTransport();
await server.connect(transport);
console.debug("Code Runner MCP Server running on stdio");
}
//# sourceMappingURL=stdio.js.map
{"version":3,"file":"stdio.js","sourceRoot":"","sources":["../src/stdio.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AACjF,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAE3C,MAAM,CAAC,KAAK,UAAU,mBAAmB;IACrC,MAAM,MAAM,GAAc,YAAY,EAAE,CAAC;IACzC,MAAM,SAAS,GAAG,IAAI,oBAAoB,EAAE,CAAC;IAC7C,MAAM,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;IAChC,OAAO,CAAC,KAAK,CAAC,yCAAyC,CAAC,CAAC;AAC7D,CAAC"}
export interface McpServerEndpoint {
url: string;
port: number;
}
export declare function startStreamableHttpMcpServer(port?: number): Promise<McpServerEndpoint>;
//# sourceMappingURL=streamableHttp.d.ts.map
{"version":3,"file":"streamableHttp.d.ts","sourceRoot":"","sources":["../src/streamableHttp.ts"],"names":[],"mappings":"AAKA,MAAM,WAAW,iBAAiB;IAChC,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;CACd;AAED,wBAAsB,4BAA4B,CAAC,IAAI,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,iBAAiB,CAAC,CA+E5F"}
import express from "express";
import { StreamableHTTPServerTransport } from "@modelcontextprotocol/sdk/server/streamableHttp.js";
import { createServer } from "./server.js";
export async function startStreamableHttpMcpServer(port) {
const app = express();
app.use(express.json());
const server = createServer();
const transport = new StreamableHTTPServerTransport({
sessionIdGenerator: undefined, // set to undefined for stateless servers
});
// Setup routes for the server
await server.connect(transport);
app.post('/mcp', async (req, res) => {
console.log('Received MCP request:', req.body);
try {
await transport.handleRequest(req, res, req.body);
}
catch (error) {
console.error('Error handling MCP request:', error);
if (!res.headersSent) {
res.status(500).json({
jsonrpc: '2.0',
error: {
code: -32603,
message: 'Internal server error',
},
id: null,
});
}
}
});
app.get('/mcp', async (req, res) => {
console.log('Received GET MCP request');
res.writeHead(405).end(JSON.stringify({
jsonrpc: "2.0",
error: {
code: -32000,
message: "Method not allowed."
},
id: null
}));
});
app.delete('/mcp', async (req, res) => {
console.log('Received DELETE MCP request');
res.writeHead(405).end(JSON.stringify({
jsonrpc: "2.0",
error: {
code: -32000,
message: "Method not allowed."
},
id: null
}));
});
// Start the server
const PORT = Number(port || process.env.PORT || 3088);
return new Promise((resolve, reject) => {
const server = app.listen(PORT, (error) => {
if (error) {
console.error('Failed to start server:', error);
reject(error);
return;
}
const endpoint = {
url: `http://localhost:${PORT}/mcp`,
port: PORT
};
console.log(`Code Runner Streamable HTTP MCP Server listening at ${endpoint.url}`);
resolve(endpoint);
});
// Handle server errors
server.on('error', (error) => {
console.error('Server error:', error);
reject(error);
});
});
}
//# sourceMappingURL=streamableHttp.js.map
{"version":3,"file":"streamableHttp.js","sourceRoot":"","sources":["../src/streamableHttp.ts"],"names":[],"mappings":"AAAA,OAAO,OAA8B,MAAM,SAAS,CAAC;AAErD,OAAO,EAAE,6BAA6B,EAAE,MAAM,oDAAoD,CAAC;AACnG,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAO3C,MAAM,CAAC,KAAK,UAAU,4BAA4B,CAAC,IAAa;IAC9D,MAAM,GAAG,GAAG,OAAO,EAAE,CAAC;IACtB,GAAG,CAAC,GAAG,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC,CAAC;IAExB,MAAM,MAAM,GAAc,YAAY,EA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C,KAAK,CAAC,CAAC;QAChB,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC"}
+1
-0

@@ -45,1 +45,2 @@ export const languageIdToExecutorMap = {

};
//# sourceMappingURL=constants.js.map
+13
-12

@@ -1,13 +0,14 @@

#!/usr/bin/env node
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
import { createServer } from "./server.js";
async function main() {
const server = createServer();
const transport = new StdioServerTransport();
await server.connect(transport);
console.debug("Code Runner MCP Server running on stdio");
import { startStdioMcpServer } from "./stdio.js";
import { startStreamableHttpMcpServer } from "./streamableHttp.js";
export async function startMcpServer(transport, options) {
if (transport === 'stdio') {
return startStdioMcpServer();
}
else if (transport === 'http') {
return startStreamableHttpMcpServer(options?.port);
}
else {
throw new Error('Invalid transport. Must be either "stdio" or "http"');
}
}
main().catch((error) => {
console.error("Fatal error in main():", error);
process.exit(1);
});
//# sourceMappingURL=index.js.map

@@ -68,1 +68,2 @@ import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";

}
//# sourceMappingURL=server.js.map
{
"name": "mcp-server-code-runner",
"version": "0.1.6",
"version": "0.1.7",
"type": "module",
"main": "dist/index.js",
"bin": {
"mcp-server-code-runner": "dist/index.js"
"mcp-server-code-runner": "dist/cli.js"
},
"exports": {
".": "./dist/index.js"
},
"scripts": {
"build": "tsc && shx chmod +x dist/index.js",
"build": "tsc && shx chmod +x dist/index.js dist/cli.js",
"watch": "tsc --watch",
"start": "node ./dist/index.js"
"start": "node ./dist/cli.js"
},

@@ -29,6 +33,9 @@ "files": [

"dependencies": {
"@modelcontextprotocol/sdk": "^1.7.0",
"@modelcontextprotocol/sdk": "^1.10.1",
"commander": "^13.1.0",
"express": "^5.1.0",
"zod": "^3.24.2"
},
"devDependencies": {
"@types/express": "^5.0.1",
"@types/node": "^22.13.10",

@@ -35,0 +42,0 @@ "shx": "^0.4.0",

+40
-12
# Code Runner MCP Server
[![NPM Downloads](https://img.shields.io/npm/d18m/mcp-server-code-runner)](https://www.npmjs.com/package/mcp-server-code-runner) [![smithery badge](https://smithery.ai/badge/@formulahendry/mcp-server-code-runner)](https://smithery.ai/server/@formulahendry/mcp-server-code-runner)
[![NPM Downloads](https://img.shields.io/npm/d18m/mcp-server-code-runner)](https://www.npmjs.com/package/mcp-server-code-runner) [![smithery badge](https://smithery.ai/badge/@formulahendry/mcp-server-code-runner)](https://smithery.ai/server/@formulahendry/mcp-server-code-runner) [![Docker Pulls](https://img.shields.io/docker/pulls/formulahendry/mcp-server-code-runner)](https://hub.docker.com/r/formulahendry/mcp-server-code-runner)

@@ -14,6 +14,10 @@ MCP Server for running code snippet and show the result.

### VS Code
### npx for VS Code
Configuration in `settings.json`:
Install the Code Runner MCP server in VS Code using below buttons:
[![Install in VS Code](https://img.shields.io/badge/Install_MCP_Server_(npx)-VS_Code-0098FF)](https://vscode.dev/redirect?url=vscode%3Amcp%2Finstall%3F%257B%2522name%2522%253A%2522mcp-server-code-runner%2522%252C%2522command%2522%253A%2522npx%2522%252C%2522args%2522%253A%255B%2522-y%2522%252C%2522mcp-server-code-runner%2540latest%2522%255D%257D) [![Install in VS Code Insiders](https://img.shields.io/badge/Install_MCP_Server_(npx)-VS_Code_Insiders-24bfa5)](https://insiders.vscode.dev/redirect?url=vscode-insiders%3Amcp%2Finstall%3F%257B%2522name%2522%253A%2522mcp-server-code-runner%2522%252C%2522command%2522%253A%2522npx%2522%252C%2522args%2522%253A%255B%2522-y%2522%252C%2522mcp-server-code-runner%2540latest%2522%255D%257D)
Alternatively, you can add configuration in `settings.json`:
```json

@@ -28,3 +32,3 @@ {

"-y",
"mcp-server-code-runner"
"mcp-server-code-runner@latest"
],

@@ -37,3 +41,3 @@ }

### Claude Desktop
### npx for Claude Desktop

@@ -49,3 +53,3 @@ Configuration in `claude_desktop_config.json`:

"-y",
"mcp-server-code-runner"
"mcp-server-code-runner@latest"
],

@@ -57,10 +61,27 @@ }

### Installing via Smithery
### Docker
> **_NOTE:_** This will run Code Runner MCP Server in a remote Container environment hosted by Smithery.
Use VS Code as example. Install the Code Runner MCP server in VS Code using below buttons:
To install Code Runner MCP Server for Claude Desktop automatically via [Smithery](https://smithery.ai/server/@formulahendry/mcp-server-code-runner):
[![Install in VS Code](https://img.shields.io/badge/Install_MCP_Server_(Docker)-VS_Code-0098FF)](https://vscode.dev/redirect?url=vscode%3Amcp%2Finstall%3F%257B%2522name%2522%253A%2522mcp-server-code-runner%2522%252C%2522command%2522%253A%2522docker%2522%252C%2522args%2522%253A%255B%2522run%2522%252C%2522--rm%2522%252C%2522-i%2522%252C%2522formulahendry%252Fmcp-server-code-runner%2522%255D%257D) [![Install in VS Code Insiders](https://img.shields.io/badge/Install_MCP_Server_(Docker)-VS_Code_Insiders-24bfa5)](https://insiders.vscode.dev/redirect?url=vscode-insiders%3Amcp%2Finstall%3F%257B%2522name%2522%253A%2522mcp-server-code-runner%2522%252C%2522command%2522%253A%2522docker%2522%252C%2522args%2522%253A%255B%2522run%2522%252C%2522--rm%2522%252C%2522-i%2522%252C%2522formulahendry%252Fmcp-server-code-runner%2522%255D%257D)
```bash
npx -y @smithery/cli install @formulahendry/mcp-server-code-runner --client claude
Alternatively, you can add configuration in `settings.json`:
```json
{
"mcp": {
"inputs": [],
"servers": {
"mcp-server-code-runner": {
"command": "docker",
"args": [
"run",
"--rm",
"-i",
"formulahendry/mcp-server-code-runner"
]
}
}
}
}
```

@@ -94,3 +115,3 @@

"-y",
"mcp-server-code-runner"
"mcp-server-code-runner@latest"
],

@@ -103,2 +124,9 @@ }

## Run with [Streamable HTTP Transport](https://modelcontextprotocol.io/specification/2025-03-26/basic/transports#streamable-http)
```shell
npm install mcp-server-code-runner@latest
mcp-server-code-runner --transport http
```
## Usage

@@ -105,0 +133,0 @@