Skip to content

Conversation

@MattBro
Copy link
Contributor

@MattBro MattBro commented Jan 12, 2026

Problem

  1. The MCP server at mcp.posthog.com serves both US and EU regions, but OAuth tokens are region-specific
  2. Current wizard always requires API key creation upfront, blocking JIT provisioning for new users

More convo here https://posthog.slack.com/archives/C09KTRWD3HD/p1767997171308609?thread_ts=1767899846.384299&cid=C09KTRWD3HD

Changes

Region param support

  • Updated buildMCPUrl to include ?region=eu for EU users
  • Passed region through all MCP client implementations

OAuth authentication option

  • Added prompt: "How would you like to authenticate?" with API Key / OAuth (Beta)
  • OAuth mode skips API key creation, lets MCP handle OAuth on first use
  • Enables JIT provisioning for new users (e.g., Replit integration)

How did you test this code?

cd /Users/mattbrooker/dev/posthog-wizard

# Remove existing MCP
claude mcp remove posthog-local -s user

# Clear OAuth tokens
rm -rf ~/.claude/oauth/

# Add local MCP with wizard
npx . mcp add --local

# Select region, features, clients
# Then use Claude Code - it should trigger OAuth flow
image

🤖 Generated with Claude Code

MattBro and others added 3 commits January 12, 2026 08:59
Adds region parameter throughout the MCP client configuration flow.
When region is 'eu', appends `?region=eu` to the MCP URL so the server
can route OAuth to the correct authorization server.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Adds a prompt asking users how they want to authenticate:
- API Key: existing flow, creates personal API key
- OAuth (Beta): skips API key, lets MCP handle OAuth on first use

This enables JIT provisioning for new users (e.g., Replit integration).

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Add tests for OAuth mode (no API key) in claude.test.ts
- Add tests for region parameter passing
- Add comprehensive tests for defaults.ts (buildMCPUrl, getDefaultServerConfig, getNativeHTTPServerConfig)
- Improve comment explaining region logic

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Copy link
Collaborator

@joshsny joshsny left a comment

Choose a reason for hiding this comment

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

looks great, didn't run locally but generally changes look good - left a comment about whether to prompt the user

MattBro pushed a commit that referenced this pull request Jan 14, 2026
Removes the user prompt asking to choose between API Key and OAuth authentication.
OAuth is now the default authentication method for MCP server setup, streamlining
the wizard flow and reducing user friction.

This addresses feedback in PR #220 to make OAuth the default since it's proven reliable.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
MattBro and others added 2 commits January 13, 2026 19:43
Removes the authentication method prompt and defaults to OAuth for
MCP setup. Users no longer need to create a Personal API key upfront -
authentication happens when they first use the MCP.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@MattBro MattBro enabled auto-merge (squash) January 14, 2026 16:03
@MattBro MattBro merged commit bd2a09d into main Jan 14, 2026
14 checks passed
@MattBro MattBro deleted the matt/mcp-region-param branch January 14, 2026 16:04
This was referenced Jan 14, 2026
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.

3 participants