Skip to content

feat(codex): add OpenIAP Codex plugin#168

Open
hyochan wants to merge 14 commits into
mainfrom
codex/iapkit-chatgpt-mcp
Open

feat(codex): add OpenIAP Codex plugin#168
hyochan wants to merge 14 commits into
mainfrom
codex/iapkit-chatgpt-mcp

Conversation

@hyochan

@hyochan hyochan commented Jun 4, 2026

Copy link
Copy Markdown
Member

Summary

  • Add an OpenIAP Codex plugin marketplace entry backed by the IAPKit MCP endpoint for app in-app purchase implementation and review workflows.
  • Add an MCP server with stdio, standalone HTTP, and Kit-hosted Web Streamable HTTP entrypoints.
  • Expose the hosted Kit /mcp route for Codex/MCP connectors with bearer-token IAPKit project key support.
  • Document plugin-directory install, manual MCP config, local PR testing, and self-hosted connector setup under Kit docs, including an updated captured screenshot.

Preview

Readable Playwright-generated preview of the Codex MCP flow. The recording initializes the PR's MCP HTTP server, lists the iapkit_* tools visible to Codex, calls iapkit_revenue_analytics, calls iapkit_create_product, and returns an Expo setup snippet through iapkit_setup.

OpenIAP Codex MCP plugin usage preview

MP4: https://github.com/user-attachments/assets/f3432dc8-9246-4301-870e-aa9b25024fe1

The preview assets were uploaded as GitHub PR attachments and are intentionally not committed to the repository.

Validation

  • bun run --filter @hyodotdev/openiap-mcp-server lint
  • bun run --filter @hyodotdev/openiap-mcp-server test
  • bun run --filter @hyodotdev/openiap-mcp-server build
  • bun run audit:docs
  • bun run --filter @hyodotdev/openiap-kit lint
  • bun run --filter @hyodotdev/openiap-kit test
  • VITE_KIT_CONVEX_URL=https://example.convex.cloud bun run --filter @hyodotdev/openiap-kit smoke:server
  • python3 /Users/hyo/.codex/skills/.system/plugin-creator/scripts/validate_plugin.py plugins/openiap via a temporary venv with PyYAML
  • Compiled Kit server /mcp e2e: initialize, tools/list, iapkit_revenue_analytics, iapkit_create_product, and iapkit_simulate_webhook against a mock Kit API
  • Playwright readable preview uploaded as GitHub PR attachments; GIF 1.6 MB and MP4 448 KB

Notes

  • This is an experimental OpenIAP Codex plugin. The bundled MCP endpoint is IAPKit-backed by default and currently exposes iapkit_* tools.
  • This uses an IAPKit project API key, not an OpenAI API key.
  • Public self-serve publishing to the official OpenAI-curated Plugin Directory is not available yet; this PR adds a repo marketplace plugin that can be installed from Codex after adding the hyodotdev/openiap marketplace.
  • AGENTS.md has a pre-existing local typechange and is intentionally not included in this PR.

Summary by CodeRabbit

  • New Features

    • Public /mcp endpoint for MCP-over-HTTP, Codex plugin integration, and MCP-backed assistant workflows.
    • Revenue metrics date-range endpoint and queued product sync with job polling surfaced to clients.
    • Local dev server proxy updated to forward /mcp for testing.
  • Documentation

    • New Codex plugin guide, expanded AI assistants docs, improved docs navigation/titles, and explicit PR preview recording requirements/attachment guidance.
  • Tests

    • Added end-to-end and unit coverage for MCP flows, revenue analytics, product sync, and related error paths.

@coderabbitai

coderabbitai Bot commented Jun 4, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

Implements an IAPKit MCP server and HTTP/web transports, exposes a new /mcp endpoint in the kit server, adds revenue metrics and product-sync APIs and client helpers, updates docs and site navigation with a Codex plugin page, adds tests, updates Docker/build and dependency wiring, and requires PR preview recordings.

Changes

MCP Server Integration and API Expansion

