Skip to content

feat(extension): add StdioPipeWatcher service #23

@CalvinAllen

Description

@CalvinAllen

Parent Epic

Part of #18 - STDIO Transport Support

Description

Create a background service that watches for the STDIO pipe and automatically connects when detected.

Implementation

New File: src/CodingWithCalvin.MCPServer/Services/StdioPipeWatcher.cs

Behavior

  • Background polling service (check every 1-2 seconds)
  • Watches for vsmcp-stdio named pipe existence
  • Only active when CurrentMode == None (paused during HTTP or STDIO modes)
  • When pipe detected: triggers RpcClient.ConnectAsync(), sets mode to StdioClient
  • Handles disconnection: resets mode to None, resumes watching
  • MEF exported service

Key Methods

public interface IStdioPipeWatcher : IDisposable
{
    bool IsWatching { get; }
    void Start();
    void Stop();
    event EventHandler<PipeDetectedEventArgs>? PipeDetected;
    event EventHandler? Disconnected;
}

Pipe Detection

Use File.Exists(@"\.\pipe\vsmcp-stdio") or equivalent to check pipe existence.

Acceptance Criteria

  • StdioPipeWatcher class created with MEF export
  • Background polling for pipe existence
  • Start/Stop/Pause functionality
  • Event raised when pipe detected
  • Event raised on disconnection
  • Only watches when mode is None

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions