Skip to content

Commit 2b41c03

Browse files
Merge branch 'main' into mcp-ui-apps-3
2 parents ef5bc56 + bbc675a commit 2b41c03

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

.github/workflows/lint.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ jobs:
2323
run: script/build-ui
2424
- uses: actions/setup-go@v6
2525
with:
26-
go-version: stable
26+
go-version: '1.25'
2727
- name: golangci-lint
2828
uses: golangci/golangci-lint-action@v9
2929
with:

pkg/http/handler.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ type Handler struct {
3131
inventoryFactoryFunc InventoryFactoryFunc
3232
oauthCfg *oauth.Config
3333
scopeFetcher scopes.FetcherInterface
34+
schemaCache *mcp.SchemaCache
3435
}
3536

3637
type HandlerOptions struct {
@@ -101,6 +102,10 @@ func NewHTTPMcpHandler(
101102
inventoryFactory = DefaultInventoryFactory(cfg, t, opts.FeatureChecker, scopeFetcher)
102103
}
103104

105+
// Create a shared schema cache to avoid repeated JSON schema reflection
106+
// when a new MCP Server is created per request in stateless mode.
107+
schemaCache := mcp.NewSchemaCache()
108+
104109
return &Handler{
105110
ctx: ctx,
106111
config: cfg,
@@ -112,6 +117,7 @@ func NewHTTPMcpHandler(
112117
inventoryFactoryFunc: inventoryFactory,
113118
oauthCfg: opts.OAuthConfig,
114119
scopeFetcher: scopeFetcher,
120+
schemaCache: schemaCache,
115121
}
116122
}
117123

@@ -195,6 +201,7 @@ func (h *Handler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
195201
Resources: &mcp.ResourceCapabilities{},
196202
Prompts: &mcp.PromptCapabilities{},
197203
}
204+
so.SchemaCache = h.schemaCache
198205
},
199206
},
200207
})

0 commit comments

Comments
 (0)