Layer / File(s) Summary
Commit and PR workflow edits
.claude/commands/commit.md, .codex/skills/openiap-workflows/SKILL.md, knowledge/internal/06-git-deployment.md
Expanded branch/commit guidance, GQL-first staging instructions, and added a PR preview-recording requirement and upload guidance.
Dev build, Docker, dependency, and proxy
packages/kit/package.json, packages/kit/Dockerfile, packages/kit/vite.config.ts, packages/kit/README.md
Adds workspace dependency on the MCP package, copies mcp-server into Docker builder context with its node_modules, and proxies /mcp in dev; README documents /mcp dev usage.
Public API reference & sitemap
packages/kit/public/llms-full.txt, packages/kit/public/llms.txt, packages/kit/public/sitemap.xml
Documents new POST /mcp MCP endpoint, authentication guidance (IAPKit project API key / IAPKIT_API_KEY), and updates sitemap lastmod for AI assistants pages.
Docs site: Codex plugin page & nav
packages/kit/src/pages/docs/sections/codex-plugin.tsx, packages/kit/src/pages/docs/sections/ai-assistants.tsx, packages/kit/src/pages/docs/nav.ts, packages/kit/src/pages/docs/routes.tsx, packages/kit/src/pages/docs/DocsLayout.tsx, packages/kit/src/pages/index.tsx, packages/kit/src/pages/auth/index.tsx
Adds CodexPluginPage, links from AI assistants docs, registers route and nav entry, and derives docs page title from pathname.
Kit server MCP handler registration & tests
packages/kit/server/mcp.ts, packages/kit/server/server.ts, packages/kit/server/mcp.test.ts
Exports handleIapKitMcpRequest via web handler factory and mounts app.all("/mcp") before static serving; tests cover initialize/session header, tools/list, invalid JSON, and oversized payload handling.
MCP server core and tools
packages/mcp-server/src/mcp.ts, packages/mcp-server/src/index.ts, packages/mcp-server/package.json
Implements createIapKitMcpServer factory, registers a full IAPKit toolset, adds exports/subpath map and CLI entries, and refactors index to instantiate the factory.
MCP HTTP & Web transports + E2E tests
packages/mcp-server/src/http.ts, packages/mcp-server/src/web.ts, packages/mcp-server/test/http.test.ts
Adds createRemoteMcpHttpServer and createIapKitWebMcpHandler with session-based transports (mcp-session-id), CORS, body-size limits, auth parsing, JSON-RPC error mapping, and extensive integration tests for health, initialize, tools, authenticated calls, error and redaction paths.
kitClient helpers & tests
packages/mcp-server/src/kit-client.ts, packages/mcp-server/test/kit-client.test.ts
Adds revenueMetrics, syncProducts, and syncJob helpers; tests assert proper query/path encoding and baseUrl validation.
Subscriptions revenue endpoint & tests
packages/kit/server/api/v1/subscriptions.ts, packages/kit/server/api/v1/subscriptions.test.ts
Adds GET /revenue/:apiKey with ISO-date validation, from<=to, 92-day max, and Convex query forwarding; includes iso-day helper functions and tests for valid/invalid ranges.
Products sync test clarification
packages/kit/server/api/v1/products.ts, packages/kit/server/api/v1/products.test.ts
Clarifies sync is queued as background jobs and adds test asserting POST /products/{key}/sync/{platform} returns 202 with job metadata and calls enqueue mutation.

Sequence Diagram (high-level MCP flow)

sequenceDiagram
  participant Client
  participant KitServer
  participant WebMcpHandler
  participant IapKitMcpServer
  participant KitAPI
  Client->>KitServer: POST /mcp (SSE/stream, Authorization Bearer)
  KitServer->>WebMcpHandler: forward raw request
  WebMcpHandler->>IapKitMcpServer: initialize / tools/call (session transport)
  IapKitMcpServer->>KitAPI: proxied /v1/* calls (with bearer/API key)
  KitAPI-->>IapKitMcpServer: SSE / job stream / JSON responses
  IapKitMcpServer-->>WebMcpHandler: SSE response (data:)
  WebMcpHandler-->>KitServer: response body/headers (mcp-session-id)
  KitServer-->>Client: stream responses (SSE)
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Possibly related PRs

Suggested labels

rabbit2: server, openiap-kit, :watch: ux

Poem

🐰 I hopped across the code tonight,
Built MCP paths that stream and light,
Docs, previews, tools in tow —
Codex chats and metrics flow,
IAPKit hums; the rabbit's bright!

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 6.67% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Title check ⚠️ Warning The PR title 'feat(codex): add OpenIAP Codex plugin' is partially related to the changeset but uses outdated branding. The PR actually adds an IAPKit (not OpenIAP) Codex MCP plugin, which is the main deliverable. The title references the correct feature type but uses incorrect product naming. Update the PR title to 'feat(codex): add IAPKit Codex MCP plugin' to accurately reflect the IAPKit branding used throughout the changeset and PR objectives.
✅ Passed checks (3 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/iapkit-chatgpt-mcp

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@hyochan hyochan added kit IAPKit (receipt-validation SaaS) 🎯 feature New feature 📖 documentation Improvements or additions to documentation labels Jun 4, 2026

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request introduces a ChatGPT / MCP connector endpoint at /mcp to the IAPKit server, allowing MCP clients to inspect products, subscriptions, and setup state. It adds new HTTP and Web-standard transports to the MCP server package and updates the documentation pages. The review feedback points out several important issues: a runtime ReferenceError in Web Standard environments due to the use of Node's Buffer global, a potential credential leak where client API keys from bearer tokens are not redacted in error responses, and improper handling of client-side parsing and payload-size errors which incorrectly return 500 Internal Server Error instead of 400 or 413 status codes.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread packages/mcp-server/src/web.ts
Comment thread packages/mcp-server/src/mcp.ts Outdated
Comment thread packages/mcp-server/src/http.ts
Comment thread packages/mcp-server/src/web.ts
@hyochan hyochan changed the title feat(kit): add IAPKit ChatGPT MCP connector feat(kit): add IAPKit Codex MCP plugin Jun 4, 2026
@hyochan hyochan force-pushed the codex/iapkit-chatgpt-mcp branch from 1ef85d4 to 86c5eb0 Compare June 4, 2026 13:07
hyochan added 4 commits June 4, 2026 22:28
Add an IAPKit-branded MCP server entrypoint for ChatGPT connectors, expose the hosted Kit /mcp endpoint, and document the ChatGPT plugin setup flow with a captured docs screenshot.

Validation: bun run --filter @hyodotdev/openiap-mcp-server lint; bun run --filter @hyodotdev/openiap-mcp-server test; bun run --filter @hyodotdev/openiap-mcp-server build; bun run audit:docs; bun run --filter @hyodotdev/openiap-kit lint; bun run --filter @hyodotdev/openiap-kit test; VITE_KIT_CONVEX_URL=https://example.convex.cloud bun run --filter @hyodotdev/openiap-kit smoke:server
Address PR review findings by removing the Web-standard Buffer dependency, returning 400/413 for client JSON and payload errors, and redacting bearer project keys from MCP tool error payloads.

Validation: bun run --filter @hyodotdev/openiap-mcp-server lint; bun run --filter @hyodotdev/openiap-mcp-server test; bun run --filter @hyodotdev/openiap-mcp-server build; bun run audit:docs; bun run --filter @hyodotdev/openiap-kit lint; bun run --filter @hyodotdev/openiap-kit test; VITE_KIT_CONVEX_URL=https://example.convex.cloud bun run --filter @hyodotdev/openiap-kit smoke:server
@hyochan hyochan force-pushed the codex/iapkit-chatgpt-mcp branch from 86c5eb0 to 2af1bea Compare June 4, 2026 13:29
@hyochan hyochan marked this pull request as ready for review June 4, 2026 14:35

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 3

🧹 Nitpick comments (2)
packages/kit/server/mcp.ts (1)

3-5: ⚡ Quick win

Add JSDoc for the exported MCP handler.

This exported API should include a short JSDoc describing purpose and env-driven behavior.

Suggested change
+/**
+ * Handles MCP HTTP requests for the Kit-hosted IAPKit MCP endpoint.
+ * Set IAPKIT_MCP_LEGACY_ALIASES=true to expose legacy OpenIAP tool aliases.
+ */
 export const handleIapKitMcpRequest = createIapKitWebMcpHandler({
   includeLegacyOpenIapAliases: process.env.IAPKIT_MCP_LEGACY_ALIASES === "true",
 });

As per coding guidelines, "Add JSDoc comments for public functions and exported APIs".

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/kit/server/mcp.ts` around lines 3 - 5, Add a JSDoc block above the
exported constant handleIapKitMcpRequest that briefly describes its purpose (it
creates/exports the MCP request handler for IAP Kit via
createIapKitWebMcpHandler) and documents the env-driven behavior: that the
includeLegacyOpenIapAliases option is toggled by the IAPKIT_MCP_LEGACY_ALIASES
environment variable (accepted value "true"), explaining the effect when
enabled; reference the symbol names handleIapKitMcpRequest,
createIapKitWebMcpHandler, includeLegacyOpenIapAliases and the env var
IAPKIT_MCP_LEGACY_ALIASES in the comment.
packages/mcp-server/src/http.ts (1)

36-48: ⚡ Quick win

Add JSDoc for exported interfaces/functions.

This file exports public APIs without JSDoc comments.

💡 Suggested fix
+/** Configuration for the remote MCP HTTP server. */
 export interface RemoteMcpHttpServerOptions {
@@
+/** Runtime handle for a started or startable remote MCP HTTP server. */
 export interface RemoteMcpHttpServer {
@@
+/** Creates the remote MCP HTTP server without binding a socket. */
 export function createRemoteMcpHttpServer(
@@
+/** Creates and starts the remote MCP HTTP server. */
 export async function startRemoteMcpHttpServer(

As per coding guidelines: Add JSDoc comments for public functions and exported APIs.

Also applies to: 50-52, 160-163

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/mcp-server/src/http.ts` around lines 36 - 48, Add JSDoc comments for
the exported public APIs: document the RemoteMcpHttpServerOptions and
RemoteMcpHttpServer interfaces and any other exported symbols around the
indicated ranges (the exports at lines ~50-52 and ~160-163). For each interface
include a short description and per-property `@property/`@param-style entries that
state the type, purpose, optionality, and default value (e.g., host, port,
mcpPath, allowedOrigins, includeLegacyOpenIapAliases, logger). For exported
functions/classes (those around 50-52 and 160-163) add a brief description,
parameter and return annotations (`@param`, `@returns`), and an example or note
about side effects (e.g., server creation/close semantics) so the public API is
well-documented.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@packages/kit/src/pages/docs/sections/codex-plugin.tsx`:
- Around line 131-160: The "Available tools" list is missing three
MCP-registered tools and should match the server exports: add list entries for
iapkit_check_status, iapkit_simulate_purchase, and iapkit_simulate_webhook
(using the same <li><code>...</code> format as the other items), ensure
iapkit_inspect_state remains (do not rename to iapkit_insert_state), and update
the prose/count to reflect the full set of 13 iapkit_* tools so the docs exactly
mirror the MCP server registrations.

In `@packages/mcp-server/src/http.ts`:
- Around line 171-173: The startup promise that calls remote.server.listen must
also reject on server 'error' events and remove its listener after
resolution/rejection: update the Promise in startRemoteMcpHttpServer (the block
that calls remote.server.listen) to attach a one-time 'error' listener that
rejects the Promise (and remove that listener when the listen callback runs), so
EADDRINUSE and other listen errors cause initialization to fail; also add JSDoc
comments for the exported types and functions RemoteMcpHttpServerOptions,
RemoteMcpHttpServer, createRemoteMcpHttpServer, and startRemoteMcpHttpServer
following the project’s JSDoc guideline to document parameters, return values,
and thrown errors.

In `@packages/mcp-server/src/mcp.ts`:
- Line 550: The simulate_webhook code currently uses
Buffer.from(...).toString("base64") which relies on Node globals and breaks in
non-Node runtimes; replace that line by encoding the JSON with TextEncoder and
then base64-encoding via btoa (e.g., const json = JSON.stringify(message); const
bytes = new TextEncoder().encode(json); const data =
btoa(String.fromCharCode(...bytes))); update the reference in simulate_webhook
to use TextEncoder and btoa instead of Buffer so the function is web-standard
and UTF-8 safe.

---

Nitpick comments:
In `@packages/kit/server/mcp.ts`:
- Around line 3-5: Add a JSDoc block above the exported constant
handleIapKitMcpRequest that briefly describes its purpose (it creates/exports
the MCP request handler for IAP Kit via createIapKitWebMcpHandler) and documents
the env-driven behavior: that the includeLegacyOpenIapAliases option is toggled
by the IAPKIT_MCP_LEGACY_ALIASES environment variable (accepted value "true"),
explaining the effect when enabled; reference the symbol names
handleIapKitMcpRequest, createIapKitWebMcpHandler, includeLegacyOpenIapAliases
and the env var IAPKIT_MCP_LEGACY_ALIASES in the comment.

In `@packages/mcp-server/src/http.ts`:
- Around line 36-48: Add JSDoc comments for the exported public APIs: document
the RemoteMcpHttpServerOptions and RemoteMcpHttpServer interfaces and any other
exported symbols around the indicated ranges (the exports at lines ~50-52 and
~160-163). For each interface include a short description and per-property
`@property/`@param-style entries that state the type, purpose, optionality, and
default value (e.g., host, port, mcpPath, allowedOrigins,
includeLegacyOpenIapAliases, logger). For exported functions/classes (those
around 50-52 and 160-163) add a brief description, parameter and return
annotations (`@param`, `@returns`), and an example or note about side effects (e.g.,
server creation/close semantics) so the public API is well-documented.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: dd79cdea-24f9-409d-86e1-eb878b7390a8

📥 Commits

Reviewing files that changed from the base of the PR and between fb5d05a and 94bbfc4.

⛔ Files ignored due to path filters (3)
  • .github/pr-previews/pr-168-iapkit-codex-mcp-preview.gif is excluded by !**/*.gif
  • .github/pr-previews/pr-168-iapkit-codex-mcp-preview.mp4 is excluded by !**/*.mp4
  • bun.lock is excluded by !**/*.lock
📒 Files selected for processing (33)
  • .claude/commands/commit.md
  • .codex/skills/openiap-workflows/SKILL.md
  • knowledge/internal/06-git-deployment.md
  • packages/kit/Dockerfile
  • packages/kit/README.md
  • packages/kit/package.json
  • packages/kit/public/docs/screenshots/codex-plugin.webp
  • packages/kit/public/llms-full.txt
  • packages/kit/public/llms.txt
  • packages/kit/public/sitemap.xml
  • packages/kit/server/api/v1/products.test.ts
  • packages/kit/server/api/v1/products.ts
  • packages/kit/server/api/v1/subscriptions.test.ts
  • packages/kit/server/api/v1/subscriptions.ts
  • packages/kit/server/mcp.test.ts
  • packages/kit/server/mcp.ts
  • packages/kit/server/server.ts
  • packages/kit/src/pages/auth/index.tsx
  • packages/kit/src/pages/docs/DocsLayout.tsx
  • packages/kit/src/pages/docs/nav.ts
  • packages/kit/src/pages/docs/routes.tsx
  • packages/kit/src/pages/docs/sections/ai-assistants.tsx
  • packages/kit/src/pages/docs/sections/codex-plugin.tsx
  • packages/kit/src/pages/index.tsx
  • packages/kit/vite.config.ts
  • packages/mcp-server/package.json
  • packages/mcp-server/src/http.ts
  • packages/mcp-server/src/index.ts
  • packages/mcp-server/src/kit-client.ts
  • packages/mcp-server/src/mcp.ts
  • packages/mcp-server/src/web.ts
  • packages/mcp-server/test/http.test.ts
  • packages/mcp-server/test/kit-client.test.ts

Comment thread packages/kit/src/pages/docs/sections/codex-plugin.tsx
Comment thread packages/mcp-server/src/http.ts Outdated
Comment thread packages/mcp-server/src/mcp.ts Outdated

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
packages/mcp-server/src/mcp.ts (1)

486-500: ⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Don't gate the iOS instruction path on credentials.

This resolves apiKey and baseUrl before branching on platform, so iapkit_simulate_webhook({ platform: "IOS" }) now returns apiKey required even though the iOS branch only prints instructions and never calls Kit.

💡 Suggested fix
     async (args, extra) => {
-      const apiKey =
-        args.apiKey ??
-        extra?.authInfo?.token ??
-        process.env.IAPKIT_API_KEY;
-      if (!apiKey) return err(new Error("apiKey required"));
-      const validationError = validateApiKey(apiKey);
-      if (validationError) return err(new Error(validationError), apiKey);
-      let baseUrl: string;
-      try {
-        baseUrl = normalizeKitBaseUrl(
-          args.baseUrl ?? process.env.IAPKIT_BASE_URL,
-        );
-      } catch (error) {
-        return err(error, apiKey);
-      }
       if (args.platform === "Android") {
+        const apiKey =
+          args.apiKey ??
+          extra?.authInfo?.token ??
+          process.env.IAPKIT_API_KEY;
+        if (!apiKey) return err(new Error("apiKey required"));
+        const validationError = validateApiKey(apiKey);
+        if (validationError) return err(new Error(validationError), apiKey);
+        let baseUrl: string;
+        try {
+          baseUrl = normalizeKitBaseUrl(
+            args.baseUrl ?? process.env.IAPKIT_BASE_URL,
+          );
+        } catch (error) {
+          return err(error, apiKey);
+        }
         const message = {
           version: "1.0",
           packageName: "com.example.app",
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/mcp-server/src/mcp.ts` around lines 486 - 500, The code resolves
apiKey and baseUrl (using validateApiKey and normalizeKitBaseUrl) before
switching on platform, which causes iOS-only flows (e.g.,
iapkit_simulate_webhook with platform "IOS") to fail with "apiKey required"; fix
by moving the apiKey and baseUrl resolution/validation (the calls to
validateApiKey and normalizeKitBaseUrl and their error returns) into the branch
that actually calls the Kit (the non-iOS/web path), and ensure the iOS branch in
the function iapkit_simulate_webhook (or the surrounding platform switch)
returns the instructional output without requiring apiKey/baseUrl; keep existing
error handling logic but scope it so only the code paths that call the Kit
perform the credential checks.
🧹 Nitpick comments (1)
packages/mcp-server/src/mcp.ts (1)

211-218: ⚡ Quick win

Document the exported MCP factory.

createIapKitMcpServer is a public API and its contract changed in this PR, but it still has no JSDoc.

As per coding guidelines "Add JSDoc comments for public functions and exported APIs".

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/mcp-server/src/mcp.ts` around lines 211 - 218, Add a JSDoc block
above the exported factory function createIapKitMcpServer describing its
purpose, return type and important behavior: document that it creates and
returns an McpServer configured with name IAPKIT_MCP_SERVER_NAME, version
IAPKIT_MCP_SERVER_VERSION and websiteUrl "https://kit.openiap.dev", and that it
registers tools via registerIapKitTools before returning; include `@returns`
{McpServer} and mention any side effects (registration) and stability/usage
notes for callers.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Outside diff comments:
In `@packages/mcp-server/src/mcp.ts`:
- Around line 486-500: The code resolves apiKey and baseUrl (using
validateApiKey and normalizeKitBaseUrl) before switching on platform, which
causes iOS-only flows (e.g., iapkit_simulate_webhook with platform "IOS") to
fail with "apiKey required"; fix by moving the apiKey and baseUrl
resolution/validation (the calls to validateApiKey and normalizeKitBaseUrl and
their error returns) into the branch that actually calls the Kit (the
non-iOS/web path), and ensure the iOS branch in the function
iapkit_simulate_webhook (or the surrounding platform switch) returns the
instructional output without requiring apiKey/baseUrl; keep existing error
handling logic but scope it so only the code paths that call the Kit perform the
credential checks.

---

Nitpick comments:
In `@packages/mcp-server/src/mcp.ts`:
- Around line 211-218: Add a JSDoc block above the exported factory function
createIapKitMcpServer describing its purpose, return type and important
behavior: document that it creates and returns an McpServer configured with name
IAPKIT_MCP_SERVER_NAME, version IAPKIT_MCP_SERVER_VERSION and websiteUrl
"https://kit.openiap.dev", and that it registers tools via registerIapKitTools
before returning; include `@returns` {McpServer} and mention any side effects
(registration) and stability/usage notes for callers.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 375ddcb2-c0b2-47fc-84cd-b25e9dcbd358

📥 Commits

Reviewing files that changed from the base of the PR and between b98f295 and 559f730.

📒 Files selected for processing (8)
  • packages/docs/src/pages/docs/kit-backend.tsx
  • packages/docs/src/pages/docs/webhooks.tsx
  • packages/kit/server/mcp.ts
  • packages/mcp-server/src/http.ts
  • packages/mcp-server/src/index.ts
  • packages/mcp-server/src/mcp.ts
  • packages/mcp-server/src/web.ts
  • packages/mcp-server/test/http.test.ts
🚧 Files skipped from review as they are similar to previous changes (3)
  • packages/kit/server/mcp.ts
  • packages/mcp-server/src/web.ts
  • packages/mcp-server/test/http.test.ts

@hyochan hyochan changed the title feat(kit): add IAPKit Codex MCP plugin feat(codex): add OpenIAP Codex plugin Jun 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

📖 documentation Improvements or additions to documentation 🎯 feature New feature kit IAPKit (receipt-validation SaaS)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant