Skip to content

Commit 5498d0a

Browse files
authored
Merge pull request #3057 from PostHog/posthog-code/prod-mcp-drop-local-server
feat(ci): hit the prod MCP; drop the local posthog MCP server entirely
2 parents 385e9e1 + 9de32ea commit 5498d0a

2 files changed

Lines changed: 7 additions & 88 deletions

File tree

.github/actions/setup-wizard-deps/action.yml

Lines changed: 1 addition & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ inputs:
99
description: 'Context Mill repo branch/tag/sha'
1010
required: true
1111
posthog_ref:
12+
# Deprecated: the posthog MCP is no longer built locally (CI hits prod MCP).
1213
description: 'PostHog repo branch/tag/sha (for MCP)'
1314
required: true
1415
app_token:
@@ -54,14 +55,11 @@ runs:
5455
}
5556
WIZARD_SHA=$(resolve_sha wizard "$WIZARD_REF")
5657
CONTEXT_MILL_SHA=$(resolve_sha context-mill "$CONTEXT_MILL_REF")
57-
POSTHOG_SHA=$(resolve_sha posthog "$POSTHOG_REF")
5858
echo "wizard_sha=$WIZARD_SHA" >> "$GITHUB_OUTPUT"
5959
echo "context_mill_sha=$CONTEXT_MILL_SHA" >> "$GITHUB_OUTPUT"
60-
echo "posthog_sha=$POSTHOG_SHA" >> "$GITHUB_OUTPUT"
6160
echo "Resolved SHAs:"
6261
echo " wizard ($WIZARD_REF) -> $WIZARD_SHA"
6362
echo " context-mill ($CONTEXT_MILL_REF) -> $CONTEXT_MILL_SHA"
64-
echo " posthog ($POSTHOG_REF) -> $POSTHOG_SHA"
6563
6664
# ------------------------------------------------------------------ wizard
6765
- name: Restore wizard cache
@@ -172,55 +170,3 @@ runs:
172170
shell: bash
173171
run: echo "CONTEXT_MILL_PATH=$HOME/context-mill" >> "$GITHUB_ENV"
174172

175-
# ----------------------------------------------------------- posthog (MCP)
176-
- name: Restore posthog cache
177-
id: cache-posthog
178-
uses: actions/cache/restore@0057852bfaa89a56745cba8c7296529d2fc39830 # v4
179-
with:
180-
path: ~/posthog
181-
key: posthog-${{ runner.os }}-${{ steps.resolve.outputs.posthog_sha }}
182-
183-
- name: Build PostHog MCP
184-
if: steps.cache-posthog.outputs.cache-hit != 'true'
185-
shell: bash
186-
env:
187-
POSTHOG_SHA: ${{ steps.resolve.outputs.posthog_sha }}
188-
run: |
189-
echo "::group::Fetching PostHog monorepo at $POSTHOG_SHA"
190-
rm -rf "$HOME/posthog"
191-
git init -q "$HOME/posthog"
192-
cd "$HOME/posthog"
193-
git remote add origin https://github.com/PostHog/posthog.git
194-
git fetch --depth 1 origin "$POSTHOG_SHA"
195-
git checkout -q FETCH_HEAD
196-
echo "::endgroup::"
197-
198-
echo "::group::Installing MCP dependencies (filtered to @posthog/mcp)"
199-
# The monorepo is cloned solely to build services/mcp, so install only
200-
# that package and its workspace dependencies. A full-workspace install
201-
# also fetches and compiles unrelated native addons from plugin-server
202-
# (lz4, node-rdkafka), which @posthog/mcp does not use and which break
203-
# node-gyp on a cold cache (gyp_main.py "Permission denied", make Error
204-
# 126) — the recurring "flaky install" failure. The trailing "..."
205-
# selects @posthog/mcp plus its workspace deps and nothing else.
206-
pnpm install --frozen-lockfile --filter "@posthog/mcp..."
207-
echo "::endgroup::"
208-
209-
echo "::group::Building MCP UI apps"
210-
cd "$HOME/posthog/services/mcp"
211-
pnpm build
212-
echo "::endgroup::"
213-
214-
# Drop the .git dir before caching — not needed to run, just bloat.
215-
rm -rf "$HOME/posthog/.git"
216-
217-
- name: Save posthog cache
218-
if: inputs.save_cache == 'true' && steps.cache-posthog.outputs.cache-hit != 'true'
219-
uses: actions/cache/save@0057852bfaa89a56745cba8c7296529d2fc39830 # v4
220-
with:
221-
path: ~/posthog
222-
key: posthog-${{ runner.os }}-${{ steps.resolve.outputs.posthog_sha }}
223-
224-
- name: Export MCP_PATH
225-
shell: bash
226-
run: echo "MCP_PATH=$HOME/posthog/services/mcp" >> "$GITHUB_ENV"

.github/workflows/wizard-ci.yml

