Skip to content

Serve staff and public skills through one Recoup connection - #1298

Merged
sidneyswift merged 4 commits into
mainfrom
codex/recoup-connector-skills
Nov 25, 2026
Merged

sidneyswift merged 4 commits into
mainfrom
codex/recoup-connector-skills

Conversation

@sidneyswift

@sidneyswift sidneyswift commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor

What changed

Serve the authorized Recoup skills catalog through the existing /mcp connection on sign-in. Native Skills over MCP clients get the authorized catalog. ChatGPT and other tool-based clients can use the read-only recoup_skills tool to search the catalog and load instructions or supporting files.

Customers get the public catalog. Recoup organization members, specific staff skills grantees, and OAuth users with a currently verified @recoupable.com email on the Privy subject recorded on their grant get both catalogs. This entitlement only covers skill content. Selected Context grants keep their existing workspace-only surface.

The ChatGPT plugin page shows the submitted package. Keep that package public. The editor may need to refresh the Recoup connection's tool catalog after the server release so the existing ChatGPT listing can use the new tool.

Verification

  • Built the pinned 47 public and 84 staff skill bundles.
  • Tested both native MCP and the legacy connector path with customer and verified staff identities, exact domain matching, loss of email verification, direct reads, and invalid file paths.
  • Passed the extension, OAuth route, compatibility, and TypeScript checks.

Summary by cubic

Serves the authorized Recoup skills catalog on the existing /mcp connection, replacing the dedicated staff endpoint. Staff skill access is now granted per signed-in account instead of per connection, and the catalog is built once per audience and shared across MCP transports.

Access

  • Staff skills open to Recoup organization members, accounts listed in RECOUP_STAFF_SKILL_ACCOUNT_IDS, and OAuth users whose recorded Privy subject currently has a verified @recoupable.com email.
  • The entitlement is read-only and independent of admin or write tool permissions. Selected Context grants keep their workspace-only surface.
  • Native Skills clients receive the authorized catalog through the same skills/list, skills/get, and resources/read calls.

Tool clients

  • New recoup_skills tool lets ChatGPT-style clients search the catalog and load skill instructions or supporting files. It enforces the shared full-OAuth rate limit and account constraints.
  • Public plugin packages stay public; refresh the ChatGPT connection's tool catalog after release to expose the new tool.

Written for commit f3662e3. Summary will update on new commits.

View guided diff Turn on auto-fix

@vercel

vercel Bot commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
api Ready Ready Preview Nov 25, 2026 10:47pm UTC

Request Review

@coderabbitai

coderabbitai Bot commented Nov 25, 2026 •

Copy link
Copy Markdown

Important

  • Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

Run configuration

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 25, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-25T22:28:57.996406Z 3c3a022 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 3c3a022654

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +49 to +50
const auth = extra.authInfo as McpAuthInfo | undefined;
if (!auth?.extra.accountId || auth.extra.oauth?.selectedContext) return unavailable;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Resolve the account through the MCP auth helper

Whenever recoup_skills is called, this manually trusts extra.authInfo.extra.accountId instead of passing the authentication context through resolveAccountId(), bypassing the repository's centralized MCP account validation and access-control path. Use the required resolver before selecting the authorized skill catalog.

AGENTS.md reference: AGENTS.md:L288-L290

Useful? React with 👍 / 👎.

Comment on lines +36 to +40
file: z
.string()
.min(1)
.max(1024)
.optional()

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Reject file requests that omit a skill

When a caller supplies file without skill, the schema accepts the request but the handler enters the catalog-listing branch and silently ignores file; similarly, search-only fields can be supplied alongside skill and are discarded. Model clients can therefore receive a successful but unrelated response instead of a validation error, so encode the listing-versus-loading alternatives and their mutual exclusions in the input schema.

AGENTS.md reference: AGENTS.md:L153-L158

Useful? React with 👍 / 👎.

@cubic-dev-ai cubic-dev-ai Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

All reported issues were addressed across 11 files

