Skip to main content
Glama
yzfly

MCP Python Interpreter

by yzfly

MCP Python Interpreter

A Model Context Protocol (MCP) server that allows LLMs to interact with Python environments, read and write files, execute Python code, and manage development workflows.

Features

  • Environment Management: List and use different Python environments (system and conda)

  • Code Execution: Run Python code or scripts in any available environment

  • Package Management: List installed packages and install new ones

  • File Operations:

    • Read files of any type (text, source code, binary)

    • Write text and binary files

  • Python Prompts: Templates for common Python tasks like function creation and debugging

Related MCP server: MCP Python Toolbox

Installation

You can install the MCP Python Interpreter using pip:

pip install mcp-python-interpreter

Or with uv:

uv install mcp-python-interpreter

Usage with Claude Desktop

  1. Install Claude Desktop

  2. Open Claude Desktop, click on menu, then Settings

  3. Go to Developer tab and click "Edit Config"

  4. Add the following to your claude_desktop_config.json:

{
  "mcpServers": {
    "mcp-python-interpreter": {
        "command": "uvx",
        "args": [
            "mcp-python-interpreter",
            "--dir",
            "/path/to/your/work/dir",
            "--python-path",
            "/path/to/your/python"
        ],
        "env": {
            "MCP_ALLOW_SYSTEM_ACCESS": 0
        },
    }
  }
}

For Windows:

{
  "mcpServers": {
    "python-interpreter": {
      "command": "uvx",
      "args": [
        "mcp-python-interpreter",
        "--dir",
        "C:\\path\\to\\your\\working\\directory",
        "--python-path",
        "/path/to/your/python"
      ],
        "env": {
            "MCP_ALLOW_SYSTEM_ACCESS": "0"
        },
    }
  }
}
  1. Restart Claude Desktop

  2. You should now see the MCP tools icon in the chat interface

The --dir parameter is required and specifies where all files will be saved and executed. This helps maintain security by isolating the MCP server to a specific directory.

Prerequisites

  • Make sure you have uv installed. If not, install it using:

    curl -LsSf https://astral.sh/uv/install.sh | sh
  • For Windows:

    powershell -ExecutionPolicy Bypass -Command "iwr -useb https://astral.sh/uv/install.ps1 | iex"

Available Tools

The Python Interpreter provides the following tools:

Environment and Package Management

  • list_python_environments: List all available Python environments (system and conda)

  • list_installed_packages: List packages installed in a specific environment

  • install_package: Install a Python package in a specific environment

Code Execution

  • run_python_code: Execute Python code in a specific environment

  • run_python_file: Execute a Python file in a specific environment

File Operations

  • read_file: Read contents of any file type, with size and safety limits

    • Supports text files with syntax highlighting

    • Displays hex representation for binary files

  • write_file: Create or overwrite files with text or binary content

  • write_python_file: Create or overwrite a Python file specifically

  • list_directory: List Python files in a directory

Available Resources

  • python://environments: List all available Python environments

  • python://packages/{env_name}: List installed packages for a specific environment

  • python://file/{file_path}: Get the content of a Python file

  • python://directory/{directory_path}: List all Python files in a directory

Prompts

  • python_function_template: Generate a template for a Python function

  • refactor_python_code: Help refactor Python code

  • debug_python_error: Help debug a Python error

Example Usage

Here are some examples of what you can ask Claude to do with this MCP server:

  • "Show me all available Python environments on my system"

  • "Run this Python code in my conda-base environment: print('Hello, world!')"

  • "Create a new Python file called 'hello.py' with a function that says hello"

  • "Read the contents of my 'data.json' file"

  • "Write a new configuration file with these settings..."

  • "List all packages installed in my system Python environment"

  • "Install the requests package in my system Python environment"

  • "Run data_analysis.py with these arguments: --input=data.csv --output=results.csv"

File Handling Capabilities

The MCP Python Interpreter now supports comprehensive file operations:

  • Read text and binary files up to 1MB

  • Write text and binary files

  • Syntax highlighting for source code files

  • Hex representation for binary files

  • Strict file path security (only within the working directory)

Security Considerations