Lines changed: 6 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -555,10 +555,10 @@ jobs:
555555
fi
556556
557557
- name: Setup wizard dependencies
558-
# Restores wizard / context-mill / MCP from the cache warmed by the
558+
# Restores wizard / context-mill from the cache warmed by the
559559
# setup-deps job (keyed on each repo's resolved commit SHA), falling
560560
# back to a clean build on a miss (e.g. macOS runners, cache eviction).
561-
# Exports WIZARD_PATH / CONTEXT_MILL_PATH / MCP_PATH.
561+
# Exports WIZARD_PATH / CONTEXT_MILL_PATH.
562562
uses: ./.github/actions/setup-wizard-deps
563563
with:
564564
wizard_ref: ${{ needs.discover.outputs.input_wizard_ref }}
@@ -606,33 +606,10 @@ jobs:
606606
echo "::warning::Context Mill server failed to start after 2 minutes"
607607
fi
608608
609-
# Start MCP server in background (consumes from local examples server)
610-
cd $MCP_PATH
611-
pnpm dev:local-resources &
612-
MCP_PID=$!
613-
disown $MCP_PID
609+
# The posthog MCP is the hosted prod server — no local MCP process.
610+
# MCP_URL overrides the wizard's local-mcp MCP half; skills stay local.
611+
echo "MCP_URL=https://mcp.posthog.com/mcp" >> $GITHUB_ENV
614612
615-
# Wait for MCP server to be ready (retry every 30s, max 2 minutes)
616-
echo "Waiting for MCP server to start..."
617-
MCP_READY=false
618-
for attempt in 1 2 3 4; do
619-
for i in {1..30}; do
620-
if curl -s http://localhost:8787/mcp > /dev/null 2>&1; then
621-
echo "MCP server is ready"
622-
MCP_READY=true
623-
break 2
624-
fi
625-
sleep 1
626-
done
627-
if [ "$attempt" -lt 4 ]; then
628-
echo "::warning::MCP server not ready after $((attempt * 30))s, retrying..."
629-
fi
630-
done
631-
if [ "$MCP_READY" = "false" ]; then
632-
echo "::warning::MCP server failed to start after 2 minutes"
633-
fi
634-
635-
echo "mcp_pid=$MCP_PID" >> $GITHUB_OUTPUT
636613
echo "context_mill_pid=$CONTEXT_MILL_PID" >> $GITHUB_OUTPUT
637614
env:
638615
GH_TOKEN: ${{ steps.app-token.outputs.token }}
@@ -642,7 +619,6 @@ jobs:
642619
# Dependency paths
643620
WIZARD_PATH: ${{ env.WIZARD_PATH }}
644621
CONTEXT_MILL_PATH: ${{ env.CONTEXT_MILL_PATH }}
645-
MCP_PATH: ${{ env.MCP_PATH }}
646622
# Dependency refs (for PR body)
647623
WIZARD_REF: ${{ needs.discover.outputs.input_wizard_ref }}
648624
CONTEXT_MILL_REF: ${{ needs.discover.outputs.input_context_mill_ref }}
@@ -689,7 +665,6 @@ jobs:
689665
POSTHOG_WIZARD_PROJECT_ID: ${{ secrets.GH_APP_POSTHOG_WIZARD_CI_BOT_TARGET_PROJECT_ID }}
690666
WIZARD_PATH: ${{ env.WIZARD_PATH }}
691667
CONTEXT_MILL_PATH: ${{ env.CONTEXT_MILL_PATH }}
692-
MCP_PATH: ${{ env.MCP_PATH }}
693668
WIZARD_REF: ${{ needs.discover.outputs.input_wizard_ref }}
694669
CONTEXT_MILL_REF: ${{ needs.discover.outputs.input_context_mill_ref }}
695670
POSTHOG_REF: ${{ needs.discover.outputs.input_posthog_ref }}
@@ -710,7 +685,6 @@ jobs:
710685
curl -s http://localhost:8765/skills-mcp-resources.zip -o skills-mcp-resources.zip || true
711686
712687
# Stop servers
713-
kill "$MCP_PID" 2>/dev/null || true
714688
kill "$CONTEXT_MILL_PID" 2>/dev/null || true
715689
716690
# Extract PR URL
@@ -766,7 +740,6 @@ jobs:
766740
env:
767741
WIZARD_OUTCOME: ${{ steps.execute-wizard.outcome }}
768742
MATRIX_APP: ${{ matrix.app }}
769-
MCP_PID: ${{ steps.run-wizard.outputs.mcp_pid }}
770743
CONTEXT_MILL_PID: ${{ steps.run-wizard.outputs.context_mill_pid }}
771744

772745
- name: Configure AWS credentials
@@ -825,7 +798,7 @@ jobs:
825798
echo "### Dependency Versions" >> $GITHUB_STEP_SUMMARY
826799
echo "- **wizard:** $WIZARD_REF" >> $GITHUB_STEP_SUMMARY
827800
echo "- **context-mill:** $CONTEXT_MILL_REF" >> $GITHUB_STEP_SUMMARY
828-
echo "- **mcp (posthog):** $POSTHOG_REF" >> $GITHUB_STEP_SUMMARY
801+
echo "- **mcp:** prod (mcp.posthog.com)" >> $GITHUB_STEP_SUMMARY
829802
echo "" >> $GITHUB_STEP_SUMMARY
830803
if [ -n "$PR_URL" ]; then
831804
echo "**PR:** $PR_URL" >> $GITHUB_STEP_SUMMARY

0 commit comments

Comments
 (0)