Secure MCP server that executes JavaScript code for data analysis with support for multiple data formats using isolated-vm.
- β Multi-format Data Support: JSON, CSV, TSV, and pipe-separated data
- β Smart Format Detection: Automatically detects data format from content (not file extension)
- β Secure Execution: Isolated JavaScript environment with resource limits
- β Flexible Data Input: Support for URLs and inline data
- β Advanced JavaScript: Variables, functions, return statements, and complex logic
- β Safety Limits: 5-second timeout and 128MB memory protection
[{"name": "John", "age": 30}, {"name": "Jane", "age": 25}]name,age,city
John,30,New York
Jane,25,Bostonname age city
John 30 New York
Jane 25 Bostonname|age|city
John|30|New York
Jane|25|Boston
Note: The MCP automatically detects the format and delimiter from the content, converting all tabular data into JavaScript arrays of objects.
npx mcp-js-executornpm install -g mcp-js-executor
mcp-js-executorAdd to your claude_desktop_config.json file:
{
"mcpServers": {
"js-executor": {
"command": "npx",
"args": ["mcp-js-executor"]
}
}
}Config file locations:
- macOS:
~/Library/Application Support/Claude/claude_desktop_config.json - Windows:
%APPDATA%\Claude\claude_desktop_config.json
This server works with any framework that supports the Model Context Protocol (MCP):
- Cline: Add to your MCP server configuration
- Continue: Configure in your MCP settings
- Custom implementations: Use standard MCP client libraries
git clone https://github.com/memori-ai/mcp-js-executor.git
cd mcp-js-executor
npm install
npm startOnce configured, you can ask Claude to analyze data:
"Analyze this CSV file: https://example.com/sales.csv
Count how many sales were made in August"
Claude will automatically use the JavaScript executor to:
- Fetch and parse the CSV data
- Execute JavaScript to filter August sales
- Return the count and analysis
// Count total records
data.length
// Filter and count active items
data.filter(item => item.status === 'active').length
// Find maximum value
Math.max(...data.map(item => item.price))// Sales analysis by month
const salesByMonth = {};
data.forEach(sale => {
const month = sale.Mese;
salesByMonth[month] = (salesByMonth[month] || 0) + sale['Totale Vendita'];
});
return Object.entries(salesByMonth).map(([month, total]) => ({month, total}));// Find top performers with statistics
const sellers = {};
data.filter(o => o.Mese === 'agosto').forEach(o => {
sellers[o.Venditore] = (sellers[o.Venditore] || 0) + 1;
});
return Object.entries(sellers)
.map(([name, count]) => ({name, orders: count}))
.sort((a,b) => b.orders - a.orders);{
"tool": "execute_js",
"parameters": {
"url": "https://example.com/data.csv",
"code": "data.filter(item => item.status === 'active').length"
}
}{
"tool": "execute_js",
"parameters": {
"data": [{"name": "John", "age": 30}],
"code": "data.filter(person => person.age > 25).length"
}
}- Format Detection: Analyzes content to identify delimiter (
,,\t,;,|) - Smart Parsing: Skips header lines and separator rows automatically
- Type Conversion: Converts strings to numbers/booleans when appropriate
- Object Creation: Transforms rows into JavaScript objects with column headers as keys
Input CSV:
name,age,active
John,30,true
Jane,25,false
Becomes JavaScript:
[
{"name": "John", "age": 30, "active": true},
{"name": "Jane", "age": 25, "active": false}
]- Isolated Execution: Uses
isolated-vmfor complete sandboxing - Memory Limit: 128MB maximum per execution
- Timeout Protection: 5-second execution limit
- No File System Access: Cannot read/write local files
- No Network Access: Cannot make external HTTP requests (except for data fetching)
- Safe Environment: No access to Node.js modules or system functions
- Ensure the config file is in the correct location
- Restart Claude Desktop completely
- Check that the JSON syntax is valid
- Verify
npxis available in your PATH
# Fix npm permissions (macOS/Linux)
sudo npm install -g mcp-js-executor
# Or use npx (recommended)
npx mcp-js-executor- Ensure no firewall is blocking the MCP server
- Check that port 3000 (default) is available
- Try running the server manually first:
npx mcp-js-executor
,(comma) - Standard CSV\t(tab) - TSV files;(semicolon) - European CSV format|(pipe) - Custom delimiter format
- Analyzes first data line (skipping headers and separators)
- Counts occurrence of each delimiter
- Selects most frequent delimiter
- Falls back to comma if no clear winner
- Numbers: Automatic conversion for integers and floats
- Booleans: Converts "true"/"false" strings
- Null Values: Empty cells become
null - Strings: Everything else remains as string
- β Added CSV/TSV/pipe-separated data support
- β Implemented smart delimiter detection
- β Enhanced data parsing with type conversion
- β Improved error handling for malformed data
- β Maintained full backward compatibility
- β Initial JSON-only support
- β Basic JavaScript execution
- β Security isolation with isolated-vm
This MCP server is designed for secure data analysis. When contributing:
- Maintain security isolation
- Preserve backward compatibility
- Add comprehensive tests for new data formats
- Update documentation and examples
MIT License - Feel free to use in your projects!
You can experiment with this MCP server directly on Aisuru.com - our AI agent platform where you can create, test, and deploy intelligent agents with access to powerful tools like this JavaScript executor.
- Data Analysis: Process CSV/TSV files with custom JavaScript logic
- Agent Development: Test JavaScript execution capabilities in your AI workflows
- Rapid Prototyping: Experiment with different data processing approaches
- Multi-format Support: Work seamlessly with JSON, CSV, TSV, and pipe-separated data
Visit Aisuru.com to start building with your agents today!
mcp-js-executor is crafted with love by the Memori.ai team - the creators of Aisuru.com, the platform where you can create and experiment with your AI agents.
π Join our community and bring your agents to life!
