Skip to main content
Glama

Python REPL MCP Server

by hdresearch

Python REPL MCP 服务器

此 MCP 服务器提供了一个 Python REPL(读取-求值-打印循环)工具。它允许通过 MCP 协议以持久会话的方式执行 Python 代码。

设置

无需设置!该项目使用uv进行依赖管理。

运行服务器

只需运行:

uv run src/python_repl/server.py

与 Claude Desktop 一起使用

将此配置添加到您的 Claude Desktop 配置文件:

{ "mcpServers": { "python-repl": { "command": "uv", "args": [ "--directory", "/absolute/path/to/python-repl-server", "run", "mcp_python" ] } } }

该服务器提供了三种工具:

  1. execute_python带有持久变量的 Python 代码
    • code :要执行的 Python 代码
    • reset :可选布尔值,用于重置会话
  2. list_variables :显示当前会话中的所有变量
  3. install_package :从 pypi 安装包

示例

设置变量:

a = 42

使用变量:

print(f"The value is {a}")

列出所有变量:

# Use the list_variables tool

重置会话:

# Use execute_python with reset=true

贡献

欢迎贡献代码!欢迎提交 Pull 请求。以下是一些您可以贡献代码的方式:

  • 报告错误
  • 建议新功能
  • 改进文档
  • 添加测试用例
  • 提交代码改进

在提交 PR 之前,请确保:

  1. 您的代码遵循现有的风格
  2. 您已根据需要更新文档
  3. 也许写一些测试?

对于重大更改,请先打开一个问题来讨论您想要更改的内容。

Install Server
A
security – no known vulnerabilities
A
license - permissive license
A
quality - confirmed to work

local-only server

The server can only run on the client's local machine because it depends on local resources.

通过 MCP 协议提供持久 Python REPL 环境的服务器,允许执行 Python 代码、变量管理和包安装。

  1. 设置
    1. 运行服务器
      1. 与 Claude Desktop 一起使用
        1. 示例
          1. 贡献

            Related MCP Servers

            • -
              security
              F
              license
              -
              quality
              This is an MCP server that facilitates building tools for interacting with various APIs and workflows, supporting Python-based development with potential for customizable prompts and user configurations.
              Last updated -
              Python
            • -
              security
              F
              license
              -
              quality
              Provides an interactive Python REPL environment that maintains persistent session state, allowing users to execute Python code and access session history.
              Last updated -
              49
              Python
              • Apple
            • A
              security
              F
              license
              A
              quality
              An MCP server implementation that enables interaction with the Unstructured API, providing tools to list, create, update, and manage sources, destinations, and workflows.
              Last updated -
              39
              28
              • Apple
            • -
              security
              F
              license
              -
              quality
              A demonstration server showing MCP implementation in Python with resource handling, tool operations, and reusable prompts for a simple user/post system with local database.
              Last updated -
              Python
              • Apple
              • Linux

            View all related MCP servers

            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