Skip to content

Commit 30bc840

Browse files
committed
add instructions step to inventory creation both in stdio and http server
1 parent 540a0e7 commit 30bc840

File tree

3 files changed

+4
-11
lines changed

3 files changed

+4
-11
lines changed

internal/ghmcp/server.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,8 @@ func NewStdioMCPServer(cfg github.MCPServerConfig) (*mcp.Server, error) {
124124
WithDeprecatedAliases(github.DeprecatedToolAliases).
125125
WithReadOnly(cfg.ReadOnly).
126126
WithToolsets(cfg.EnabledToolsets).
127-
WithTools(github.CleanTools(cfg.EnabledTools))
127+
WithTools(github.CleanTools(cfg.EnabledTools)).
128+
WithServerInstructions()
128129
// WithFeatureChecker(createFeatureChecker(cfg.EnabledFeatures))
129130

130131
// Apply token scope filtering if scopes are known (for PAT filtering)

pkg/github/server.go

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -71,18 +71,9 @@ type MCPServerConfig struct {
7171
type MCPServerOption func(*mcp.ServerOptions)
7272

7373
func NewMCPServer(cfg *MCPServerConfig, deps ToolDependencies, inventory *inventory.Inventory) (*mcp.Server, error) {
74-
enabledToolsets := resolveEnabledToolsets(cfg)
7574

76-
// For instruction generation, we need actual toolset names (not nil).
77-
// nil means "use defaults" in inventory, so expand it for instructions.
78-
instructionToolsets := enabledToolsets
79-
if instructionToolsets == nil {
80-
instructionToolsets = GetDefaultToolsetIDs()
81-
}
82-
83-
// Create the MCP server
8475
serverOpts := &mcp.ServerOptions{
85-
Instructions: GenerateInstructions(instructionToolsets),
76+
Instructions: inventory.Instructions(),
8677
Logger: cfg.Logger,
8778
CompletionHandler: CompletionsHandler(deps.GetClient),
8879
}

pkg/http/handler.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,7 @@ func DefaultInventoryFactory(cfg *HTTPServerConfig, t translations.TranslationHe
125125
}
126126

127127
b = InventoryFiltersForRequestHeaders(r, b)
128+
b = b.WithServerInstructions()
128129
return b.Build()
129130
}
130131
}

0 commit comments

Comments
 (0)