Skip to content

feat(extension): update ServerCommands for connection mode #25

@CalvinAllen

Description

@CalvinAllen

Parent Epic

Part of #18 - STDIO Transport Support

Description

Update ServerCommands to handle the new connection modes - disable HTTP commands when in STDIO mode.

Implementation

Modify: src/CodingWithCalvin.MCPServer/Commands/ServerCommands.cs

Command State Changes

private static void OnBeforeQueryStatusStart(object sender, EventArgs e)
{
    if (sender is OleMenuCommand command)
    {
        // Disable Start when:
        // - Already running HTTP server
        // - In STDIO client mode (external server)
        command.Enabled = MCPServerPackage.CurrentMode == ConnectionMode.None;
    }
}

private static void OnBeforeQueryStatusStop(object sender, EventArgs e)
{
    if (sender is OleMenuCommand command)
    {
        // Only enable Stop for HTTP mode (we control the server)
        // STDIO mode server is controlled externally
        command.Enabled = MCPServerPackage.CurrentMode == ConnectionMode.HttpServer
            && MCPServerPackage.ServerManager?.IsRunning == true;
    }
}

Status Display

Update any status display to show current mode:

  • "HTTP Server running on port 5050"
  • "STDIO mode - connected to external server"
  • "Idle - watching for connections"

Acceptance Criteria

  • Start command disabled in STDIO mode
  • Stop command only enabled for HTTP mode
  • Status text reflects current mode
  • Commands refresh when mode changes

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