This MCP server has access to your Python environments and file system. Key security features include:

  • Isolated working directory

  • File size limits

  • Prevented writes outside the working directory

  • Explicit overwrite protection

Always be cautious about running code or file operations that you don't fully understand.

License

MIT

Available Tools

10 tools
clear_sessionC
Clear a REPL session's state and history.

Args:
    session_id: Session ID to clear
ParametersJSON Schema
NameRequiredDescriptionDefault
session_idNodefault

Output Schema

ParametersJSON Schema
NameRequiredDescription
resultYes

TDQS

C2.9/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden of behavioral disclosure. It states the tool clears 'state and history,' implying a destructive operation, but doesn't specify whether this is irreversible, what 'state' includes (e.g., variables, outputs), or if it affects other sessions. For a mutation tool with zero annotation coverage, this is a significant gap in transparency.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is appropriately sized and front-loaded, with the core purpose stated first ('Clear a REPL session's state and history.') and parameter details following. It avoids unnecessary elaboration, but the 'Args' section could be more integrated. Overall, it's efficient with minimal waste.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's complexity (destructive operation with one parameter), no annotations, and an output schema (which reduces need to explain returns), the description is partially complete. It covers the basic action and parameter, but lacks critical context like irreversible effects, session existence checks, or error handling. For a mutation tool, this is a moderate gap in completeness.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The description adds minimal parameter semantics beyond the input schema. It includes an 'Args' section listing 'session_id: Session ID to clear,' which provides basic meaning (identifying which session to clear). However, with 0% schema description coverage and only one parameter, this is adequate but not detailed (e.g., no format or default value explanation). The baseline is 4 for 0 parameters, but here it's 3 due to the single parameter being partially documented.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose with a specific verb ('clear') and resource ('a REPL session's state and history'). It distinguishes the tool from siblings like 'list_sessions' or 'run_python_code' by focusing on cleanup rather than listing or execution. However, it doesn't explicitly differentiate from all siblings (e.g., it's clear but not maximally specific about sibling relationships).

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention prerequisites (e.g., whether a session must exist), exclusions (e.g., not for active sessions), or suggest alternatives among siblings like 'list_sessions' for checking sessions first. The tool's purpose is clear, but usage context is missing.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

install_packageB
Install a Python package in the specified environment.

Args:
    package_name: Name of the package to install
    environment: Name of the Python environment
    upgrade: Whether to upgrade if already installed
    timeout: Maximum execution time in seconds
ParametersJSON Schema
NameRequiredDescriptionDefault
package_nameYes
environmentNodefault
upgradeNo
timeoutNo

Output Schema

ParametersJSON Schema
NameRequiredDescription
resultYes

TDQS

B3.1/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden of behavioral disclosure. It states the action ('install') but lacks details on permissions required, side effects (e.g., modifies environment state), error handling (e.g., what happens if package not found), or output format. For a mutation tool with zero annotation coverage, this is a significant gap in transparency.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is well-structured and concise: a clear purpose statement followed by a bullet-point list of parameters. Every sentence earns its place by directly explaining the tool or its inputs, with no redundant or vague language. It's front-loaded with the core action, making it easy to scan.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the complexity (a mutation tool with 4 parameters) and no annotations, the description is moderately complete. It covers the purpose and parameters but lacks behavioral details (e.g., side effects, errors) and usage context. The presence of an output schema (not detailed here) might help with return values, but overall, it's adequate with clear gaps for safe tool invocation.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The description lists all four parameters with brief explanations, but schema description coverage is 0%, meaning the schema provides no descriptions. The description adds basic semantics (e.g., 'Name of the package to install'), but it doesn't elaborate on constraints (e.g., package naming conventions) or dependencies (e.g., environment must be valid). This compensates partially but not fully for the schema gap.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose: 'Install a Python package in the specified environment.' It specifies the verb ('install') and resource ('Python package'), making the action unambiguous. However, it doesn't explicitly differentiate from sibling tools like 'list_installed_packages' or 'run_python_code', which would require more specific context about when to use installation versus other package-related operations.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention prerequisites (e.g., environment must exist), exclusions (e.g., not for system-wide installation), or comparisons to siblings like 'run_python_code' for testing packages. Without such context, an agent might misuse it in scenarios better handled by other tools.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

list_directoryB
List all Python files in a directory.

Args:
    directory_path: Path to directory (empty for working directory)
ParametersJSON Schema
NameRequiredDescriptionDefault
directory_pathNo

Output Schema

ParametersJSON Schema
NameRequiredDescription
resultYes

TDQS

B3.2/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries full burden. It states what the tool does but lacks behavioral details: it doesn't specify if this is a read-only operation, what happens with invalid paths, whether it recursively searches subdirectories, what format the output takes (e.g., list of filenames, full paths), or any error conditions. The description is minimal and doesn't disclose important operational traits.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is extremely concise and well-structured: a clear purpose statement followed by a brief parameter explanation. Every sentence earns its place, with no redundant information. It's front-loaded with the core functionality, making it easy to scan and understand quickly.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given that there's an output schema (which presumably describes the return format), the description doesn't need to explain return values. However, for a tool with no annotations and only basic parameter documentation, the description is somewhat incomplete: it doesn't address error handling, recursion behavior, or file filtering details beyond 'Python files'. It's minimally adequate but leaves gaps in understanding the tool's full behavior.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The description adds meaningful context for the single parameter: it explains that directory_path is 'Path to directory (empty for working directory)', which clarifies the default behavior when the parameter is omitted. Since schema description coverage is 0% and there's only one parameter, this compensates well. However, it doesn't detail path format requirements (e.g., absolute vs. relative) or validation rules.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states 'List all Python files in a directory' which specifies the verb (list), resource (Python files), and scope (directory). It distinguishes from siblings like list_installed_packages or list_sessions by focusing specifically on Python files in a filesystem directory. However, it doesn't explicitly contrast with all siblings, so it's not a perfect 5.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention when to choose list_directory over other file-related tools like read_file or run_python_file, nor does it specify prerequisites or exclusions. The only contextual hint is the sibling list, but the description itself offers no usage instructions.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

list_installed_packagesC
List installed packages for a specific Python environment.

Args:
    environment: Name of the Python environment
ParametersJSON Schema
NameRequiredDescriptionDefault
environmentNodefault

Output Schema

ParametersJSON Schema
NameRequiredDescription
resultYes

TDQS

C2.9/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure. It states it's a listing operation, implying read-only behavior, but doesn't disclose any behavioral traits such as output format, pagination, error handling, or whether it requires specific permissions. The description is minimal and lacks context beyond the basic action.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is concise and front-loaded with the main purpose in the first sentence, followed by parameter details. There's no wasted text, and it's appropriately sized for a simple tool. However, it could be slightly more structured with clearer separation of sections.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool has an output schema (which handles return values), no annotations, and low complexity, the description is somewhat complete but lacks context. It covers the basic purpose and parameter, but doesn't provide usage guidelines or behavioral details, leaving gaps for an AI agent to infer correct invocation.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The schema description coverage is 0%, but the description includes an 'Args' section that explains the 'environment' parameter as 'Name of the Python environment'. This adds meaning beyond the schema's title 'Environment' and default value 'default'. However, it doesn't provide additional details like valid environment names or examples, and there's only one parameter, so the baseline is 4, but the limited info reduces it to 3.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose with a specific verb ('List') and resource ('installed packages'), and specifies the target ('for a specific Python environment'). However, it doesn't distinguish this tool from its sibling 'list_python_environments', which could be a related listing operation.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives like 'list_python_environments' (which lists environments rather than packages) or 'list_directory' (which might list files). There's no mention of prerequisites, typical use cases, or when not to use it.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

list_python_environmentsB

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

ParametersJSON Schema
NameRequiredDescriptionDefault

No parameters

Output Schema

ParametersJSON Schema
NameRequiredDescription
resultYes

TDQS

B3.2/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure. It states what the tool does but doesn't describe behavioral traits such as whether it requires specific permissions, how it handles errors, what the output format looks like, or if there are any rate limits. This leaves significant gaps for a tool that interacts with system environments.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence that front-loads the core purpose without any wasted words. It directly states the action and scope, making it easy to parse and understand quickly.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool has 0 parameters, 100% schema coverage, and an output schema exists, the description is minimally adequate. However, as a tool that lists system-level resources with no annotations, it should ideally provide more context about output structure or usage constraints to be fully complete for an AI agent.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The tool has 0 parameters, and schema description coverage is 100%, so no parameter documentation is needed. The description appropriately doesn't discuss parameters, earning a baseline score of 4 for not adding unnecessary information.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the verb ('List') and resource ('Python environments'), specifying both system Python and conda environments. It distinguishes from some siblings like list_directory or list_sessions by focusing on Python environments specifically, though it doesn't explicitly differentiate from all potential alternatives.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention prerequisites, context for usage, or compare with siblings like list_installed_packages or list_sessions, leaving the agent to infer usage scenarios independently.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

list_sessionsB

List all active REPL sessions.

ParametersJSON Schema
NameRequiredDescriptionDefault

No parameters

Output Schema

ParametersJSON Schema
NameRequiredDescription
resultYes

TDQS

B3.2/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden. It states the tool lists active sessions but doesn't disclose behavioral traits such as whether it requires permissions, how it handles errors, what the output format is, or if there are rate limits. This is a significant gap for a tool with no annotation coverage.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence with zero waste. It's front-loaded with the core action and resource, making it easy to parse quickly.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool has 0 parameters, 100% schema coverage, and an output schema exists, the description is minimally adequate. However, with no annotations and a simple purpose, it lacks context on usage scenarios or behavioral details, making it just sufficient but with clear gaps.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The tool has 0 parameters with 100% schema description coverage, so the schema fully documents the lack of inputs. The description doesn't need to add parameter details, and it correctly implies no inputs are required, earning a baseline score above 3 for adequate coverage.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the verb ('List') and resource ('all active REPL sessions'), making the purpose specific and understandable. However, it doesn't explicitly differentiate from sibling tools like 'list_directory' or 'list_installed_packages' beyond the resource type, which prevents a perfect score.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention prerequisites, context, or exclusions, leaving the agent to infer usage based on the tool name alone.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

read_fileA
Read the content of any file, with size limits for safety.

Args:
    file_path: Path to the file
    max_size_kb: Maximum file size to read in KB
ParametersJSON Schema
NameRequiredDescriptionDefault
file_pathYes
max_size_kbNo

Output Schema

ParametersJSON Schema
NameRequiredDescription
resultYes

TDQS

A3.6/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure. It adds context about 'size limits for safety', which is useful for understanding constraints, but it doesn't cover other behavioral traits such as error handling, permissions required, or what happens with large files beyond the limit. This leaves gaps in transparency.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is appropriately sized and front-loaded with the core purpose in the first sentence, followed by parameter details. Every sentence adds value, but the structure could be slightly improved by integrating the parameter explanations more seamlessly rather than as a separate 'Args' section, though this is minor.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's moderate complexity (2 parameters, no annotations, but with an output schema), the description is mostly complete. It covers the purpose and parameters, and since an output schema exists, it doesn't need to explain return values. However, it lacks details on error cases or performance, which could enhance completeness for a file-reading tool.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The schema description coverage is 0%, so the description must compensate. It adds meaning by explaining 'file_path' as 'Path to the file' and 'max_size_kb' as 'Maximum file size to read in KB', which clarifies the parameters beyond the schema's basic titles. However, it doesn't detail format specifics (e.g., absolute vs. relative paths) or default behavior, keeping it from a perfect score.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose as 'Read the content of any file' with a specific verb ('Read') and resource ('file'), making it immediately understandable. However, it doesn't explicitly differentiate from sibling tools like 'list_directory' or 'run_python_file', which prevents a perfect score.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies usage by mentioning 'size limits for safety', suggesting it's for reading files within safe bounds, but it doesn't provide explicit guidance on when to use this tool versus alternatives like 'list_directory' for file metadata or 'run_python_file' for executing code. No exclusions or clear alternatives are stated.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

run_python_codeA
Execute Python code with flexible execution modes.

Args:
    code: Python code to execute
    execution_mode: Execution mode - "inline" (default, fast, in-process) or "subprocess" (isolated)
    session_id: Session ID for inline mode to maintain state across executions
    environment: Python environment name (only for subprocess mode)
    save_as: Optional filename to save the code before execution
    timeout: Maximum execution time in seconds (only enforced for subprocess mode)

Returns:
    Execution result with output

Execution modes:
- "inline" (default): Executes code in the current process. Fast and reliable,
  maintains session state. Use for most code execution tasks.
- "subprocess": Executes code in a separate Python process. Use when you need
  environment isolation or a different Python environment.
ParametersJSON Schema
NameRequiredDescriptionDefault
codeYes
execution_modeNoinline
session_idNodefault
environmentNosystem
save_asNo
timeoutNo

Output Schema

ParametersJSON Schema
NameRequiredDescription
resultYes

TDQS

A4.6/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure. It effectively describes key traits: execution modes with their characteristics (speed, isolation, state persistence), timeout enforcement specifics, and session state maintenance. However, it doesn't mention security implications, error handling, or resource limits.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is well-structured with clear sections (Args, Returns, Execution modes) and front-loaded purpose. Most sentences earn their place by providing essential information, though the execution mode explanations could be slightly more concise.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's complexity (code execution with multiple modes), no annotations, and an output schema (which handles return values), the description is largely complete. It covers parameters, execution behavior, and usage guidelines well, though could benefit from mentioning security considerations or error scenarios.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters5/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 0%, so the description must fully compensate. It provides detailed semantics for all 6 parameters: explains what each parameter does, clarifies which parameters apply to which execution modes, and provides default values and constraints. This adds significant value beyond the bare schema.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose with a specific verb ('Execute') and resource ('Python code'), distinguishing it from siblings like 'run_python_file' (which executes files) and 'clear_session' (which manages sessions). It specifies flexible execution modes, making the scope explicit.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides explicit guidance on when to use each execution mode: 'inline' for most tasks (fast, maintains state) and 'subprocess' for environment isolation or different Python environments. It also distinguishes from siblings by focusing on code execution rather than file operations or session management.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

run_python_fileB
Execute a Python file (always uses subprocess for file execution).

Args:
    file_path: Path to the Python file to execute
    environment: Name of the Python environment to use
    arguments: List of command-line arguments to pass to the script
    timeout: Maximum execution time in seconds (default: 300)
ParametersJSON Schema
NameRequiredDescriptionDefault
file_pathYes
environmentNodefault
argumentsNo
timeoutNo

Output Schema

ParametersJSON Schema
NameRequiredDescription
resultYes

TDQS

B3.3/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden. It discloses the execution method (subprocess) and mentions a default timeout, but doesn't cover critical behaviors like error handling (e.g., what happens if the file doesn't exist or execution fails), output capture (e.g., stdout/stderr return), security implications, or resource usage. This is inadequate for a tool that executes arbitrary code.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is well-structured with a clear purpose statement followed by a bullet-point-like Args section. Each sentence adds value, and there's no redundancy. However, the Args formatting could be more integrated, and it's slightly verbose for a tool with only 4 parameters.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the complexity (executing arbitrary Python files), lack of annotations, and presence of an output schema, the description is moderately complete. It covers parameters adequately but lacks behavioral details like error handling or security warnings. The output schema may help with return values, but the description doesn't reference it, leaving gaps in understanding the tool's full impact.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 0%, so the description must compensate. It adds meaningful context for all 4 parameters: file_path specifies it's the 'Python file to execute,' environment indicates the 'Python environment to use,' arguments are 'command-line arguments to pass to the script,' and timeout defines 'maximum execution time in seconds' with a default. This goes beyond the schema's basic titles, though it could elaborate on format (e.g., path requirements).

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose as 'Execute a Python file' with the specific implementation detail 'always uses subprocess for file execution.' This distinguishes it from sibling tools like run_python_code (which executes code directly) and read_file (which only reads). However, it doesn't explicitly contrast with all siblings like install_package or list_directory.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies usage by specifying it executes files via subprocess, suggesting it's for running complete Python scripts rather than inline code. However, it lacks explicit guidance on when to use this versus alternatives like run_python_code, and doesn't mention prerequisites (e.g., file must exist) or exclusions (e.g., not for interactive scripts).

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

