mirror of
https://github.com/mcp-use/mcp-use.git
synced 2026-09-14 18:06:01 +08:00
1cae240ca2
* Check out feat/server/python branch with latest docs * feat: structure v1 * feat: product navigation * stubs * emtpy pages * feat: home page * autogenerate docs updated * side bar on home page with redirects * theme adaptation of welcome cards * cleanup logos * cleanup * WIP disclosure in Python Server * feat: add initial documentation and images for MCP server framework * feat: add TypeScript documentation for mcp agent and mcp client + remove typescript reference from python files * fix: update sandbox documentation for Python and TypeScript clients - Adjusted Python sandbox documentation for clarity in API key usage. - Added a warning in TypeScript documentation indicating that sandbox execution is not yet supported, with a reference to the Python version for users needing this functionality. * feat: enhance TypeScript SDK documentation with new icons and structured navigation * fix * feat: update getting started guide * refactor: remove sandboxed execution section from TypeScript connection types documentation - Deleted the Sandboxed Execution section, including installation instructions and characteristics. - Updated the Choosing the Right Connection Type section to reflect the removal of sandboxed execution details. * feat: add observability documentation for MCP agents * feat: add comprehensive documentation for MCP server framework * feat: expand TypeScript server documentation with new templates, prompts, and UI widgets sections * fix * color hover * remove inspector * feat: remove claude code review * fix: broken links --------- Co-authored-by: Luigi Pederzani <luigipederzani@gmail.com>
86 lines
2.7 KiB
Plaintext
86 lines
2.7 KiB
Plaintext
---
|
|
title: "Sandbox"
|
|
description: "Run your MCP in a secure remote sandbox."
|
|
icon: "lock"
|
|
---
|
|
|
|
## Sandboxed Execution
|
|
|
|
mcp_use supports running MCP servers in a sandboxed cloud environment using E2B. This is useful when you want to run MCP servers without having to install their dependencies locally.
|
|
|
|
### Installation
|
|
|
|
To use sandboxed execution, you need to install the E2B dependency:
|
|
|
|
```bash
|
|
# Install mcp-use with E2B support
|
|
pip install "mcp-use[e2b]"
|
|
|
|
# Or install the dependency directly
|
|
pip install e2b-code-interpreter
|
|
```
|
|
|
|
You'll also need an E2B API key. You can sign up at [e2b.dev](https://e2b.dev) to get your API key.
|
|
|
|
### Configuration Example
|
|
|
|
To enable sandboxed execution, use the sandbox parameter when creating the MCPClient:
|
|
|
|
<CodeGroup>
|
|
```python Python
|
|
from mcp_use import MCPClient
|
|
from mcp_use.types.sandbox import SandboxOptions
|
|
|
|
# Define sandbox options
|
|
sandbox_options: SandboxOptions = {
|
|
"api_key": "your_e2b_api_key", # Or use E2B_API_KEY environment variable
|
|
"sandbox_template_id": "code-interpreter-v1",
|
|
"supergateway_command": "npx -y supergateway" # Optional, this is the default
|
|
}
|
|
|
|
# Create client with sandboxed execution enabled
|
|
client = MCPClient.from_dict(
|
|
{
|
|
"mcpServers": {
|
|
"command_line": {
|
|
"command": "npx",
|
|
"args": ["-y", "@modelcontextprotocol/server-everything"]
|
|
}
|
|
}
|
|
},
|
|
sandbox=True,
|
|
sandbox_options=sandbox_options
|
|
)
|
|
```
|
|
</CodeGroup>
|
|
|
|
### Available Sandbox Options
|
|
|
|
The `SandboxOptions` type provides the following configuration options:
|
|
|
|
| Option | Description | Default |
|
|
| ---------------------- | ---------------------------------------------------------------------------------------- | --------------------- |
|
|
| `api_key` | E2B API key. Required - can be provided directly or via E2B_API_KEY environment variable | None |
|
|
| `sandbox_template_id` | Template ID for the sandbox environment | "base" |
|
|
| `supergateway_command` | Command to run supergateway | "npx -y supergateway" |
|
|
|
|
### E2B API Key
|
|
|
|
To use sandboxed execution, you need an E2B API key. You can provide it in two ways:
|
|
|
|
1. Directly in the sandbox options:
|
|
|
|
<CodeGroup>
|
|
```python Python
|
|
sandbox_options = {"api_key": "your_e2b_api_key"}
|
|
```
|
|
</CodeGroup>
|
|
|
|
2. Through the environment variable:
|
|
```bash
|
|
# In your .env file or environment
|
|
E2B_API_KEY=your_e2b_api_key
|
|
```
|
|
|
|
For more details on connection types and sandbox configuration, see the [Connection Types](./connection-types) guide.
|