The Code Runner MCP Server is a powerful tool for executing code snippets and displaying the results. It supports a wide range of programming languages, making it versatile for developers working with multiple technologies.
The Code Runner MCP Server is designed to run code snippets in various programming languages and return the output. It integrates seamlessly with tools like VS Code and Claude Desktop, enabling developers to execute code directly from their development environments.
The server supports the following programming languages:
For a complete list, refer to the constants.ts file.
Add the following configuration to your settings.json
file:
{
"mcp": {
"inputs": [],
"servers": {
"mcp-server-code-runner": {
"command": "npx",
"args": ["-y", "mcp-server-code-runner"]
}
}
}
}
Add the following configuration to your claude_desktop_config.json
file:
{
"mcpServers": {
"mcp-server-code-runner": {
"command": "npx",
"args": ["-y", "mcp-server-code-runner"]
}
}
}
To use Docker, add the following configuration to your settings.json
file:
{
"mcp": {
"inputs": [],
"servers": {
"mcp-server-code-runner": {
"command": "docker",
"args": ["run", "--rm", "-i", "formulahendry/mcp-server-code-runner"]
}
}
}
}
To install the Code Runner MCP Server for Claude Desktop automatically via Smithery, run the following command:
npx -y @smithery/cli install @formulahendry/mcp-server-code-runner --client claude
On Windows, MCP servers may fail to connect with npx
. You can try the following workarounds:
npx
to bunx
.Add the following configuration to your settings.json
file:
{
"mcp": {
"inputs": [],
"servers": {
"mcp-server-code-runner": {
"command": "cmd",
"args": ["/c", "npx", "-y", "mcp-server-code-runner"]
}
}
}
}
Before using the Code Runner MCP Server, ensure that the interpreter or compiler for the programming language you want to run is set in the PATH
environment variable.
Try the following prompts in the application that has configured the Code Runner MCP Server:
Run the JavaScript Code: console.log(5+6)
Where is the temporary folder in my OS? Use run-code tool
How many CPUs do I have in my machine? Use run-code tool
Want to build your own MCP Server? Try the Yeoman Generator for MCP Server to create your MCP Server project!
The Code Runner MCP Server is an open-source project licensed under the MIT License.