HM

hdresearch/mcp-python

效率工作流

本页由 AI 翻译,技术细节请以原文为准。 查看原文

43 stars 14 forks 质量 57 趋势 0MIT

hdresearch/mcp-python 是从 https://github.com/hdresearch/mcp-python. 导入的 MCP 服务器候选

概览

hdresearch/mcp-python 是从 https://github.com/hdresearch/mcp-python. 导入的 MCP 服务器候选

概述(AI 翻译)

该 MCP 服务器提供 Python REPL(读-评估-打印循环)作为工具。它允许通过 MCP 协议执行 Python 代码,并实现持久会话。

布置

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

运行服务器

只需运行:

使用 Claude Desktop

将此配置添加到您的Claude桌面配置文件中:

服务器提供三种工具:

  1. execute_python:执行带有持久变量的Python代码
  • code:用于执行的 Python 代码
  • reset:可选布尔值用于重置会话
  1. list_variables:显示当前会话中的所有变量

  2. install_package:从 pypi 安装一个包

示例

设置一个变量:

使用变量:

列出所有变量:

重置会话:

贡献

欢迎投稿!请随时提交拉取请求。以下是您可以贡献的一些方式:

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

提交永久居民申请前,请确保:

  1. 你的代码遵循现有的样式
  2. 你已经根据需要更新了文档
  3. 也许可以做些测试?

本页由 AI 翻译,技术细节请以原文为准。

README

Python REPL MCP Server

This MCP server provides a Python REPL (Read-Eval-Print Loop) as a tool. It allows execution of Python code through the MCP protocol with a persistent session.

Setup

No setup needed! The project uses uv for dependency management.

Running the Server

Simply run:

uv run src/python_repl/server.py

Usage with Claude Desktop

Add this configuration to your Claude Desktop config file:

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

The server provides three tools:

  1. execute_python: Execute Python code with persistent variables

    • code: The Python code to execute
    • reset: Optional boolean to reset the session
  2. list_variables: Show all variables in the current session

  3. install_package: Install a package from pypi

Examples

Set a variable:

a = 42

Use the variable:

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

List all variables:

# Use the list_variables tool

Reset the session:

# Use execute_python with reset=true

Contributing

Contributions are welcome! Please feel free to submit a Pull Request. Here are some ways you can contribute:

  • Report bugs
  • Suggest new features
  • Improve documentation
  • Add test cases
  • Submit code improvements

Before submitting a PR, please ensure:

  1. Your code follows the existing style
  2. You’ve updated documentation as needed
  3. Maybe write some tests?

For major changes, please open an issue first to discuss what you would like to change.

在 GitHub 查看完整 README

安装

This server does not publish a one-line install command.

Open the repository installation guide 新手?先看 mcpskill.org 教程 →

配置

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