Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
- uses: actions/checkout@v6
- uses: actions/setup-go@v6
with:
go-version: stable
go-version: '1.25'
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Linter requires this

- name: golangci-lint
uses: golangci/golangci-lint-action@v9
with:
Expand Down
7 changes: 7 additions & 0 deletions pkg/http/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ type Handler struct {
inventoryFactoryFunc InventoryFactoryFunc
oauthCfg *oauth.Config
scopeFetcher scopes.FetcherInterface
schemaCache *mcp.SchemaCache
}

type HandlerOptions struct {
Expand Down Expand Up @@ -101,6 +102,10 @@ func NewHTTPMcpHandler(
inventoryFactory = DefaultInventoryFactory(cfg, t, opts.FeatureChecker, scopeFetcher)
}

// Create a shared schema cache to avoid repeated JSON schema reflection
// when a new MCP Server is created per request in stateless mode.
schemaCache := mcp.NewSchemaCache()

return &Handler{
ctx: ctx,
config: cfg,
Expand All @@ -112,6 +117,7 @@ func NewHTTPMcpHandler(
inventoryFactoryFunc: inventoryFactory,
oauthCfg: opts.OAuthConfig,
scopeFetcher: scopeFetcher,
schemaCache: schemaCache,
}
}

Expand Down Expand Up @@ -195,6 +201,7 @@ func (h *Handler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
Resources: &mcp.ResourceCapabilities{},
Prompts: &mcp.PromptCapabilities{},
}
so.SchemaCache = h.schemaCache
},
},
})
Expand Down