Skip to content

Support separate auth tokens for Onboarding API and MCPs #142

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

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

andreaskienle
Copy link
Contributor

@andreaskienle andreaskienle commented Jun 5, 2025

Implements openmcp-project/backlog#151

Some notes:

  • Currently, we assume that the Onboarding API and MCPs can have different client IDs, but all MCPs within a single landscape must share the same client ID. This approach will need to be revised once we support multiple IdPs. I added a comment in the corresponding issue.
  • To test this PR, you need to add the env variable OIDC_CLIENT_ID_MCP (see env template)

@andreaskienle andreaskienle requested a review from Copilot June 13, 2025 12:12
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR implements separate authentication handling for the Onboarding API and MCPs by introducing dedicated auth contexts, routes, and configuration updates. Key changes include:

  • Renaming and reworking the authentication context and provider for onboarding.
  • Introducing a new MCP auth context and related routes.
  • Adjusting session handling, fetch endpoints, and component usage accordingly.

Reviewed Changes

Copilot reviewed 23 out of 23 changed files in this pull request and generated no comments.

Show a summary per file
File Description
src/spaces/onboarding/auth/AuthContextOnboarding.tsx Renamed and refactored auth context/provider for onboarding.
src/spaces/mcp/auth/auth.schemas.ts Added Zod schema for MCP auth response validation.
src/spaces/mcp/auth/AuthContextMcp.tsx Created new auth context/provider for MCP authentication.
src/main.tsx Updated to use the new onboarding auth provider and callback handler.
src/lib/shared/McpContext.tsx Integrated MCP auth when accessing managed control plane routes.
src/lib/api/fetch.ts Adjusted fetch endpoints to target onboarding routes.
Various component files Replaced old useAuth usage with useAuthOnboarding.
server/routes/auth-onboarding.js, auth-mcp.js Updated auth routes to separate onboarding and MCP flows.
server/plugins/session.js, http-proxy.js Updated session management and token handling for dual flows.
server/config/env.js, .env.template, package.json Updated configuration and dependencies for the new auth setup.
Comments suppressed due to low confidence (1)

server/plugins/http-proxy.js:89

  • Combining onboarding and MCP access tokens as a comma-separated string may lead to unexpected behavior if the downstream service expects a single token. Verify that the downstream API is designed to parse this format or consider handling the tokens separately.
const accessToken = useCrate ? req.session.get("onboarding_accessToken") : `${req.session.get("onboarding_accessToken")},${req.session.get("mcp_accessToken")}`;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant