stacklok / stacklok/toolhive

Export MCP notification-method constants and converge call sites

Open
#5,938 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

chore
Dominant language
Go
Stars
2.2k
Forks
300
Avg merge
1d 15h
Merged PRs (30d)
184

Description

Context

A library-reuse review of #5934 found that MCP notification/request method-name wire strings are hardcoded in several places because no shared, exported source defines them:

  • pkg/transport/proxy/streamable/dispatcher.go — #5934 collected them into a local const block (notifications/tools/list_changed, notifications/resources/list_changed, notifications/prompts/list_changed, notifications/progress, notifications/resources/updated, notifications/message, resources/subscribe, resources/unsubscribe).
  • pkg/mcp/parser.go — hardcodes the same strings as (unexported) map keys for request parsing.
  • pkg/vmcp/forwarding.go — declares its own MethodProgressNotification / MethodLogNotification constants.

toolhive-core/mcpcompat/mcp already exports some method/level constants (e.g. MethodSetLogLevel, LoggingLevel* — now reused in #5934), and the go-sdk defines the notification methods but only unexported, so they aren't reusable today.

Proposed work

  • Upstream the missing MCP notification/request method-name constants into toolhive-core/mcpcompat/mcp (the shared low-level package this repo already depends on), or export them from pkg/mcp if that's the more appropriate home.
  • Converge the call sites (streamable proxy local block, pkg/mcp/parser.go map keys, pkg/vmcp constants) onto the single exported source so the wire strings are defined once.

Notes

  • Avoid the wrong dependency direction: transport/pkg/mcp must not import pkg/vmcp. A shared home in toolhive-core/mcpcompat or pkg/mcp keeps layering correct.
  • Confirmed as a follow-up (not a blocker) by the #5934 review panel.

Generated with Claude Code

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by inspecting the existing exported constants in toolhive-core/mcpcompat/mcp, then compare the method strings and constants in pkg/transport/proxy/streamable/dispatcher.go, pkg/mcp/parser.go, and pkg/vmcp/forwarding.go. Check the relevant Go package tests before and after the change. Done means the listed wire strings have one exported source and the call sites use it without reversing the package dependency direction.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
backend-api-design
Issue type
Refactor
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.