A powerful MCP (Model Context Protocol) server that provides Python code execution, file management, and package installation capabilities in a sandboxed environment.
- π 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
- Node.js >= 18
- Python 3 (for code execution features)
- Internet connection (for package installation)
# Clone the repository
git clone <repository-url>
cd pyforge-ide-mcp-server
# Install dependencies
npm install
# Start development server
npm run dev# Start the development server
npm run dev
# Build for production
npm run build
# Clean build artifacts
npm run cleanThe server provides the following tools:
Execute Python code in a sandboxed environment.
Parameters:
code(string, required): Python code to executefile_path(string, optional): File path to save and execute
Example:
{
"code": "print('Hello from PyForge!')\nprint(2 + 2)",
"file_path": "/hello.py"
}Create a new file with content.
Parameters:
path(string, required): File pathcontent(string, optional): File content (defaults to empty)
Example:
{
"path": "/script.py",
"content": "print('Hello World')"
}Read the contents of a file.
Parameters:
path(string, required): File path
Example:
{
"path": "/script.py"
}List files and directories in a path.
Parameters:
path(string, optional): Directory path (defaults to "/")
Example:
{
"path": "/"
}Delete a file.
Parameters:
path(string, required): File path to delete
Example:
{
"path": "/script.py"
}Install a Python package using pip.
Parameters:
package(string, required): Package name to install
Example:
{
"package": "requests"
}Current state of the virtual file system.
URI: file://pyforge-ide/filesystem
Information about the Python environment.
URI: info://pyforge-ide/python
Get started with PyForge IDE MCP server.
The server supports the following configuration options:
debug(boolean, default: false): Enable debug loggingpythonVersion(string, default: "3.11"): Python version to use
- Push your code to a GitHub repository
- Go to smithery.ai/new
- Click "Deploy" and follow the instructions
# 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>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)}")
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
Use the package_install tool to install:
- requests (for HTTP requests)
- numpy (for numerical operations)
- pandas (for data analysis)
- 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
- 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
If you see "Python is not available", ensure Python 3 is installed:
python3 --version
# or
python --versionMake sure the temporary directory is writable and Python has execution permissions.
Package installation requires internet connectivity. Check your network connection if package installs fail.
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests
- Submit a pull request
MIT License - see LICENSE file for details.
- Issues: GitHub Issues
- Documentation: Wiki
Built with β€οΈ for the MCP community