fix(mcp): set stdioMode in ServeStdio + use shared locked writer
ServeStdio never set stdioMode=true, so ChannelSend always returned early. Also switched from StdioTransport to IOTransport with a shared lockedWriter that both the SDK and ChannelSend write through. This fixes channel notifications not arriving in Claude Code sessions. Co-Authored-By: Virgil <virgil@lethean.io>
This commit is contained in:
parent
c8089fd597
commit
014c18e563
1 changed files with 6 additions and 1 deletions
|
|
@ -2,6 +2,7 @@ package mcp
|
|||
|
||||
import (
|
||||
"context"
|
||||
"os"
|
||||
|
||||
"forge.lthn.ai/core/go-log"
|
||||
"github.com/modelcontextprotocol/go-sdk/mcp"
|
||||
|
|
@ -15,5 +16,9 @@ import (
|
|||
// }
|
||||
func (s *Service) ServeStdio(ctx context.Context) error {
|
||||
s.logger.Info("MCP Stdio server starting", "user", log.Username())
|
||||
return s.server.Run(ctx, &mcp.StdioTransport{})
|
||||
s.stdioMode = true
|
||||
return s.server.Run(ctx, &mcp.IOTransport{
|
||||
Reader: os.Stdin,
|
||||
Writer: sharedStdout,
|
||||
})
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue