csharp-runner

作者 sdcb已验证

fast, secure c# runner

109
Stars
18
Forks
C#
语言
2026/8/23
添加时间

⚠️ 第三方软件声明

本 Skill 为第三方开源软件,独立托管于 GitHub。SkillTip 仅为信息目录,不控制或维护底层仓库。所显示的安全检查为自动化且范围有限,安装前请自行审查源码。

阅读服务条款

安装

添加到你的 Claude Code skills 目录:

# Add to your Claude Code skills
git clone https://github.com/sdcb/csharp-runner

快速入门

使用 csharp-runner 等 Skills 的指南。

安全报告

已验证

上次扫描:—

{
  "status": "PASSED",
  "issues": []
}

README.md

🚀 C# Runner

.NET 10 Docker-Host Docker-Worker License

English | 中文

C# Runner is a high-performance and secure platform for executing C# code online. It's built on a Host-Worker architecture that isolates code execution in Docker containers and supports dual protocols: HTTP and MCP (Model Context Protocol).

✨ Core Features

  • 🔒 Secure & Reliable

    • Container Isolation: Untrusted code runs in isolated Docker Worker containers, ensuring host safety.
    • Resource Limits: Supports CPU, memory, and execution timeout limits to prevent resource abuse.
    • Network Isolation: Worker containers have restricted network access.
    • Worker Recycling: Automatically recycles a Worker instance after a configured number of runs to maintain a clean environment.
  • ⚡ High-Performance

    • Worker Warm-up: Pre-compiles code on startup to ensure optimal performance from the very first run.
    • Load Balancing: Distributes tasks among multiple Workers using a Round-Robin algorithm.
    • Connection Pooling: Reuses HttpClient instances to reduce network overhead.
  • 🌐 Rich Functionality

    • Dual Protocol Support: Offers both an HTTP REST API and an MCP interface.
    • Streaming Output: Streams code output, results, and errors in real-time using Server-Sent Events (SSE).
    • User-friendly Web UI: Features a clean code editor with syntax highlighting and Ctrl+Enter shortcut for execution.
    • Out-of-the-Box: Provides a complete Docker Compose solution for one-click deployment.

🚀 Quick Start

Prerequisites:

  • Docker and Docker Compose

One-Click Deploy with Docker Compose:

# Download the docker-compose.yml file
curl -L https://raw.githubusercontent.com/sdcb/csharp-runner/refs/heads/master/docker-compose.yml -o docker-compose.yml

# Start the services in detached mode
docker compose up -d

For Windows:

# Download the docker-compose.yml file
Invoke-WebRequest -Uri "https://raw.githubusercontent.com/sdcb/csharp-runner/refs/heads/master/docker-compose.yml" -OutFile "docker-compose.yml"

# Start the services in detached mode
docker compose -p csharp-runner up -d

Once deployed, open your browser to http://localhost:5050 to access the web UI.

🔧 Configuration

Docker Compose

The docker-compose.yml file defines the Host and Worker services. You can scale the number of Workers by changing deploy.replicas and configure Worker behavior via environment variables.

services:
  host:
    image: sdcb/csharp-runner-host:latest
    container_name: csharp-runner-host
    ports:
      - "5050:8080"
    restart: unless-stopped

  worker:
    image: sdcb/csharp-runner-worker:latest
    environment:
      - MaxRuns=2           # Max runs per worker (0=unlimited)
      - Register=true       # Auto-register to the Host
      - RegisterHostUrl=http://host:8080
      - WarmUp=false        # Enable warm-up (recommended for standalone deployment)
    restart: unless-stopped
    depends_on:
      - host
    deploy:
      replicas: 3
      resources:
        limits:
          cpus: 0.50
          memory: 256M
          pids: 32
        reservations:
          cpus: 0.25
          memory: 128M

Worker Environment Variables

ParameterDescriptionDefault
MaxRunsThe maximum number of times a Worker can execute code (0=unlimited).0
RegisterWhether to auto-register to the Host service.false
RegisterHostUrlThe registration URL of the Host service.http://host
ExposedUrlThe externally exposed URL of the Worker (optional).null
WarmUpWhether to perform a warm-up on startup.false
MaxTimeoutMaximum execution timeout in milliseconds.30000

📡 API Usage

HTTP API (SSE)

Execute code by sending a POST request to /api/run. The response is streamed as Server-Sent Events (SSE).

Request

POST /api/run
Content-Type: application/json

{
  "code": "Console.WriteLine(\"Hello, World!\"); return 42;",
  "timeout": 30000
}

Response Stream

data: {"kind":"stdout","stdOutput":"Hello, World!"}

data: {"kind":"result","result":42}

data: {"kind":"end","elapsed":150,"stdOutput":"Hello, World!","stdError":""}

MCP Protocol

The MCP endpoint is at /mcp and supports the run_code tool.

Request Example

{
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "name": "run_code",
    "arguments": {
      "code": "Console.WriteLine(\"Hello from MCP!\");"
    }
  },
  "id": 1
}

🏗️ Architecture & Development Guide

System Architecture

  • Host: Provides the public API and web UI. It receives requests, manages a pool of Workers, and handles load balancing.
  • Worker: Runs in an isolated sandbox environment, responsible for executing the C# code and returning the result.

Project Structure

src/
├── Sdcb.CSharpRunner.Host/     # Host Service (ASP.NET Core)
├── Sdcb.CSharpRunner.Worker/   # Worker Service (Console App)
└── Sdcb.CSharpRunner.Shared/   # Shared Library (DTOs, etc.)

Local Development

  1. Run the Host Service

    cd src/Sdcb.CSharpRunner.Host
    dotnet run
    
  2. Run the Worker Service

    cd src/Sdcb.CSharpRunner.Worker
    dotnet run
    

Building Custom Images

# Build the Host image
dotnet publish ./src/Sdcb.CSharpRunner.Host/Sdcb.CSharpRunner.Host.csproj -c Release /t:PublishContainer /p:ContainerRepository=csharp-runner-host

# Build the Worker image
dotnet publish ./src/Sdcb.CSharpRunner.Worker/Sdcb.CSharpRunner.Worker.csproj -c Release /t:PublishContainer /p:ContainerRepository=csharp-runner-worker

🤝 Contributing

Contributions via Issues and Pull Requests are welcome! Please follow these steps:

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/AmazingFeature)
  3. Commit your changes (git commit -m 'Add some AmazingFeature')
  4. Push to the branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

📄 License

This project is licensed under the MIT License - see the LICENSE file for details.


⭐ If you find this project helpful, please give it a star!

常见问题

What is csharp-runner?

csharp-runner is an open-source mcp servers skill for AI coding assistants such as Claude Code, Codex CLI, and ChatGPT, built by sdcb. fast, secure c# runner. It has 109 GitHub stars.

Is csharp-runner safe to use?

Yes. csharp-runner passed SkillsLLM's automated security scan — a dependency vulnerability audit plus prompt-injection heuristics — with no high-severity issues. You can read the full report in the Security Report section on this page.

How do I install csharp-runner?

Clone the repository with "git clone https://github.com/sdcb/csharp-runner" and add it to your Claude Code skills directory (see the Installation section above).

What programming language is csharp-runner written in?

csharp-runner is primarily written in C#. It is open-source under sdcb on GitHub, so you can review or fork the full source.

Are there alternatives to csharp-runner?

Yes. SkillsLLM lists many other MCP Servers skills you can browse and compare side by side. Open the MCP Servers category from the badge at the top of this page, or use the Related Skills and comparison links further down to weigh csharp-runner against similar tools.

评论 (0)

暂无评论,成为第一个分享想法的人!

n8n

by n8n-io

12

Fair-code workflow automation platform with native AI capabilities. Combine visual building with custom code, self-host or cloud, 400+ integrations.

201,88160,308TypeScript
MCP 服务器apisai-tools
查看详情

Scrapling

by D4Vinci

🕷️ An adaptive Web Scraping framework that handles everything from a single request to a full-scale crawl!

75,9137,581Python
MCP 服务器
查看详情

TrendRadar

by sansan0

⭐AI-driven public opinion & trend monitor with multi-platform aggregation, RSS, and smart alerts.🎯 告别信息过载,你的 AI 舆情监控助手与热点筛选工具!聚合多平台热点 + RSS 订阅,支持关键词精准筛选。AI 智能筛选新闻 + AI 翻译 + AI 分析简报直推手机,也支持接入 MCP 架构,赋能 AI 自然语言对话分析、情感洞察与趋势预测等。支持 Docker ,数据本地/云端自持。集成微信/飞书/钉钉/Telegram/邮件/ntfy/bark/slack 等渠道智能推送。

61,65224,883Python
MCP 服务器
查看详情

context7

by upstash

Context7 Platform -- Up-to-date code documentation for LLMs and AI code editors

61,0602,938TypeScript
MCP 服务器
查看详情

High-performance code intelligence MCP server. Indexes codebases into a persistent knowledge graph — average repo in milliseconds. 158 languages, sub-ms queries, 99% fewer tokens. Single static binary, zero dependencies.

39,9393,219C
MCP 服务器
查看详情

开发者还喜欢

基于喜欢此 Skill 的开发者投票和收藏

ECC

by affaan-m

10

The agent harness performance optimization system. Skills, instincts, memory, security, and research-first development for Claude Code, Codex, Opencode, Cursor and beyond.

242,21936,702JavaScript
AI 智能体ai-agentsanthropicclaude-code
查看详情
15

An agentic skills framework & software development methodology that works.

234,96620,863Shell
AI 智能体ai-agentsbrainstorming
查看详情

hermes-agent

by NousResearch

10

The agent that grows with you

234,43747,175Python
AI 智能体ai-agentsagent-orchestration
查看详情

n8n

by n8n-io

12

Fair-code workflow automation platform with native AI capabilities. Combine visual building with custom code, self-host or cloud, 400+ integrations.

201,88160,308TypeScript
MCP 服务器apisai-tools
查看详情

The agent harness performance optimization system. Skills, instincts, memory, security, and research-first development for Claude Code, Codex, Opencode, Cursor and beyond.

185,94028,768JavaScript
AI 智能体ai-agentsanthropicclaude-code
查看详情

cc-switch

by farion1231

3

A cross-platform desktop All-in-One assistant for Claude Code, Codex, OpenCode, OpenClaw, Grok Build & Hermes Agent. Only official website: ccswitch.io

128,8688,826Rust
AI 智能体claude-codeai-tools
查看详情