feat(integrations): prefer OAuth for PostHog MCP#410
Draft
neubig wants to merge 1 commit into
Draft
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
PostHog is needed for OSS KPI monitoring from OpenHands. The catalog already had PostHog MCP through a personal API key fallback, but PostHog's current docs recommend OAuth for the hosted MCP server and reserve personal API keys for clients that cannot use OAuth.
Official sources checked:
Summary
https://oauth.posthog.comauthorization, token, and registration endpoints.https://mcp.posthog.com/mcp?readonly=truewith editable URL for approved write workflows or project/org pinning.POSTHOG_PERSONAL_API_KEYby default.Issue Number
Closes #409
How to Test
Commands run:
npm run build:integrations uv sync --group test uv run pytest -q tests/test_catalogs.py tests/test_catalog_schema.py tests/test_integration_catalog_in_sync.py uv run pytest -q uv run python scripts/sync_extensions.py --checkResults:
107 passed, 30 warnings.461 passed, 35 warnings.not in any marketplace: ./plugins/issue-duplicate-checker.Live evidence
Catalog discovery through the JS package:
node --input-type=module -e "import { getIntegrationCatalogEntry, listIntegrationCatalog } from './integrations/index.js'; const e = getIntegrationCatalogEntry('posthog'); console.log(JSON.stringify({id:e.id, optionIds:e.connectionOptions.map(o=>o.id), firstAuth:e.connectionOptions[0].auth.strategy, firstUrl:e.connectionOptions[0].transport.url, oauthFiltered:listIntegrationCatalog({mcp:true, oauth:true}).some(x=>x.id==='posthog')}, null, 2));"Sanitized observation: PostHog resolves with options
["oauth", "api-key"], first authoauth2, first URLhttps://mcp.posthog.com/mcp?readonly=true, and appears inlistIntegrationCatalog({mcp:true, oauth:true}).Catalog discovery through the Python package:
Sanitized observation: same result as JS. The command emitted only the repo's existing deprecation warnings for the legacy raw catalog accessors.
Remote MCP unauthenticated discovery against the exact catalog URL:
Sanitized observation: PostHog returned
HTTP/2 401withWWW-Authenticate: Bearer resource_metadata="https://mcp.posthog.com/.well-known/oauth-protected-resource/mcp", proving the hosted MCP endpoint is reachable and advertises OAuth protected-resource discovery.OAuth metadata discovery:
Sanitized observation: protected resource is
https://mcp.posthog.com/mcp, auth server ishttps://oauth.posthog.com, bearer method isheader, and OAuth metadata exposeshttps://oauth.posthog.com/oauth/authorize/,https://oauth.posthog.com/oauth/token/, andhttps://oauth.posthog.com/oauth/register/. The advertised scopes includequery:readanddashboard:read.Credentialed MCP initialize attempt:
Sanitized observation: the available
POSTHOG_API_KEYreached PostHog but was rejected with401 Invalid API key. Remaining credential-dependent verification is to repeat initialize/tools-list with a valid PostHog personal API key created with the MCP Server preset, or complete OAuth login through an MCP client.Video/Screenshots
Not applicable - catalog/configuration change only.
Notes
This PR does not create, modify, or encode any KPI dashboards or PQL definitions. The OAuth default is read-only for safe inspection; write access should be explicitly approved before a later workflow removes
readonly=trueor uses a write-scoped key.