Python MCP Server

Python MCP Server

python-mcp-server•bytimtech4u

An MCP server for running Python code and managing Python files and environments from LLM clients.

License: MIT•Runtime: Awaiting documentation review•Category: developer tools

WHAT IT DOES

  • •Executes Python code snippets or Python files with configurable timeout, arguments, and working directory.
  • •Lists, reads, and writes Python files.
  • •Reports the installed Python version and environment details.

BEST FOR

  • •Having an LLM run a Python snippet and return its output.
  • •Executing an existing Python script file on the host.
  • •Managing Python project files, such as listing, reading, and creating scripts.

ABOUT PYTHON-MCP-SERVER

Python MCP Server is cataloged as an MCP server attributed to timtech4u. An MCP server for running Python code and managing Python files and environments from LLM clients. It is categorized under developer tools. See the capability inspector for recorded interfaces and their independent review status; consult upstream documentation for the current interface.

HOW TO INSTALL

Installation configuration is not reviewed. No executable setup is offered for this entry; inspect the source repository before proceeding.

LICENSE

Catalog license label: MIT. Check the source repository's current license and terms before using, modifying or distributing this software.

能力检查器

能力定义尚未审核。未核验的采集内容不会作为可信接口展示。

Tools (0)

暂无可展示的已审核记录。这不表示上游不支持此能力。

Resources (0)

暂无可展示的已审核记录。这不表示上游不支持此能力。

Prompts (0)

暂无可展示的已审核记录。这不表示上游不支持此能力。

NEWSLETTER - COMING LATER

Newsletter subscriptions are not open yet

Email delivery is not connected. This page does not collect email addresses or create subscriptions.

Browse the registry for current listings instead.

Community Reviews

Coming later

Reviews for Python MCP Server are not available yet

Review publishing and storage are not connected. This page does not collect or publish ratings or comments, including after sign-in.

FREQUENTLY ASKED QUESTIONS

What happens if Python code runs longer than the timeout?

The default execution timeout is 30 seconds, after which the code is terminated; the timeout can be increased with the timeout parameter.

Can the server create directories when writing a Python file?

Yes, the write_python_file tool has a createDirs option that creates missing directories by default.

上游原版 README

在 GitHub 查看同一版本原文

README.md · 9a944fb4bea9 · 采集于 2026-11-13 10:52:58 UTC

保留上游原文,不做 AI 改写。为安全起见过滤脚本、表单和不安全链接。

当前显示最后一次成功采集的文档快照,请以来源页面为准。

Python MCP Server

A Model Context Protocol (MCP) server for executing Python code and managing Python environments. This server allows Claude and other LLMs to run Python code, manage files, and work with Python packages.

GitHub Repository

Features

  • Code Execution: Run Python code snippets or execute Python files
  • File Management: List, read, and write Python files
  • Python Environment: Check Python version and environment details
  • Configurable Execution: Set timeouts, working directories, and command-line arguments

Prerequisites

Before using this MCP server, ensure you have:

Installation

  1. Clone this repository:
git clone https://github.com/Timtech4u/python-mcp-server.git
cd python-mcp-server
  1. Install dependencies:
npm ci
  1. Build the project:
npm run build

Configuration

For Claude Desktop

  1. Open your Claude Desktop configuration file:

    • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
    • Windows: %APPDATA%\Claude\claude_desktop_config.json
  2. Add the Python MCP server configuration:

{
  "mcpServers": {
    "python": {
      "command": "node",
      "args": [
        "/absolute/path/to/python-mcp-server/dist/index.js"
      ],
      "disabled": false,
      "autoApprove": [
        "execute_python_code",
        "execute_python_file",
        "check_python_version",
        "list_python_files",
        "read_python_file",
        "write_python_file"
      ]
    }
  }
}
  1. Replace /absolute/path/to/python-mcp-server with the actual path where you cloned the repository.

  2. Restart Claude Desktop.

For Cline

  1. Open your Cline MCP settings file:

    • macOS: ~/Library/Application Support/Code/User/globalStorage/saoudrizwan.claude-dev/settings/cline_mcp_settings.json
    • Windows: %APPDATA%\Code\User\globalStorage\saoudrizwan.claude-dev\settings\cline_mcp_settings.json
  2. Add the Python MCP server configuration:

{
  "mcpServers": {
    "python": {
      "command": "node",
      "args": [
        "/absolute/path/to/python-mcp-server/dist/index.js"
      ],
      "disabled": false,
      "autoApprove": [
        "execute_python_code",
        "execute_python_file",
        "check_python_version",
        "list_python_files",
        "read_python_file",
        "write_python_file"
      ]
    }
  }
}
  1. Replace /absolute/path/to/python-mcp-server with the actual path where you cloned the repository.

  2. Restart Cline or reload the window.

How to Use

Once configured, you can ask Claude to run Python code in various ways. Here are some examples:

Execute Python Code

Can you run this Python code for me?

import random
numbers = [random.randint(1, 100) for _ in range(10)]
print(f"Random numbers: {numbers}")
print(f"Sum: {sum(numbers)}")
print(f"Average: {sum(numbers)/len(numbers)}")

Execute a Python File

Can you execute my Python file at /path/to/my_script.py?

List Python Files

Can you list all Python files in my /path/to/project directory?

Read a Python File

Can you show me the contents of /path/to/my_script.py?

Write a Python File

Can you create a Python file at /path/to/new_script.py with the following content?

def hello_world():
    print("Hello, world!")

if __name__ == "__main__":
    hello_world()

Check Python Version

What version of Python do I have installed?

Available Tools

execute_python_code

Executes Python code snippets.

Parameters:

  • code (string, required): The Python code to execute
  • timeout (number, optional): Maximum execution time in seconds (default: 30)
  • args (array of strings, optional): Command line arguments to pass to the script
  • workingDir (string, optional): Working directory for the script execution

execute_python_file

Executes a Python file.

Parameters:

  • filePath (string, required): Path to the Python file to execute
  • timeout (number, optional): Maximum execution time in seconds (default: 30)
  • args (array of strings, optional): Command line arguments to pass to the script
  • workingDir (string, optional): Working directory for the script execution

check_python_version

Returns information about the installed Python version.

list_python_files

Lists Python files in a directory.

Parameters:

  • dirPath (string, optional): Directory path to list Python files from (default: current directory)
  • recursive (boolean, optional): Whether to search recursively (default: false)

read_python_file

Reads the content of a Python file.

Parameters:

  • filePath (string, required): Path to the Python file to read

write_python_file

Writes content to a Python file.

Parameters:

  • filePath (string, required): Path to the Python file to write
  • content (string, required): Content to write to the file
  • createDirs (boolean, optional): Create directories if they do not exist (default: true)

Troubleshooting

Python Not Found

If you see an error like "Python is not installed", make sure Python is installed and available in your system PATH.

Permission Errors

If you encounter permission errors when reading or writing files, make sure the user running the MCP server has the necessary permissions.

Timeout Errors

The server has a default 30-second timeout for code execution. If your code takes longer than that, it will be terminated. You can increase the timeout by specifying the timeout parameter.

License

MIT

Verification

Use Node.js 22+ and a Python 3 executable on PATH:

npm ci
npm test
npm audit

The integration test starts the actual stdio server, negotiates an MCP session, checks tool discovery, executes Python, and verifies file read/write/list behavior inside a temporary directory. SDK and UUID versions are pinned in both dependency files; the UUID package now supplies its own TypeScript declarations.

Install configuration

Are you the maintainer?

Claim this server with your GitHub account to request manual ownership verification.

README Embed Badge
Markdown

Link to the catalog listing for Python MCP Server from your README. This badge does not certify ownership, compatibility or security.

[![MCP catalog listing](https://img.shields.io/badge/MCP-awesome--mcp-orange?style=flat-square)](https://awesome-mcp.com/servers/python-mcp-server)

REPOSITORY STATS

GitHub StarsUnavailable
ForksUnavailable

Public repository statistics could not be verified. Check the configured source address; unavailable counts are not zero.

下载与拉取统计

来源、范围和时段分别列出;不相加,不代表安装人数、活跃用户或安全审核。

尚无已审核的包 / 镜像标识,暂不展示下载统计。

Related developer tools MCP Servers

Alternative and complementary servers in the same category

View all in developer tools →
Postbye
postbye-mcp•postbye-team

A directory listing describing a cancellation-letter and mailing-address service. The configured public GitHub repository returned 404 during source verification.

Repository stats unavailable
Developer Tools
Singapore Proxy MCP
singapore-proxy-mcp•Xavierfok

A hosted MCP service for browsing and searching through Singapore mobile-network proxies.

0
Developer Tools

A directory listing describing a Markdown-to-PDF service. The configured public GitHub repository returned 404 during source verification.

Repository stats unavailable
Developer Tools