write_fileB
Write content to a file.

Args:
    file_path: Path to the file to write
    content: Content to write
    overwrite: Whether to overwrite if exists
ParametersJSON Schema
NameRequiredDescriptionDefault
file_pathYes
contentYes
overwriteNo

Output Schema

ParametersJSON Schema
NameRequiredDescription
resultYes

TDQS

B3.1/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure. It mentions 'overwrite' behavior, which is useful, but fails to cover critical aspects like error handling (e.g., if the file path is invalid or permissions are insufficient), side effects, or response format details.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is appropriately sized and front-loaded with the core purpose, followed by a structured Args list. Every sentence adds value, but the formatting could be slightly more polished for readability.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's complexity (a write operation with 3 parameters) and no annotations, the description is moderately complete. It covers parameters well and an output schema exists, but it lacks behavioral context like error cases or system dependencies, leaving gaps for safe usage.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 0%, so the description must compensate. It provides clear semantics for all three parameters ('file_path', 'content', 'overwrite') in the Args section, adding meaningful context beyond the bare schema, though it could include more details like path format or content encoding.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose with 'Write content to a file', specifying the verb 'write' and resource 'file'. However, it doesn't explicitly differentiate from sibling tools like 'read_file', though the action is distinct by nature.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance is provided on when to use this tool versus alternatives. The description lacks context about prerequisites, such as file permissions or system constraints, and doesn't mention sibling tools like 'read_file' for comparison.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections. Dates show when Glama detected each change.

  1. 11 tool updatesv1.0.0
    • Addedclear_session
    • Changedinstall_package2 fields changed
      • addedInput schema / properties / timeout
        Added value: +{
        +  "default": 300,
        +  "title": "Timeout",
        +  "type": "integer"
        +}
      • changedOutput schema / (root)
        Previous value: -nullNew value: +{
        +  "properties": {
        +    "result": {
        +      "title": "Result",
        +      "type": "string"
        +    }
        +  },
        +  "required": [
        +    "result"
        +  ],
        +  "title": "install_packageOutput",
        +  "type": "object"
        +}
    • Changedlist_directory1 field changed
      • changedOutput schema / (root)
        Previous value: -nullNew value: +{
        +  "properties": {
        +    "result": {
        +      "title": "Result",
        +      "type": "string"
        +    }
        +  },
        +  "required": [
        +    "result"
        +  ],
        +  "title": "list_directoryOutput",
        +  "type": "object"
        +}
    • Changedlist_installed_packages1 field changed
      • changedOutput schema / (root)
        Previous value: -nullNew value: +{
        +  "properties": {
        +    "result": {
        +      "title": "Result",
        +      "type": "string"
        +    }
        +  },
        +  "required": [
        +    "result"
        +  ],
        +  "title": "list_installed_packagesOutput",
        +  "type": "object"
        +}
    • Changedlist_python_environments1 field changed
      • changedOutput schema / (root)
        Previous value: -nullNew value: +{
        +  "properties": {
        +    "result": {
        +      "title": "Result",
        +      "type": "string"
        +    }
        +  },
        +  "required": [
        +    "result"
        +  ],
        +  "title": "list_python_environmentsOutput",
        +  "type": "object"
        +}
    • Addedlist_sessions
    • Changedread_file1 field changed
      • changedOutput schema / (root)
        Previous value: -nullNew value: +{
        +  "properties": {
        +    "result": {
        +      "title": "Result",
        +      "type": "string"
        +    }
        +  },
        +  "required": [
        +    "result"
        +  ],
        +  "title": "read_fileOutput",
        +  "type": "object"
        +}
    • Changedrun_python_code5 fields changed
      • changedInput schema / properties / environment / default
        Previous value: -"default"New value: +"system"
      • addedInput schema / properties / execution_mode
        Added value: +{
        +  "default": "inline",
        +  "title": "Execution Mode",
        +  "type": "string"
        +}
      • addedInput schema / properties / session_id
        Added value: +{
        +  "default": "default",
        +  "title": "Session Id",
        +  "type": "string"
        +}
      • addedInput schema / properties / timeout
        Added value: +{
        +  "default": 300,
        +  "title": "Timeout",
        +  "type": "integer"
        +}
      • changedOutput schema / (root)
        Previous value: -nullNew value: +{
        +  "properties": {
        +    "result": {
        +      "title": "Result",
        +      "type": "string"
        +    }
        +  },
        +  "required": [
        +    "result"
        +  ],
        +  "title": "run_python_codeOutput",
        +  "type": "object"
        +}
    • Changedrun_python_file2 fields changed
      • addedInput schema / properties / timeout
        Added value: +{
        +  "default": 300,
        +  "title": "Timeout",
        +  "type": "integer"
        +}
      • changedOutput schema / (root)
        Previous value: -nullNew value: +{
        +  "properties": {
        +    "result": {
        +      "title": "Result",
        +      "type": "string"
        +    }
        +  },
        +  "required": [
        +    "result"
        +  ],
        +  "title": "run_python_fileOutput",
        +  "type": "object"
        +}
    • Changedwrite_file2 fields changed
      • removedInput schema / properties / encoding
        Removed value: -{
        -  "default": "utf-8",
        -  "title": "Encoding",
        -  "type": "string"
        -}
      • changedOutput schema / (root)
        Previous value: -nullNew value: +{
        +  "properties": {
        +    "result": {
        +      "title": "Result",
        +      "type": "string"
        +    }
        +  },
        +  "required": [
        +    "result"
        +  ],
        +  "title": "write_fileOutput",
        +  "type": "object"
        +}
    • Removedwrite_python_file
  2. 9 tool updates
    • First observedinstall_package
    • First observedlist_directory
    • First observedlist_installed_packages
    • First observedlist_python_environments
    • First observedread_file
    • First observedrun_python_code
    • First observedrun_python_file
    • First observedwrite_file
    • First observedwrite_python_file

