This MCP Server allows ForeverVM to execute Python code in a REPL environment, enabling Claude to run Python code and return results. The server provides a seamless interface between the AI model and Python execution environment.
The simplest way to install and set up the ForeverVM MCP Server is to use the provided installer command for Claude Desktop:
npx forevervm-mcp install --claude
This will automatically install and configure the MCP server for use with Claude Desktop.
For other MCP clients besides Claude Desktop, you'll need to configure the client to connect to the ForeverVM MCP Server.
In your MCP client settings, configure the following:
npm
["--prefix", "<path/to/installation/directory>", "run", "start", "run"]
Replace <path/to/installation/directory>
with the actual path to where you've installed the ForeverVM MCP Server.
The ForeverVM MCP Server provides two main tools:
This tool initializes a new Python REPL environment.
Usage example:
# First, create a new REPL environment
repl_id = create_python_repl()
The tool returns an ID string that you'll use to reference this specific REPL in subsequent operations.
This tool executes Python code within a previously created REPL environment.
Required inputs:
code
(string): The Python code you want to executereplId
(string): The ID of the REPL environment (obtained from create-python-repl)Usage example:
# Run Python code in the created REPL
result = run_python_in_repl(
code="print('Hello, world!')\nx = 5 + 3\nprint(f'Result: {x}')",
replId=repl_id
)
Here's a complete example showing how to use the ForeverVM MCP Server to execute Python code:
# Step 1: Create a new Python REPL environment
repl_id = create_python_repl()
# Step 2: Run some initial setup code
setup_result = run_python_in_repl(
code="import numpy as np\nimport matplotlib.pyplot as plt",
replId=repl_id
)
# Step 3: Execute computation code
computation_result = run_python_in_repl(
code="""
data = np.random.randn(1000)
print(f"Mean: {data.mean():.2f}")
print(f"Standard deviation: {data.std():.2f}")
""",
replId=repl_id
)
# Step 4: Continue using the same environment with its state preserved
final_result = run_python_in_repl(
code="""
plt.hist(data, bins=30)
print("Histogram would be displayed in an interactive environment")
""",
replId=repl_id
)
Note that the state of the REPL is maintained between calls, allowing you to build upon previous code execution.
There are two ways to add an MCP server to Cursor. The most common way is to add the server globally in the ~/.cursor/mcp.json
file so that it is available in all of your projects.
If you only need the server in a single project, you can add it to the project instead by creating or adding it to the .cursor/mcp.json
file.
To add a global MCP server go to Cursor Settings > MCP and click "Add new global MCP server".
When you click that button the ~/.cursor/mcp.json
file will be opened and you can add your server like this:
{
"mcpServers": {
"cursor-rules-mcp": {
"command": "npx",
"args": [
"-y",
"cursor-rules-mcp"
]
}
}
}
To add an MCP server to a project you can create a new .cursor/mcp.json
file or add it to the existing one. This will look exactly the same as the global MCP server example above.
Once the server is installed, you might need to head back to Settings > MCP and click the refresh button.
The Cursor agent will then be able to see the available tools the added MCP server has available and will call them when it needs to.
You can also explictly ask the agent to use the tool by mentioning the tool name and describing what the function does.