-
-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Description
Parent Epic
Part of #18 - STDIO Transport Support
Description
Modify MCPServerPackage to track connection mode and coordinate between HTTP and STDIO modes.
Implementation
Modify: src/CodingWithCalvin.MCPServer/MCPServerPackage.cs
New Types
public enum ConnectionMode
{
None, // No server running, watching for STDIO
HttpServer, // VS spawned Server.exe, HTTP/SSE mode
StdioClient // External Server.exe, STDIO mode
}New Properties
public static ConnectionMode CurrentMode { get; private set; } = ConnectionMode.None;
public static IRpcClient? RpcClient { get; private set; }
public static IStdioPipeWatcher? PipeWatcher { get; private set; }InitializeAsync Changes
// Initialize pipe watcher
PipeWatcher = _componentModel.GetService<IStdioPipeWatcher>();
RpcClient = _componentModel.GetService<IRpcClient>();
// If auto-start enabled: Start HTTP, pause watcher
if (Settings.AutoStart)
{
CurrentMode = ConnectionMode.HttpServer;
// ... start server (watcher stays paused)
}
else
{
// Start watching for STDIO pipe
PipeWatcher?.Start();
}
// Subscribe to pipe watcher events
PipeWatcher.PipeDetected += OnStdioPipeDetected;
PipeWatcher.Disconnected += OnStdioDisconnected;Mode Transitions
- HTTP starts → Pause pipe watcher, set mode to HttpServer
- HTTP stops → Resume pipe watcher, set mode to None
- STDIO detected → Connect via RpcClient, set mode to StdioClient
- STDIO disconnects → Set mode to None, resume watching
Acceptance Criteria
- ConnectionMode enum added
- CurrentMode property added
- RpcClient and PipeWatcher properties added
- Mode transitions working correctly
- HTTP auto-start pauses pipe watcher
- STDIO detection triggers connection
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels