Skip to content

Commit 6b74b4b

Browse files
authored
Overwrite stdio bridge stdio name and version (#1396)
Signed-off-by: Juan Antonio Osorio <[email protected]>
1 parent e8e6f2e commit 6b74b4b

File tree

2 files changed

+11
-5
lines changed

2 files changed

+11
-5
lines changed

cmd/thv/app/proxy_stdio.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ func proxyStdioCmdFunc(cmd *cobra.Command, args []string) error {
3939
}
4040
logger.Infof("Starting stdio proxy for workload=%q", workloadName)
4141

42-
bridge, err := transport.NewStdioBridge(stdioWorkload.URL, stdioWorkload.TransportType)
42+
bridge, err := transport.NewStdioBridge(workloadName, stdioWorkload.URL, stdioWorkload.TransportType)
4343
if err != nil {
4444
return fmt.Errorf("failed to create stdio bridge: %w", err)
4545
}

pkg/transport/bridge.go

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,12 @@ import (
1414

1515
"github.com/stacklok/toolhive/pkg/logger"
1616
"github.com/stacklok/toolhive/pkg/transport/types"
17+
"github.com/stacklok/toolhive/pkg/versions"
1718
)
1819

1920
// StdioBridge connects stdin/stdout to a target MCP server using the specified transport type.
2021
type StdioBridge struct {
22+
name string
2123
mode types.TransportType
2224
rawTarget string // upstream base URL
2325

@@ -29,8 +31,12 @@ type StdioBridge struct {
2931
}
3032

3133
// NewStdioBridge creates a new StdioBridge instance for the given target URL and transport type.
32-
func NewStdioBridge(rawURL string, mode types.TransportType) (*StdioBridge, error) {
33-
return &StdioBridge{mode: mode, rawTarget: rawURL}, nil
34+
func NewStdioBridge(name, rawURL string, mode types.TransportType) (*StdioBridge, error) {
35+
return &StdioBridge{
36+
name: name,
37+
mode: mode,
38+
rawTarget: rawURL,
39+
}, nil
3440
}
3541

3642
// Start initializes the bridge and connects to the upstream MCP server.
@@ -71,8 +77,8 @@ func (b *StdioBridge) run(ctx context.Context) {
7177

7278
// Tiny local stdio server
7379
b.srv = server.NewMCPServer(
74-
"toolhive-stdio-bridge",
75-
"0.1.0",
80+
fmt.Sprintf("thv-%s", b.name),
81+
versions.Version,
7682
server.WithToolCapabilities(true),
7783
server.WithResourceCapabilities(true, true),
7884
server.WithPromptCapabilities(true),

0 commit comments

Comments
 (0)