Skip to content

feat: Implement external MCP integrations#966

Open
cvolzer3 wants to merge 6 commits intomainfrom
feat/mcp-integrations
Open

feat: Implement external MCP integrations#966
cvolzer3 wants to merge 6 commits intomainfrom
feat/mcp-integrations

Conversation

@cvolzer3
Copy link

Change

Add support for external MCP integrations

Details

The backend runs on the main PostHog Django app. The agent sends requests to a proxy service there, which retrieves the relevant installation and stored credentials, manages authentication and security, and forwards the requests to the MCP server. The MCP server then streams the responses back or serve buffered JSON.

MCPs can be managed (installed, configured, uninstalled) from either Twig > Settings > MCP Servers or in main PostHog > Settings > MCP servers pages.

@cvolzer3
Copy link
Author

fyi, dependent on both:

PostHog/posthog#48215
PostHog/posthog#48543

@charlesvien charlesvien force-pushed the feat/mcp-integrations branch 3 times, most recently from 3274f55 to a9a4c26 Compare February 20, 2026 01:58
Copy link
Contributor

@jonathanlab jonathanlab left a comment

Choose a reason for hiding this comment

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

beautiful

@charlesvien charlesvien force-pushed the feat/mcp-integrations branch from a9a4c26 to 4707f2a Compare February 20, 2026 15:10
],
});

// Fetch user-installed MCP servers from the PostHog backend
Copy link
Contributor

Choose a reason for hiding this comment

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

We should have a way to enable / disable these in the Twig UI, but the logic of fetching and injecting the MCP servers should live in the agent package, since then it'll run in Twig locally + also in the cloud runs

Copy link
Author

Choose a reason for hiding this comment

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

@joshsny

Just want to make sure I understand correctly...

Currently, the PostHog Code app fetches the MCP server installations and the pre-configured PostHog MCP server from within the app, and passes it to the agent through the various session functions (e.g. resumeSession). This logic predates my changes, so I want to confirm before making any changes.

Are you suggesting that logic should be moved to the agent package?

Copy link
Contributor

Choose a reason for hiding this comment

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

suggestion would be that since the state of these is stored on our backend, we’d pass to a task run something like a list of server urls, and then the agent package would fetch them and inject them into the claude agent sdk / codex

Copy link
Contributor

Choose a reason for hiding this comment

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

reason for suggesting that is just that the only thing that runs in the cloud runs is the agent server, and the agent itself, we could keep the logic in the app if that makes more sense here, but we’ll need to reimplement it in the agent / agent server anyway for cloud runs, so we may as well centralise that logic and minimise the surface of what we pass to the agent (e.g just a list of urls)

Copy link
Contributor

Choose a reason for hiding this comment

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

if that makes no sense whatsoever given the existing logic though, feel free to ignore!

@charlesvien charlesvien changed the title feat: added external mcp integrations feat: Implement external MCP integrations Feb 23, 2026
@charlesvien charlesvien force-pushed the feat/mcp-integrations branch from 4707f2a to 6f63e54 Compare February 23, 2026 20:05
@charlesvien charlesvien force-pushed the feat/mcp-integrations branch from 6f63e54 to a4ee738 Compare February 24, 2026 16:45
@cvolzer3 cvolzer3 requested a review from a team March 2, 2026 16:12
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.

4 participants