MCP cover image
See in Github
2025-04-14

C#MCP代理来自STDIO <-> SSE

0

Github Watches

0

Github Forks

0

Github Stars

MCPProxy-STDIO-to-SSE

Makes a MCP SSE server compatiable with WindSurf and Claude Desktop

MCPProxy-STDIO-to-SSE A lightweight .NET console bridge that lets any STDIO-based client speak to an SSE-backed MCP server. It:

Opens a single long-lived SSE connection to BASE_URL/sse, discovers the /message?sessionId=… endpoint.

Forwards every JSON-RPC line read from STDIN as an HTTP POST to BASE_URL/message?sessionId=….

Streams each SSE data: payload (other than the endpoint event) to STDOUT.

Logs every message sent and received (with timestamps and pretty-printed JSON) to MCPProxy-STDIO.log in your temp directory.

Features Bidirectional bridge: STDIN→HTTP POST and SSE→STDOUT.

Automatic session discovery via the event: endpoint frame.

Structured logging (timestamps, “Sent”/“Received” markers, indented JSON).

Configurable headers on both SSE subscribe and POST requests.

Prerequisites .NET 6.0 SDK or later

An MCP-compatible server exposing:

GET /sse (SSE stream with an event: endpoint frame)

POST /message?sessionId={id} (accepts JSON-RPC payloads)

Building

git clone https://github.com/yourorg/MCPProxy-STDIO-to-SSE.git
cd MCPProxy-STDIO-to-SSE
dotnet build -c Release

Usage

# Basic (no extra headers):
dotnet run --project src/Program.cs http://localhost:3001

# With additional HTTP headers:
dotnet run --project src/Program.cs http://localhost:3001 ApiKey 12345

Once launched, the app will: Open GET http://localhost:3001/sse with Accept: text/event-stream. Wait for an event: endpoint frame—e.g.:

event: endpoint
data: /message?sessionId=Wp6wxiY6PyBRoTtCNyLucw

Read lines from your STDIN and POST each one as JSON to:

POST http://localhost:3001/message?sessionId=Wp6wxiY6PyBRoTtCNyLucw
Content-Type: application/json

{"jsonrpc":"2.0","id":1, ...}

Print every other SSE data: payload to STDOUT, for example:

{"jsonrpc":"2.0","id":1,"result":{"protocolVersion":"2024-11-05", ...}}

Write a detailed log of “Sent” and “Received” messages (with timestamps and formatted JSON) into:

%TEMP%\MCPProxy-STDIO.log

Use this bridge to connect any STDIO-driven LSP/JSON-RPC client (including Claude Desktop) to a web-based SSE/MCP backend seamlessly. Sample Claude JSON configuration

{
  "mcpServers": {
    "Local CNET Debug": {
      "command": "C:\\Users\\User\\source\\repos\\MCPProxy-STDIO-to-SSE\\MCPProxy-STDIO-to-SSE\\bin\\Debug\\net6.0\\MCPProxy-STDIO-to-SSE.exe",
      "args": ["http://localhost:4858/McpHandler.ashx/sse"],
      "env": {
        "BRAVE_API_KEY": "your-api-key"
      }
    }
  }
}

image

相关推荐

  • Aurity Ltd
  • Create and Publish Business Websites in seconds. AI will gather all the details about your website and generate link to your website.

  • John Rafferty
  • Text your favorite pet, after answering 10 questions about their everyday lives!

  • Convincible Ltd
  • You're in a stone cell – can you get out? A classic choose-your-adventure interactive fiction game, based on a meticulously-crafted playbook. With a medieval fantasy setting, infinite choices and outcomes, and dice!

  • Ian O'Connell
  • Provide players' names or enter Quickstart to start the game!

  • Matthieu Savioux
  • Evaluates language quality of texts, responds with a numerical score between 50-150.

  • analogchat.com
  • Efficient Spotify assistant for personalized music data.

  • seabiscuit.ai
  • Discover A More Robust Business: Craft tailored value proposition statements, develop a comprehensive business model canvas, conduct detailed PESTLE analysis, and gain strategic insights on enhancing business model elements like scalability, cost structure, and market competition strategies. (v1.18)

  • Carl Oscar Aaro
  • Structured recipes for food and desserts – ingredient lists and step-by-step recipe instructions from any input. Become surprised, try something new or breathe life into grandma's old recipe notebook.

  • WangRongsheng
  • 🧑‍🚀 llm 资料总结(数据处理、模型训练、模型部署、 o1 模型、mcp 、小语言模型、视觉语言模型)|摘要世界上最好的LLM资源。

  • n8n-io
  • 具有本机AI功能的公平代码工作流程自动化平台。将视觉构建与自定义代码,自宿主或云相结合,400+集成。

  • av
  • 毫不费力地使用一个命令运行LLM后端,API,前端和服务。

  • 1Panel-dev
  • 🔥1Panel提供了直观的Web接口和MCP服务器,用于在Linux服务器上管理网站,文件,容器,数据库和LLMS。

  • Azure
  • 该存储库用于开发Azure MCP服务器,将Azure的功能带给您的代理商。

  • langgenius
  • alibaba
  • metorial
  • 数百个MCP服务器的容器化版本📡📡

  • caio-moliveira
  • 创建该项目是为了证明我们如何与不同的模型上下文协议(MCP)连接。

  • rulego
  • ⛓️Rulego是一种轻巧,高性能,嵌入式,下一代组件编排规则引擎框架。

  • Byaidu
  • PDF科学纸翻译带有保留格式的pdf -基于ai完整保留排版的pdf文档全文双语翻译

    Reviews

    3 (3)
    Avatar
    user_ek8zokQA
    2025-04-24

    I've been using MCPProxy-STDIO-to-SSE by AgentSmithers for a couple of weeks now, and it has significantly simplified my workflow. The seamless integration between STDIO and SSE protocols is incredibly efficient, making real-time data processing a breeze. Highly recommend this tool for anyone needing robust and reliable proxy solutions.

    Avatar
    user_PLHy4s1Y
    2025-04-24

    MCPProxy-STDIO-to-SSE by AgentSmithers is an outstanding tool for seamless integration of standard input/output with Server-Sent Events. The usability and efficiency it brings to the table have significantly improved my workflow. If you're looking to enhance your application's real-time communication capabilities, this is a must-have. Highly recommended!

    Avatar
    user_2C30VzfS
    2025-04-24

    The MCPProxy-STDIO-to-SSE by AgentSmithers is an exceptional tool for developers looking to streamline their workflow between STDIO and SSE protocols. The implementation is seamless and perfectly catered to integrate with multiple languages, making it a versatile addition to any project. Highly recommended for its efficiency and ease of use!