Skip to main content
Glama

MCP Python Interpreter

by yzfly

Server Configuration

Describes the environment variables required to run the server.

NameRequiredDescriptionDefault

No arguments

Schema

Prompts

Interactive templates invoked by user choice

NameDescription
python_function_templateGenerate a template for a Python function with docstring.
refactor_python_codeHelp refactor Python code for better readability and performance.
debug_python_errorHelp debug a Python error.

Resources

Contextual data attached and managed by the client

NameDescription
python://environments
python://file
python://directory

Tools

Functions exposed to the LLM to take actions

NameDescription
read_file
Read the content of any file, with size limits for safety. Args: file_path: Path to the file (relative to working directory or absolute) max_size_kb: Maximum file size to read in KB (default: 1024) Returns: str: File content or an error message
write_file
Write content to a file in the working directory or system-wide if allowed. Args: file_path: Path to the file to write (relative to working directory or absolute if system access is enabled) content: Content to write to the file overwrite: Whether to overwrite the file if it exists (default: False) encoding: File encoding (default: utf-8) Returns: str: Status message about the file writing operation
list_directory
List all Python files in a directory or subdirectory. Args: directory_path: Path to directory (relative to working directory or absolute, empty for working directory)
list_python_environments

List all available Python environments (system Python and conda environments).

list_installed_packages
List installed packages for a specific Python environment. Args: environment: Name of the Python environment (default: default if custom path provided, otherwise system)
run_python_code
Execute Python code and return the result. Code runs in the working directory. Args: code: Python code to execute environment: Name of the Python environment to use (default if custom path provided, otherwise system) save_as: Optional filename to save the code before execution (useful for future reference)
install_package
Install a Python package in the specified environment. Args: package_name: Name of the package to install environment: Name of the Python environment (default if custom path provided, otherwise system) upgrade: Whether to upgrade the package if already installed (default: False)
write_python_file
Write content to a Python file in the working directory or system-wide if allowed. Args: file_path: Path to the file to write (relative to working directory or absolute if system access is enabled) content: Content to write to the file overwrite: Whether to overwrite the file if it exists (default: False)
run_python_file
Execute a Python file and return the result. Args: file_path: Path to the Python file to execute (relative to working directory or absolute if system access is enabled) environment: Name of the Python environment to use (default if custom path provided, otherwise system) arguments: List of command-line arguments to pass to the script

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/yzfly/mcp-python-interpreter'

If you have feedback or need assistance with the MCP directory API, please join our Discord server