-
Notifications
You must be signed in to change notification settings - Fork 2
Document authServerRef field and combined auth patterns #702
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -391,10 +391,10 @@ spec: | |||||
| resources: | ||||||
| limits: | ||||||
| cpu: '500m' | ||||||
| memory: 512Mi | ||||||
| memory: '512Mi' | ||||||
| requests: | ||||||
| cpu: 100m | ||||||
| memory: 128Mi | ||||||
| cpu: '100m' | ||||||
| memory: '128Mi' | ||||||
|
Comment on lines
391
to
+397
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Are the resource settings actually relevant to the topic/example? Consider removing if not - or validate that these are in fact the right recommended resources for MCPRemoteProxy; I think these are the same as carried forward from other full MCPServer examples. |
||||||
| ``` | ||||||
|
|
||||||
| Replace the placeholders with your OIDC provider's configuration. | ||||||
|
|
@@ -416,6 +416,77 @@ When you apply this resource, the ToolHive Operator: | |||||
|
|
||||||
| ::: | ||||||
|
|
||||||
| ## Combine embedded auth with AWS STS | ||||||
|
|
||||||
| If you want ToolHive to handle the full OAuth flow for incoming client | ||||||
| authentication (instead of validating tokens from an external OIDC provider), | ||||||
| you can combine the | ||||||
| [embedded authorization server](../concepts/embedded-auth-server.mdx) with AWS | ||||||
| STS on the same `MCPRemoteProxy`. Use `authServerRef` for the embedded auth | ||||||
| server and `externalAuthConfigRef` for the AWS STS configuration. | ||||||
|
|
||||||
| This pattern is useful when your MCP clients don't have their own OIDC tokens. | ||||||
| The embedded auth server redirects users to an upstream identity provider (such | ||||||
| as Okta or Google), issues its own JWTs, and ToolHive then exchanges those JWTs | ||||||
| for temporary AWS credentials via STS. | ||||||
|
|
||||||
| First, create an `MCPExternalAuthConfig` for the embedded auth server following | ||||||
| the steps in | ||||||
| [Set up embedded authorization server authentication](../guides-k8s/auth-k8s.mdx#set-up-embedded-authorization-server-authentication) | ||||||
| (steps 1 through 4). Then deploy the `MCPRemoteProxy` with both references: | ||||||
|
|
||||||
| ```yaml {10-12,14-15} title="aws-mcp-remote-proxy-combined.yaml" | ||||||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Highlight is misaligned. Tip: using the
Suggested change
|
||||||
| apiVersion: toolhive.stacklok.dev/v1alpha1 | ||||||
| kind: MCPRemoteProxy | ||||||
| metadata: | ||||||
| name: aws-mcp-proxy | ||||||
| namespace: toolhive-system | ||||||
| spec: | ||||||
| remoteURL: https://aws-mcp.us-east-1.api.aws/mcp | ||||||
|
|
||||||
| # Embedded auth server for incoming client authentication | ||||||
| authServerRef: | ||||||
| kind: MCPExternalAuthConfig | ||||||
| name: embedded-auth-server | ||||||
|
|
||||||
| # AWS STS for outgoing backend authentication | ||||||
| externalAuthConfigRef: | ||||||
| name: aws-mcp-sts-auth | ||||||
|
|
||||||
| # Validate JWTs issued by the embedded authorization server | ||||||
| oidcConfig: | ||||||
| type: inline | ||||||
| resourceUrl: https://<YOUR_DOMAIN>/mcp | ||||||
| inline: | ||||||
| # This must match the issuer in your embedded auth server config | ||||||
| issuer: https://<YOUR_EMBEDDED_AUTH_ISSUER> | ||||||
|
|
||||||
| proxyPort: 8080 | ||||||
| transport: streamable-http | ||||||
|
|
||||||
| audit: | ||||||
| enabled: true | ||||||
|
|
||||||
| resources: | ||||||
| limits: | ||||||
| cpu: '500m' | ||||||
| memory: '512Mi' | ||||||
| requests: | ||||||
| cpu: '100m' | ||||||
| memory: '128Mi' | ||||||
|
Comment on lines
+466
to
+476
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Are the audit and resource settings actually relevant to the example? Consider removing if not. |
||||||
| ``` | ||||||
|
|
||||||
| In this configuration: | ||||||
|
|
||||||
| - `authServerRef` points to the `MCPExternalAuthConfig` with | ||||||
| `type: embeddedAuthServer`, which handles the OAuth flow for incoming clients. | ||||||
| - `externalAuthConfigRef` points to the `MCPExternalAuthConfig` with | ||||||
| `type: awsSts`, which exchanges OIDC tokens for AWS credentials on outgoing | ||||||
| requests. | ||||||
| - `oidcConfig` validates JWTs issued by the embedded auth server. The `issuer` | ||||||
| must match the `issuer` in your embedded auth server's | ||||||
| `MCPExternalAuthConfig`. | ||||||
|
|
||||||
| ## Step 5: Expose the proxy | ||||||
|
|
||||||
| To make the proxy accessible to clients outside the cluster, create Gateway and | ||||||
|
|
||||||
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.
Remove em dash