mcp: scaffolding of /.pomerium/mcp routes (#5580)

This commit is contained in:
Denis Mishin 2025-04-23 12:36:31 -04:00 committed by GitHub
parent cb0e8aaf06
commit f1a9401ddc
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 100 additions and 0 deletions

View file

@ -18,6 +18,7 @@ import (
"github.com/pomerium/pomerium/internal/handlers/webauthn"
"github.com/pomerium/pomerium/internal/httputil"
"github.com/pomerium/pomerium/internal/log"
"github.com/pomerium/pomerium/internal/mcp"
"github.com/pomerium/pomerium/internal/telemetry/metrics"
"github.com/pomerium/pomerium/pkg/cryptutil"
"github.com/pomerium/pomerium/pkg/storage"
@ -63,6 +64,7 @@ type Proxy struct {
webauthn *webauthn.Handler
tracerProvider oteltrace.TracerProvider
logoProvider portal.LogoProvider
mcp *mcp.Handler
}
// New takes a Proxy service from options and a validation function.
@ -74,12 +76,18 @@ func New(ctx context.Context, cfg *config.Config) (*Proxy, error) {
return nil, err
}
mcp, err := mcp.New(ctx, mcp.DefaultPrefix, cfg)
if err != nil {
return nil, fmt.Errorf("proxy: failed to create mcp handler: %w", err)
}
p := &Proxy{
tracerProvider: tracerProvider,
state: atomicutil.NewValue(state),
currentConfig: atomicutil.NewValue(&config.Config{Options: config.NewDefaultOptions()}),
currentRouter: atomicutil.NewValue(httputil.NewRouter()),
logoProvider: portal.NewLogoProvider(),
mcp: mcp,
}
p.OnConfigChange(ctx, cfg)
p.webauthn = webauthn.New(p.getWebauthnState)