J

mcp-python-executor

...
Created 12/18/2024bybsmi021

Categories

claudemcpmcp-servermodelcontextprotocolpython

Language:

JavaScript

Stars:

0

Forks:

1

MCP Python Executor

A Model Context Protocol (MCP) server for executing Python code and managing Python packages.

Features

  • Execute Python code with safety constraints
  • Install and manage Python packages
  • Pre-configure commonly used packages
  • Resource monitoring and limits
  • Health checks and metrics
  • Structured logging

Configuration

The server can be configured through environment variables in the MCP settings:

{
  "mcpServers": {
    "mcp-python-executor": {
      "command": "node",
      "args": ["path/to/python-executor/build/index.js"],
      "env": {
        "PREINSTALLED_PACKAGES": "numpy pandas matplotlib scikit-learn",
        "MAX_MEMORY_MB": "512",
        "EXECUTION_TIMEOUT_MS": "30000",
        "MAX_CONCURRENT_EXECUTIONS": "5",
        "LOG_LEVEL": "info",
        "LOG_FORMAT": "json"
      }
    }
  }
}

Environment Variables

  • PREINSTALLED_PACKAGES: Space-separated list of Python packages to install on startup
  • MAX_MEMORY_MB: Maximum memory limit per execution (default: 512)
  • EXECUTION_TIMEOUT_MS: Maximum execution time in milliseconds (default: 30000)
  • MAX_CONCURRENT_EXECUTIONS: Maximum number of concurrent executions (default: 5)
  • LOG_LEVEL: Logging level (debug|info|error, default: info)
  • LOG_FORMAT: Log format (json|text, default: json)

Available Tools

1. execute_python

Execute Python code and return the results.

interface ExecutePythonArgs {
  code?: string;          // Python code to execute (inline)
  scriptPath?: string;    // Path to existing Python script file (alternative to code)
  inputData?: string[];   // Optional input data
}

Examples:

// Example with inline code
{
  "code": "print('Hello, World!!')\nfor i in range(3): print(i)",
  "inputData": ["optional", "input", "data"]
}

// Example with script path
{
  "scriptPath": "/path/to/your_script.py",
  "inputData": ["optional", "input", "data"]
}

2. install_packages

            Install Python packages.
interface InstallPackagesArgs {
  packages: string[];
}

Example:

Last updated: 2/28/2025

Publisher info

bsmi021's avatar

Brian W. Smith

Open Source and Integration enthusiast. Currently Senior Manager, Research & Development: Solutions Acceleration for SAS Institute.

SAS Institute
Greenville, SC
3
followers
16
following
57
repos

More MCP servers built with JavaScript

mcp-server-semgrep

MCP Server Semgrep is a [Model Context Protocol](https://modelcontextprotocol.io) compliant server that integrates the powerful Semgrep static analysis tool with AI assistants like Anthropic Claude. It enables advanced code analysis, security vulnerability detection, and code quality improvements directly through a conversational interface.

By Szowesgad9
protonmail-mcp

This MCP server provides email sending functionality using Protonmail's SMTP service. It allows both Claude Desktop and Cline VSCode extension to send emails on your behalf using your Protonmail credentials.

By amotivv6
agentql-mcp

Model Context Protocol server that integrates AgentQL's data extraction capabilities.

By tinyfish-io45