-
-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Description
Parent Epic
Part of #18 - STDIO Transport Support
Description
Modify Server Program.cs to support both HTTP and STDIO transports via a command-line option.
Implementation
Modify: src/CodingWithCalvin.MCPServer.Server/Program.cs
New Command Line Option
var transportOption = new Option<string>(
name: "--transport",
getDefaultValue: () => "http",
description: "MCP transport: 'http' (HTTP/SSE server) or 'stdio' (STDIO transport)");STDIO Mode Logic
if (transport == "stdio")
{
// 1. Create RpcServer with well-known pipe name
var rpcServer = new RpcServer(shutdownCts);
await rpcServer.StartAsync(McpConstants.StdioPipeName);
// 2. Wait for VS Extension to connect (with timeout)
await rpcServer.WaitForConnectionAsync(TimeSpan.FromSeconds(60));
// 3. Build MCP server with STDIO transport
// Use Host.CreateDefaultBuilder() instead of WebApplication
// Use WithStdioServerTransport() instead of WithHttpTransport()
// 4. Run until shutdown
}
else // http mode - unchanged
{
// Existing implementation
}Error Handling
- Clear error message if VS doesn't connect within timeout
- Proper cleanup on CTRL+C / shutdown
Dependencies
- Requires RpcServer class (feat(shared): add McpConstants for STDIO pipe name #19 or similar)
- Requires McpConstants (feat(shared): add McpConstants for STDIO pipe name #19 or similar)
Acceptance Criteria
- --transport option added (http/stdio)
- HTTP mode unchanged (regression test)
- STDIO mode creates pipe server
- STDIO mode uses STDIO transport for MCP
- Timeout with helpful error message
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels