Skip to content

[codex] Add MCP HTTP transport#10

Draft
hookdump wants to merge 13 commits into
xdev-2316-crud-for-blueprintsfrom
codex/mcp-http-transport-stack
Draft

[codex] Add MCP HTTP transport#10
hookdump wants to merge 13 commits into
xdev-2316-crud-for-blueprintsfrom
codex/mcp-http-transport-stack

Conversation

@hookdump
Copy link
Copy Markdown

@hookdump hookdump commented Jun 2, 2026

Summary

  • adds an opt-in Streamable HTTP transport mode for @churnkey/mcp while keeping stdio as the default
  • supports session-scoped HTTP transports at /mcp, configurable host/port/path, host allow-listing, and opt-in CORS
  • accepts Churnkey credentials from env vars or from initialization request headers, including Authorization: Bearer for future hosted/OAuth-adjacent auth work
  • documents the recommended mcp.churnkey.co docs/root and /mcp protocol endpoint split

OAuth foundation

This does not implement OAuth yet. The HTTP request auth boundary is isolated in loadHttpRequestConfig(), so the future OAuth task can swap bearer-token validation/resource metadata into that layer without changing MCP tool registration.

Validation

  • pnpm exec biome check packages/mcp/src/config.ts packages/mcp/src/http.ts packages/mcp/src/bin.ts packages/mcp/src/index.ts packages/mcp/tests/config.test.ts
  • pnpm --filter @churnkey/mcp typecheck
  • pnpm --filter @churnkey/mcp test
  • pnpm --filter @churnkey/mcp build
  • Streamable HTTP SDK client smoke: initialized against http://127.0.0.1:3341/mcp and listed 19 tools
  • pre-push hook: root pnpm typecheck and pnpm test passed

hookdump and others added 13 commits May 20, 2026 17:24
The Data API returns error bodies as plain text, but the client only read
a JSON `message` field, so every validation/authorization failure showed as
a generic "Churnkey API error <status>". Relay the server message verbatim
and add clearer 403/404 fallbacks.

Contract/doc alignment with the dashboard:
- list_blueprints: document the new hasUnpublishedChanges flag and that
  status is a coarse subset of the dashboard badges (not a 1:1 mirror)
- get_blueprint: document the step/offer/survey-choice guid response shape
- list_segments: document audience filter rules, priority, enabled, and
  that A/B variant segments appear as separate entries
- update_blueprint_draft: brandImage validation now mirrors the server
  (path ends in png/jpg/jpeg/gif/webp, or images.churnkey.co); reject
  empty-string step/choice guids instead of silently treating as absent
- dsr_delete: document the deleted/reasonForRejection outcome
- README: scope the live/test mode note (sessions + DSR only; config is
  shared and recoveries are not mode-partitioned); drop the phantom
  invoiceMonth breakdown from the changelog

Tests: add client error-handling cases and brandImage validation cases;
add scripts/smoke.mjs for end-to-end checks against a local churnkey-api.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
New tools so an agent can edit a flow without resending the whole steps array:

- update_blueprint_offer: change an offer's type + functional config
  (discount/pause/trial/redirect/plan-change), addressable on an offer step,
  a survey choice, or a structured follow-up option via guids.
- edit_survey_structure: add/remove/reorder survey choices and configure a
  choice's follow-up (freeform / structured / freeform-structured / none).
- add_blueprint_step / remove_blueprint_step: add a step at a canonical place
  (server builds the base step) or remove one by stepGuid.
- update_blueprint_step gained survey behavior (randomize, followupRequired,
  minLength) and freeform/confirm config.
- set_segment_enabled and update_segment_filter for segment config.

Draft blueprint edits are draft-only and not confirm-gated (publish is the
live gate; destructive ones carry destructiveHint). Segment edits act on live
config so they require a confirm literal. Adds routing/validation tests and an
observed reversible write round-trip to scripts/smoke.mjs.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@hookdump hookdump force-pushed the xdev-2316-crud-for-blueprints branch from 9a67918 to 03da3d7 Compare June 3, 2026 19:38
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