mcp_python_exec_server

mcp_python_exec_server

Enables safe execution of Python code snippets within a sandboxed environment, restricting dangerous builtins and modules to prevent malicious operations.

Category
Visit Server

README

Python安全沙箱执行工具 (Python Safe Sandbox Execution Tool)

smithery badge

中文文档

功能描述

这是一个安全的Python代码执行工具,通过MCP服务器提供安全的执行环境。用户可以通过该工具执行Python代码片段,并获取执行结果。该工具禁用了危险的内置函数和模块,以防止恶意代码执行。

支持的标准库

  • math: 数学计算
  • statistics: 统计计算
  • decimal: 高精度小数
  • fractions: 分数运算
  • functools: 函数工具
  • random: 随机数生成
  • string: 字符串处理
  • time: 时间相关
  • datetime: 日期时间
  • json: JSON处理
  • re: 正则表达式

禁用功能

以下内置函数被禁用:

  • eval, exec, open, input, globals, locals
  • breakpoint, compile, delattr, setattr
  • exit, quit, help, memoryview, vars, dir

使用示例

调用该工具的MCP函数名为python_exec,参数为字符串类型的Python代码。

# 计算1+1
print(1+1)

返回结果:

输出:
2

如果定义了变量:

a = 10
b = 20
c = a + b
c

返回结果:

输出:
30

定义的变量/函数:
a = 10
b = 20
c = 30

注意事项

  1. 代码必须是字符串类型
  2. 代码不能为空
  3. 该工具不能执行文件操作、网络请求等危险操作
  4. 如果代码执行出错,将返回错误信息

Recommended Servers

playwright-mcp

playwright-mcp

A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.

Official
Featured
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.

Official
Featured
Local
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.

Official
Featured
Local
TypeScript
VeyraX MCP

VeyraX MCP

Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.

Official
Featured
Local
graphlit-mcp-server

graphlit-mcp-server

The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.

Official
Featured
TypeScript
Kagi MCP Server

Kagi MCP Server

An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.

Official
Featured
Python
E2B

E2B

Using MCP to run code via e2b.

Official
Featured
Neon Database

Neon Database

MCP server for interacting with Neon Management API and databases

Official
Featured
Exa Search

Exa Search

A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.

Official
Featured
Qdrant Server

Qdrant Server

This repository is an example of how to create a MCP server for Qdrant, a vector search engine.

Official
Featured