-
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
Open
tommaso-moro
wants to merge
9
commits into
http-stack-2
Choose a base branch
from
tommy/http-stack-server-instructions
base: http-stack-2
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+322
−282
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Contributor
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 |
tommaso-moro
added a commit
that referenced
this pull request
Jan 22, 2026
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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