Skip to main content
Glama
luutuankiet

MCP Python Interpreter

by luutuankiet

Server Configuration

Describes the environment variables required to run the server.

NameRequiredDescriptionDefault
DIRYesRequired working directory for file operations (equivalent to --dir parameter).
PYTHON_PATHNoPath to a specific Python executable (optional, equivalent to --python-path parameter).
MCP_ALLOW_SYSTEM_ACCESSNoAllow access to system Python environments (0 or 1).0

Capabilities

Features and capabilities supported by this server

CapabilityDetails
tools
{
  "listChanged": false
}
prompts
{
  "listChanged": false
}
resources
{
  "subscribe": false,
  "listChanged": false
}
experimental
{}

Tools

Functions exposed to the LLM to take actions

NameDescription
read_fileA
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_fileB
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_directoryA
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_environmentsB

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

list_installed_packagesA
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_codeC
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_packageA
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_fileB
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_fileB
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

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

Latest Blog Posts

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/luutuankiet/mcp-python-interpreter'

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