Python REPL MCP Server
Servidor MCP de Python REPL
Este servidor MCP proporciona un REPL (bucle de lectura-evaluación-impresión) de Python como herramienta. Permite la ejecución de código Python mediante el protocolo MCP con una sesión persistente.
Configuración
¡No requiere configuración! El proyecto utiliza uv para la gestión de dependencias.
Related MCP server: Python REPL MCP Server
Ejecución del servidor
Simplemente ejecute:
uv run src/python_repl/server.pyUso con Claude Desktop
Agregue esta configuración a su archivo de configuración de Claude Desktop:
{
"mcpServers": {
"python-repl": {
"command": "uv",
"args": [
"--directory",
"/absolute/path/to/python-repl-server",
"run",
"mcp_python"
]
}
}
}El servidor proporciona tres herramientas:
execute_python: ejecuta código Python con variables persistentescode: El código Python a ejecutarreset: booleano opcional para restablecer la sesión
list_variables: Mostrar todas las variables en la sesión actualinstall_package: Instalar un paquete desde pypi
Ejemplos
Establecer una variable:
a = 42Utilice la variable:
print(f"The value is {a}")Enumere todas las variables:
# Use the list_variables toolRestablecer la sesión:
# Use execute_python with reset=trueContribuyendo
¡Agradecemos sus contribuciones! No dude en enviar una solicitud de incorporación de cambios. Aquí tiene algunas maneras de contribuir:
Informar errores
Sugerir nuevas funciones
Mejorar la documentación
Agregar casos de prueba
Enviar mejoras de código
Antes de enviar una solicitud de relaciones públicas, asegúrese de:
Su código sigue el estilo existente
Ha actualizado la documentación según sea necesario
¿Tal vez escribir algunas pruebas?
Para realizar cambios importantes, primero abra un problema para discutir lo que le gustaría cambiar.
Available Tools
3 toolsexecute_pythonA
Execute Python code and return the output. Variables persist between executions.
| Name | Required | Description | Default |
|---|---|---|---|
| code | Yes | Python code to execute | |
| reset | No | Reset the Python session (clear all variables) |
TDQS
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 key behavioral traits: execution of Python code, output return, and variable persistence. However, it lacks details on safety (e.g., sandboxing, timeout), error handling, or resource limits, which are important for a code execution tool. The description does not contradict any annotations.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is appropriately sized and front-loaded, consisting of two concise sentences that directly convey the core functionality and a key behavioral trait. Every sentence earns its place by providing essential information without redundancy or unnecessary details.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given the complexity of a code execution tool, no annotations, and no output schema, the description is incomplete. It covers the basic purpose and variable persistence but lacks details on output format, error responses, or execution environment. This leaves gaps for an AI agent to understand the full behavior and use cases effectively.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema description coverage is 100%, so the schema already documents both parameters ('code' and 'reset') with descriptions. The description adds no additional parameter semantics beyond what the schema provides, such as examples or constraints. With high schema coverage, the baseline score of 3 is appropriate.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the specific action ('Execute Python code') and the resource ('Python code'), with the additional detail that it 'return[s] the output'. It distinguishes from sibling tools by focusing on execution rather than package installation (install_package) or variable listing (list_variables).
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description provides clear context for usage by stating that 'Variables persist between executions', which implicitly suggests when to use this tool (for sequential code execution with shared state) versus alternatives like resetting the session. However, it does not explicitly name alternatives or state when-not to use it, such as for package management tasks handled by install_package.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
install_packageC
Install a Python package using uv
| Name | Required | Description | Default |
|---|---|---|---|
| package | Yes | Package name to install (e.g., 'pandas') |
TDQS
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 doesn't describe what happens during installation (e.g., dependencies resolved, package added to environment), potential side effects (e.g., system changes, conflicts), or error conditions. 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.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is a single, efficient sentence that directly states the tool's purpose without any wasted words. It's appropriately sized for a simple tool and front-loaded with the core action. Every part of the sentence earns its place by specifying what, how, and the tool used.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given the tool's complexity (a mutation operation with no annotations and no output schema), the description is incomplete. It doesn't explain what the tool returns (e.g., success/failure, installation details), behavioral traits, or usage context. For a package installation tool that modifies the environment, more information is needed to guide the agent effectively.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema description coverage is 100%, with the single parameter 'package' documented in the schema as 'Package name to install (e.g., 'pandas')'. The description adds no additional parameter information beyond what the schema provides. According to the rules, when schema coverage is high (>80%), the baseline is 3 even with no param info in the description, which applies here.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the action ('Install') and the resource ('a Python package'), and specifies the tool used ('using uv'). It distinguishes from sibling tools like 'execute_python' and 'list_variables' by focusing on package installation rather than code execution or variable listing. However, it doesn't explicitly differentiate from hypothetical similar tools (e.g., 'install_package_with_pip'), 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.
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., Python environment setup), when not to use it (e.g., for system packages), or compare to other installation methods. The agent must infer usage from the purpose alone, which is insufficient for optimal tool selection.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
list_variablesB
List all variables in the current session
| Name | Required | Description | Default |
|---|---|---|---|
No parameters | |||
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations provided, the description carries full burden but only states the action without behavioral details. It doesn't disclose if this is a read-only operation, what format the output takes (e.g., list of names vs. values), or any constraints like session dependencies. More context is needed for a mutation-aware agent.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is a single, clear sentence with no wasted words. It's front-loaded with the core action and scope, making it easy to parse quickly. Every part of the sentence contributes directly to understanding the tool's purpose.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given the tool's simplicity (0 parameters, no output schema, no annotations), the description is minimally adequate. It states what the tool does but lacks details on output format or behavioral context, which could be important for an agent. It meets basic needs but leaves gaps in completeness.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
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 add param info, aligning with the schema. A baseline of 4 is given as it handles the zero-param case correctly without redundancy.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
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 ('variables'), specifying scope ('in the current session'). It's specific enough to understand the action, though it doesn't explicitly differentiate from sibling tools like execute_python or install_package, which perform different functions.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
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 on prerequisites, such as whether a session must be active, or comparisons to other tools for variable management. It's a basic statement without usage instructions.
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.
3 tool updates
- First observed
execute_python - First observed
install_package - First observed
list_variables
TDQS
Each tool has a clearly distinct purpose with no overlap: execute_python runs code, install_package manages dependencies, and list_variables inspects the session state. An agent can easily tell them apart as they target different aspects of the Python REPL workflow.
All tools follow a consistent verb_noun pattern (execute_python, install_package, list_variables) with clear, descriptive names. The naming convention is uniform throughout the set, making it predictable and easy to understand.
With only 3 tools, the set feels thin for a Python REPL server, as it lacks operations like uninstalling packages, clearing variables, or handling errors. While the core functions are covered, the count is borderline low for the domain's typical scope.
The tools cover basic execution, package installation, and variable listing, but there are notable gaps: no way to update or remove packages, delete variables, or manage session state beyond listing. This could cause agent failures in more complex workflows.
Maintenance
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
A simple MCP server built with FastMCP and python
Personal assistant MCP server with search, execute, packages, jobs, secrets, and integrations.
A comprehensive Model Context Protocol (MCP) server that enables AI assistants to interact with yo…
Related MCP Servers
- FlicenseBqualityCmaintenanceA Python-based MCP server implementation that can be easily installed via pip or directly from GitHub, providing a simple way to deploy and run MCP server functionality.1-
- AlicenseNot gradedqualityDmaintenanceProvides a persistent Python REPL session as a tool for executing code, managing files, installing packages, and initializing projects via the MCP protocol.1MIT
- AlicenseAqualityDmaintenanceA production-grade MCP server providing a persistent Python REPL with multi-session support, sandboxing, and timeout protection, enabling LLM agents to execute Python code across multiple turns with variables that persist between calls.121MIT
- AlicenseNot gradedqualityDmaintenanceAsync Python REPL + Shell execution for MCP. Provides persistent state, background jobs, interactive input() bridging, and crash isolation in a single server.1Apache 2.0
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
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/hdresearch/mcp-python'
If you have feedback or need assistance with the MCP directory API, please join our Discord server