TDQS

A3.5/5.0
Disambiguation4/5

Most tools have distinct purposes, but there is some overlap between run_python_code and run_python_file that could cause confusion. The descriptions clarify that run_python_code handles code strings with multiple execution modes, while run_python_file executes existing files via subprocess, but both essentially execute Python code. Other tools like list_directory, read_file, and write_file are clearly distinct.

Naming Consistency5/5

All tool names follow a consistent verb_noun pattern using snake_case, such as clear_session, install_package, list_directory, etc. There are no deviations in naming conventions, making the set predictable and easy to understand.

Tool Count5/5

With 10 tools, the count is well-scoped for a Python interpreter server. It covers key operations like code execution, file management, package installation, and session handling without being overwhelming or insufficient for the domain.

Completeness4/5

The tool set provides comprehensive coverage for Python development tasks, including code execution, file operations, package management, and session control. Minor gaps exist, such as no explicit tool for deleting files or uninstalling packages, but agents can work around these using existing tools like write_file with overwrite or other methods.

Maintenance

ActivityStale
ResponsivenessSyncing

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Connectors

Related MCP Servers

  • A
    license
    Not graded
    quality
    D
    maintenance
    A Model Context Protocol server that allows LLMs to execute shell commands and receive their output in a controlled manner.
    7
    MIT
  • A
    license
    Not graded
    quality
    C
    maintenance
    A Model Context Protocol server that enables AI assistants like Claude to perform Python development tasks through file operations, code analysis, project management, and safe code execution.
    9
    MIT
  • A
    license
    Not graded
    quality
    D
    maintenance
    A Model Context Protocol (MCP) server that allows AI models to safely access and interact with local file systems, enabling reading file contents, listing directories, and retrieving file metadata.
    19
    10
    MIT
  • -
    license
    A
    quality
    Not graded
    maintenance
    A Model Context Protocol server that allows LLMs to interact with Python environments, enabling code execution, file operations, package management, and development workflows.
    9
    -

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

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