turhal-python-runner-mcp
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@turhal-python-runner-mcprun Python code to compute the sum of integers from 1 to 100"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Python Runner MCP Server (Turhal AI)
Python kodunu izole subprocess'lerde calistiran, stdio transport uzerinden
konusan, production-ready bir MCP (Model Context Protocol) sunucusu.
Python MCP SDK'nin FastMCP sinifi ile yazilmistir; Claude Desktop ve
OpenClaw Gateway ile dogrudan uyumludur.
Icerik
Dosya | Amac |
| MCP sunucusu ve |
| Python bagimliliklari |
| Sandboxlanmis calisma ortami (Python 3.12-slim, non-root) |
| Build context'ini kucultur |
| Build/manuel test icin (bkz. notlar) |
| OpenClaw Gateway / Claude Desktop icin ornek config |
Related MCP server: MCP Executor Server
Ozellikler
Izolasyon: Her
run_pythoncagrisi ayri bir OS process'inde calisir.Kaynak limitleri (Linux/macOS,
resource.setrlimitile):CPU suresi (
RUNNER_MAX_CPU_SECONDS)Bellek / adres alani (
RUNNER_MAX_MEMORY_MB)Process sayisi (
RUNNER_MAX_PROCESSES)Yazilabilir dosya boyutu (
RUNNER_MAX_FILE_SIZE_MB)Core dump kapali
Zaman asimi:
asyncio.wait_forile duvar-saati (wall clock) timeout; asilirsa processkill()edilir.Cikti limiti: stdout/stderr
RUNNER_MAX_OUTPUT_CHARSkarakterde kirpilir.Eszamanlilik kontrolu:
asyncio.Semaphoreile ayni anda calisan process sayisiRUNNER_MAX_CONCURRENTile sinirlanir; sunucu tek process icinde birden fazla istegi guvenle kuyruklar.Loglama: Tum loglar
stderr'e yazilir (stdout, MCP JSON-RPC protokolu icin ayrilmistir). Her istekrequest_idile izlenebilir.Hata yonetimi: Beklenen ve beklenmeyen tum hatalar yakalanip kullaniciya duzgun bicimlendirilmis metin olarak donulur; sunucu process'i asla cokmez.
Docker-native: Non-root kullanici, read-only dosya sistemi,
network: none,cap_drop: ALLile calisacak sekilde tasarlanmistir.
Guvenlik kapsami ve sinirlari (onemli)
resource.setrlimit ve subprocess izolasyonu, process-seviyesinde bir
koruma sağlar (kaçak bellek/CPU tüketimini, fork bombasını, zaman aşımını
önler). Bu, çalıştırılan kodun container dışına çıkmasını veya ağa
erişmesini engellemez.
Production'da tam izolasyon icin:
Bu sunucuyu mutlaka Docker container icinde,
docker-compose.yml/openclaw.gateway.example.jsonornegindeki gibi--network=none,--read-only,--cap-drop=ALLbayraklariyla calistirin.Daha yuksek guven seviyesi gerekiyorsa (coklu kiracili / multi-tenant sistemler),
gVisor,nsjailveyaFirecrackergibi bir OS-seviyesi sandbox katmani ekleyin - bu dosyalar bunu kolaylastiracak sekilde (ag kapali, salt-okunur FS, dusuk kaynak limitleri) hazirlanmistir ama bunlarin yerini tutmaz.Kod,
-I -Sbayraklariyla (izole mod, site-packages'siz) calistirilir; yine de guvenilmeyen kullanicilardan gelen kodu calistiriyorsaniz agi mutlaka kapali tutun.
Kurulum (yerel, container'siz)
python -m venv .venv
source .venv/bin/activate # Windows: .venv\Scripts\activate
pip install -r requirements.txt
python server.pySunucu stdio uzerinden calisir; dogrudan terminalden calistirdiginizda JSON-RPC mesaji bekleyerek beklemede kalir (bu normaldir - bir MCP istemcisi baglanmadan cikti gormezsiniz).
Docker ile calistirma
docker build -t turhal-ai/python-runner-mcp:latest .
docker run -i --rm \
--network=none \
--read-only \
--tmpfs /tmp:size=64m,mode=1777 \
--security-opt no-new-privileges:true \
--cap-drop=ALL \
--memory=512m --cpus=1.0 --pids-limit=64 \
turhal-ai/python-runner-mcp:latestVeya build/manuel test icin:
docker compose build
docker compose run --rm python-runner
docker compose upkullanmayin - MCP stdio, istemcinin container'idocker run -iile spawn edip stdin/stdout'a dogrudan baglanmasini gerektirir; arka planda calisan bir compose servisi bu modelle uyumlu degildir.docker-compose.ymlyalnizca build/test amaclidir.
Claude Desktop entegrasyonu
claude_desktop_config.json icine openclaw.gateway.example.json
dosyasindaki python-runner (yerel) veya python-runner-docker
(onerilen, sandboxlanmis) blogunu ekleyin ve yollari kendi ortaminiza gore
guncelleyin.
OpenClaw Gateway entegrasyonu
openclaw.gateway.example.json dosyasi, Gateway'in mcpServers bolumune
dogrudan tasinabilecek bicimde hazirlanmistir. Docker varyanti, agi kapali
ve read-only bir container icinde calisacagi icin production'da
onerilir.
Konfigurasyon (ortam degiskenleri)
Degisken | Varsayilan | Aciklama |
|
|
|
|
| Istemcinin isteyebilecegi ust timeout siniri |
|
| stdout/stderr icin karakter siniri |
|
| Subprocess bellek/adres alani siniri |
|
| Subprocess CPU suresi siniri |
|
| Subprocess'in acabilecegi max process sayisi |
|
| Subprocess'in yazabilecegi max dosya boyutu |
|
| Sunucu genelinde ayni anda calisan max istek |
|
|
|
run_python araci - kullanim
Girdi:
{
"code": "print(sum(range(10)))",
"timeout": 5
}Cikti (metin):
[request_id=a1b2c3d4]
--- stdout ---
45
--- exit_code: 0 | duration: 0.041s ---Zaman asimi, hata ve kirpilma durumlari da ayni bicimde, request_id ile
izlenebilir sekilde donulur; loglarda ayni request_id ile eslestirilebilir.
Test
python -c "
import asyncio
from server import _run_code_in_subprocess
async def main():
r = await _run_code_in_subprocess('print(1+1)', timeout=5, request_id='test')
print(r.to_text())
asyncio.run(main())
"This server cannot be installed
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 Servers
- Alicense-qualityDmaintenanceFacilitates isolated code execution within Docker containers, enabling secure multi-language script execution and integration with language models like Claude via the Model Context Protocol.5MIT
- Flicense-quality-maintenanceA secure server that enables code execution in isolated Docker environments, supporting Python with strict security constraints including network isolation, limited filesystem access, and resource limitations.
- AlicenseAqualityDmaintenanceExecutes Python code snippets safely without shell interpretation, supports parallel batch execution and helper utilities for task decomposition.2MIT
- Alicense-qualityDmaintenanceEnables LLMs to safely execute code in isolated Docker containers with resource limits and security controls, supporting session management and automatic dependency installation.MIT
Related MCP Connectors
Execute code in 8 languages (Python, JS, TS, Go, Java, C++, C, Bash) in gVisor sandboxes.
Proves AI-generated Python does what you asked: lint, types, security, sandbox run, exact fixes.
Execute PowerShell commands securely with controlled timeouts and input validation. Retrieve syste…
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/berkayturhal38-cloud/turhal-python-runner-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server