ForeverVM MCP server

Enable long-running Python REPL execution on a remote machine
Back to servers
Provider
Jamsocket
Release date
Feb 25, 2025
Language
TypeScript
Package
Stats
1.3K downloads
185 stars

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.

Installation

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.

Using with Other MCP Clients

For other MCP clients besides Claude Desktop, you'll need to configure the client to connect to the ForeverVM MCP Server.

Configuration Settings

In your MCP client settings, configure the following:

  • Command: npm
  • Arguments:
["--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.

Available Tools

The ForeverVM MCP Server provides two main tools:

Create Python REPL

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.

Run Python in REPL

This tool executes Python code within a previously created REPL environment.

Required inputs:

  • code (string): The Python code you want to execute
  • replId (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
)

Complete Example Workflow

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.

How to add this MCP server to Cursor

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.

Adding an MCP server to Cursor globally

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"
            ]
        }
    }
}

Adding an MCP server to a project

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.

How to use the MCP server

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.

Want to 10x your AI skills?

Get a free account and learn to code + market your apps using AI (with or without vibes!).

Nah, maybe later