Architecture diagram
sequenceDiagram
    participant Client as MCP Client (Claude/ChatGPT)
    participant Route as /mcp Route
    participant Handler as createModernRecoupHandler
    participant Skills as getRecoupSkills
    participant Tool as recoup_skills Tool
    participant Auth as hasRecoupStaffSkills
    participant Privy as Privy API
    participant Admin as isRecoupAdmin

    Client->>Handler: skills/list, skills/get, resources/read
    Handler->>Auth: hasRecoupStaffSkills(auth)
    
    alt Signed-in account with accountId and no selectedContext
        alt Account in RECOUP_STAFF_SKILL_ACCOUNT_IDS
            Auth-->>Handler: true
        else Not in explicit grant list
            Auth->>Admin: isRecoupAdmin(accountId)
            alt Recoup org member
                Admin-->>Auth: true
            else Not admin
                opt OAuth subject present
                    Auth->>Privy: getVerifiedPrivyEmails(subject)
                    Privy-->>Auth: verified emails
                    alt Email domain is @recoupable.com
                        Auth-->>Handler: true
                    else Non-recoupable email
                        Auth-->>Handler: false
                    end
                end
            end
        end
    else Anonymous or selectedContext grant
        Auth-->>Handler: false
    end

    alt Staff access granted
        Handler->>Skills: getRecoupSkills("all")
    else Public only
        Handler->>Skills: getRecoupSkills("public")
    end
    Skills-->>Handler: Authorized skill catalog
    Handler-->>Client: skills list/get/read response

    Client->>Tool: recoup_skills({query, skill, file})
    Tool->>Auth: hasRecoupStaffSkills(auth)
    Auth-->>Tool: staff access boolean
    
    alt Staff access granted
        Tool->>Skills: getRecoupSkills("all")
    else Public only
        Tool->>Skills: getRecoupSkills("public")
    end
    
    alt Search mode (no skill name)
        Skills-->>Tool: Catalog entries
        Tool-->>Client: JSON search results with pagination
    else Load skill file
        Skills-->>Tool: Skill entry with resource URI
        Tool->>Tool: readRecoupSkillFile(uri)
        alt Text file
            Tool-->>Client: Text content
        else Binary file
            Tool-->>Client: Base64 resource blob
        end
    end

    Note over Route,Privy: OAuth grant records preserve Privy subject for staff email verification
    Note over Tool: Selected Context grants bypass staff skills entitlement
Loading

Reply with feedback, questions, or to request a fix.

View guided diff | Turn on auto-fix | Re-trigger cubic

Comment thread docs/mcp-skills.md Resolved
Comment thread lib/mcp/skills/getRecoupSkills.ts Resolved

@cubic-dev-ai cubic-dev-ai Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

All reported issues were addressed across 9 files (changes from recent commits).

Reply with feedback, questions, or to request a fix.

View guided diff | Turn on auto-fix | Re-trigger cubic

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

1 issue found across 4 files (changes from recent commits).

Confidence score: 3/5

  • In oauthRoute.test.ts, the rate-limit assertion preserves a generic HTTP 500 for native clients instead of an MCP error or retry signal. Update the rate-limit handling to return a client-actionable response.
Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="app/mcp/__tests__/oauthRoute.test.ts">

<violation number="1" location="app/mcp/__tests__/oauthRoute.test.ts:431">
P2: This assertion locks native skill requests to HTTP 500 when the shared rate limit rejects, so native clients receive a generic server failure instead of an MCP error or retry signal. Handle the rate-limit exception in the native handler and return the appropriate MCP error response rather than treating this 500 as the expected contract.</violation>
</file>

Reply with feedback, questions, or to request a fix.

View guided diff | Turn on auto-fix | Re-trigger cubic

checkFullOAuthRateLimit.mockRejectedValueOnce(
new Error("Tool rate limit reached; retry in 6 seconds"),
);
expect((await POST(modernRequest("skills/list"))).status).toBe(500);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2: This assertion locks native skill requests to HTTP 500 when the shared rate limit rejects, so native clients receive a generic server failure instead of an MCP error or retry signal. Handle the rate-limit exception in the native handler and return the appropriate MCP error response rather than treating this 500 as the expected contract.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At app/mcp/__tests__/oauthRoute.test.ts, line 431:

<comment>This assertion locks native skill requests to HTTP 500 when the shared rate limit rejects, so native clients receive a generic server failure instead of an MCP error or retry signal. Handle the rate-limit exception in the native handler and return the appropriate MCP error response rather than treating this 500 as the expected contract.</comment>

<file context>
@@ -417,6 +425,11 @@ it("uses the signed-in identity for native skills and the ChatGPT tool on the sa
+    checkFullOAuthRateLimit.mockRejectedValueOnce(
+      new Error("Tool rate limit reached; retry in 6 seconds"),
+    );
+    expect((await POST(modernRequest("skills/list"))).status).toBe(500);
+
     getVerifiedPrivyEmails.mockResolvedValue([]);
</file context>

@sidneyswift
sidneyswift merged commit e4751a0 into main Nov 25, 2026
9 checks passed

This branch was successfully deployed

1 active deployment
Preview — f3662e37 Deployed Nov 25, 2026 by vercel[bot]
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