-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Generate server instructions in the Inventory #1863
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR refactors the server instructions generation logic by moving it from the pkg/github package to the pkg/inventory package, improving the separation of concerns.
Changes:
- Moved
GenerateInstructionsand related functions frompkg/githubtopkg/inventory - Made instruction generation opt-in via a new
WithServerInstructions()builder method - Updated both stdio and HTTP server initialization to use the new inventory-based instructions
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
pkg/inventory/registry.go |
Added instructions field to Inventory struct and Instructions() getter method |
pkg/inventory/instructions.go |
Moved from pkg/github to pkg/inventory with package change and function visibility adjustments |
pkg/inventory/instructions_test.go |
Moved from pkg/github to pkg/inventory with type updates from []string to []ToolsetID |
pkg/inventory/builder.go |
Added WithServerInstructions() builder method and instruction generation in Build() |
pkg/http/handler.go |
Added WithServerInstructions() call in DefaultInventoryFactory |
pkg/github/server.go |
Removed local instruction generation logic, now uses inventory.Instructions() |
internal/ghmcp/server.go |
Added WithServerInstructions() call to inventory builder chain |
* carry over from #1863 * remove unused inv * update toolsnap --------- Co-authored-by: Sam Morrow <info@sam-morrow.com>
|
Closing because I ended up doing this in this PR instead: #1869 |
Summary
This PR moves server instructions generation from
NewMCPServerinto the Inventory pattern, so instructions are computed at inventory build time rather than server creation time.Changes
instructionsfield toInventorystruct withInstructions()getter methodInstructionsFuncfield toToolsetMetadataallowing each toolset to define its own instructionsWithServerInstructions()builder method that enables instruction generation duringBuild()pkg/github/toolset_instructions.gowith instruction functions for each toolset (context, issues, pull_requests, discussions, projects)pkg/inventory/instructions.go, which first adds base instructions and then iterates over toolsets and calls theirInstructionsFunc.WithServerInstructions()when building inventoryNewMCPServerto useinventory.Instructions()instead of generating instructions inlineTesting
pkg/inventory/instructions_test.go.WithServerInstructions()Demo
Screen.Recording.2026-01-22.at.12.46.46.mov
Why
This aligns with the architectural direction where the Inventory holds all pre-computed configuration, and the MCP server receives a fully-configured inventory rather than creating one itself. Instructions are generated based on the resolved enabled toolsets (after processing "default", "all" keywords, etc.)
MCP impact
Prompts tested (tool changes only)
Security / limits
Tool renaming
deprecated_tool_aliases.goNote: if you're renaming tools, you must add the tool aliases. For more information on how to do so, please refer to the official docs.
Lint & tests
./script/lint./script/testDocs
Note
The linter in the CI is failing due to pre-existing issues in the work-in-progress base branch
http-stack-2