Skip to content

smithery-ai/PyForge-IDE

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

1 Commit
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

PyForge IDE MCP Server

A powerful MCP (Model Context Protocol) server that provides Python code execution, file management, and package installation capabilities in a sandboxed environment.

Features

  • 🐍 Python Code Execution: Execute Python code in a sandboxed environment
  • πŸ“ Virtual File System: Create, read, list, and delete files
  • πŸ“¦ Package Management: Install Python packages using pip
  • πŸ”§ Debug Support: Enable debug logging for troubleshooting
  • 🌐 HTTP Transport: Easy integration with MCP clients
  • πŸ“Š Resources: Access file system state and Python environment info

Requirements

  • Node.js >= 18
  • Python 3 (for code execution features)
  • Internet connection (for package installation)

Installation

# Clone the repository
git clone <repository-url>
cd pyforge-ide-mcp-server

# Install dependencies
npm install

# Start development server
npm run dev

Usage

Development

# Start the development server
npm run dev

# Build for production
npm run build

# Clean build artifacts
npm run clean

MCP Tools

The server provides the following tools:

1. python_execute

Execute Python code in a sandboxed environment.

Parameters:

  • code (string, required): Python code to execute
  • file_path (string, optional): File path to save and execute

Example:

{
  "code": "print('Hello from PyForge!')\nprint(2 + 2)",
  "file_path": "/hello.py"
}

2. file_create

Create a new file with content.

Parameters:

  • path (string, required): File path
  • content (string, optional): File content (defaults to empty)

Example:

{
  "path": "/script.py",
  "content": "print('Hello World')"
}

3. file_read

Read the contents of a file.

Parameters:

  • path (string, required): File path

Example:

{
  "path": "/script.py"
}

4. file_list

List files and directories in a path.

Parameters:

  • path (string, optional): Directory path (defaults to "/")

Example:

{
  "path": "/"
}

5. file_delete

Delete a file.

Parameters:

  • path (string, required): File path to delete

Example:

{
  "path": "/script.py"
}

6. package_install

Install a Python package using pip.

Parameters:

  • package (string, required): Package name to install

Example:

{
  "package": "requests"
}

Resources

1. filesystem-state

Current state of the virtual file system.

URI: file://pyforge-ide/filesystem

2. python-info

Information about the Python environment.

URI: info://pyforge-ide/python

Prompts

1. quick_start

Get started with PyForge IDE MCP server.

Configuration

The server supports the following configuration options:

  • debug (boolean, default: false): Enable debug logging
  • pythonVersion (string, default: "3.11"): Python version to use

Deployment

Smithery.ai Deployment

  1. Push your code to a GitHub repository
  2. Go to smithery.ai/new
  3. Click "Deploy" and follow the instructions

Local Development

# Start the server
npm run dev

# Server will be available at:
# Local: http://localhost:8081/mcp
# Remote: https://<random-id>.ngrok.smithery.ai/mcp
# Playground: https://smithery.ai/playground?mcp=<encoded-url>

Examples

Basic Python Execution

Use the python_execute tool to run this code:
print("Hello from PyForge IDE!")
import math
print(f"Square root of 16: {math.sqrt(16)}")

File Management

1. Create a Python file using file_create
2. Read it using file_read
3. Execute it using python_execute
4. List directory using file_list

Package Installation

Use the package_install tool to install:
- requests (for HTTP requests)
- numpy (for numerical operations)
- pandas (for data analysis)

Architecture

  • Virtual File System: Maintains an in-memory file system that syncs to temp directory for execution
  • Python Integration: Uses Node.js child_process to execute Python code
  • Error Handling: Comprehensive error handling with user-friendly messages
  • Resource Management: Provides access to system state and environment info

Security

  • Code execution happens in isolated temporary directories
  • File operations are sandboxed within the virtual file system
  • Timeouts prevent long-running processes
  • Error messages are sanitized

Troubleshooting

Python Not Found

If you see "Python is not available", ensure Python 3 is installed:

python3 --version
# or
python --version

Permission Issues

Make sure the temporary directory is writable and Python has execution permissions.

Network Issues

Package installation requires internet connectivity. Check your network connection if package installs fail.

Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Add tests
  5. Submit a pull request

License

MIT License - see LICENSE file for details.

Support


Built with ❀️ for the MCP community

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published