An MCP server that allows you to run TypeScript and JavaScript code securely on your local machine using the Deno® sandbox. This server provides a controlled environment for executing code with explicit permission controls.
Note: This project is not affiliated with Deno Land LLC in any way. I'm just a fan of the Deno® runtime. "Deno" is a registered trademark of Deno Land LLC.
I would like to keep this codebase as simple as possible so that someone can read it quickly and tell that it is not going to do anything dodgy to their machine. I therefore am going to try and avoid the temptation to add features which make the code harder to read and leave it to others to build the cleverer mcp servers.
This MCP should work with a range of MCP clients.
To use this MCP server with Claude Desktop, add it to your claude_desktop_config.json
in:
~/Library/Application Support/Claude/claude_desktop_config.json
%APPDATA%\Claude\claude_desktop_config.json
If you have Deno installed
{
"mcpServers": {
"denoSandbox": {
"command": "deno",
"args": [
"run",
"npm:mcp-deno-sandbox",
"--allow-net=icanhazip.com"
]
}
}
}
If you have Nodejs installed
{
"mcpServers": {
"denoSandbox": {
"command": "npx",
"args": [
"mcp-deno-sandbox",
"--allow-net=icanhazip.com"
]
}
}
}
You need to set the permissions at runtime; if you change them you need to restart the server.
The permissions are the same as the Deno® permissions and are just passed through.
Examples
Network Access
--allow-net
--allow-net=api.github.com,example.com
File System
--allow-read --allow-write
--allow-read=/tmp --allow-write=/tmp
For a complete list of permissions and detailed documentation, see Deno® Security.
This server runs code using the permissions specified when starting the server. These permissions are passed through to the Deno® runtime.
Remember that any code executed has access to the permissions you've provided, so be careful about what permissions you enable.
The sandbox is completely undermined by:
claude_desktop_config.json
)You should also think carefully about read permissions to sensitive dotfiles
you have (e.g. with credentials for AWS, NPM, OpenAI); especially if you have granted network access.
Remember malicious people can use prompt injection to trick your prefered language model into running bad things on your computer. Maybe they can hide some invisible text in a PDF which you cannot read or in the middle of a long document you ask it to summarise.
Deno® has some additional suggestions if you would like even more isolation for untrusted code.
# Clone the repository
git clone https://github.com/bewt85/mcp-deno-sandbox.git
cd mcp-deno-sandbox
# Install dependencies
npm install
Check the code formatting and types:
npm run checks
Fix some issues automatically:
npm run fix
Test with the MCP Inspector:
npx @modelcontextprotocol/inspector npx mcp-deno-sandbox --allow-net
Try these examples in the inspector:
Basic arithmetic (works without permissions):
console.log(1 + 2);
Network access (requires --allow-net
):
fetch('https://icanhazip.com').then(response => response.text()).then(ip => console.log(`Your IP is: ${ip.trim()}`));
File system access (requires --allow-read
):
const text = Deno.readTextFileSync('/path/to/file.txt');
console.log(text);
I don't that a lot of spare time so I will not be able to engage with most feature requests / contributions. It is probably better to fork the repository if you would like to add something. Apologies.
When you want to do a release:
package.json
to X.Y.ZMIT
{
"mcpServers": {
"denoSandbox": {
"env": {},
"args": [
"run",
"npm:mcp-deno-sandbox",
"--allow-net=icanhazip.com"
],
"command": "deno"
}
}
}
Seamless access to top MCP servers powering the future of AI integration.