Repository navigation
Serve staff and public skills through one Recoup connection #1298
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
3c3a022
Serve authorized Recoup skills on the existing connector
sidneyswift c3a3bac
Use shared MCP authorization and rate limits for skill reads
sidneyswift d8d5ac3
Share the catalog budget across MCP transports
sidneyswift f3662e3
Merge remote-tracking branch 'origin/main' into codex/recoup-connecto…
sidneyswift File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,40 +1,35 @@ | ||
| # Recoup Skills over MCP | ||
|
|
||
| Recoup serves the native Skills extension (`io.modelcontextprotocol/skills`) | ||
| to clients using MCP `2026-07-28`. | ||
|
|
||
| ## Claude Code setup | ||
|
|
||
| Connect Recoup for customer-facing skills and tools. Recoup staff can add the | ||
| second connection for internal skills. Authorize Recoup Staff with the full | ||
| tools permission and a Recoup organization member account or a staff skills grant. | ||
|
|
||
| ```sh | ||
| claude mcp add --transport http recoup https://api.recoupable.dev/mcp | ||
| claude mcp add --transport http recoup-staff https://api.recoupable.dev/mcp/staff | ||
| ``` | ||
|
|
||
| Use `/skills` to find skills from both connections. For example, use | ||
| `/recoup:recoup-song-check-credits` or `/recoup-staff:recoup-internal-weekly-usage-review`. | ||
| Existing Recoup connections already use the first endpoint. Recoup Staff serves | ||
| skills and their resources. Recoup serves the tools those skills may need. | ||
| Selected Context grants retain their Context-only surface. | ||
|
|
||
| Both catalogs fit within Claude Code's 100-skill limit per connection. | ||
| [Claude Code MCP skill limits](https://code.claude.com/docs/en/mcp#mcp-skill-limitations) | ||
| Use the Recoup connector at `https://api.recoupable.dev/mcp` and sign in to | ||
| Recoup. Signed-in accounts using the standard connector grant can use | ||
| customer-facing skills. The connector | ||
| also makes internal skills available to Recoup organization members, accounts | ||
| with a staff skills grant, and OAuth users whose Recoup sign-in identity has a | ||
| currently verified `@recoupable.com` email. These grants apply to skill | ||
| content. Recoup tool actions continue to enforce their existing permissions. | ||
|
|
||
| In ChatGPT, ask the connected Recoup app to find or use a Recoup skill. The | ||
| `recoup_skills` tool searches the authorized catalog and reads skill | ||
| instructions and supporting files. ChatGPT's plugin listing shows the skills | ||
| included in the submitted plugin package. | ||
|
|
||
| Clients with native Skills over MCP support can also use `skills/list`, | ||
| `skills/get`, and `resources/read` on the same connection. For Claude Code, | ||
| use `/skills` or ask Recoup to find a skill by name if its menu reaches the | ||
| client's display limit. Selected Context grants keep their workspace-only | ||
| tool surface. | ||
|
|
||
| ## Granting staff skills access | ||
|
|
||
| Use the server-side `RECOUP_STAFF_SKILL_ACCOUNT_IDS` setting for accounts that | ||
| need access to staff skills without organization membership. Set it to a | ||
| comma-separated list of exact Recoup account IDs. This grants access only to | ||
| the staff skills connection. The account still needs full tools consent. | ||
| Use the server-side `RECOUP_STAFF_SKILL_ACCOUNT_IDS` setting for explicit | ||
| grants. Set it to a comma-separated list of exact Recoup account IDs. | ||
|
|
||
| Use an account with customer-facing access when scanning or packaging the | ||
| public plugin so the submitted package contains only customer-facing skills. | ||
|
|
||
| ## Updating the catalog | ||
|
|
||
| The [Skills repository](https://github.com/recoupable/skills) owns the skill | ||
| source and supports the existing install paths. To release a catalog update, | ||
| bump the full Skills commit SHA in `scripts/mcp-skills/build.mjs` and run | ||
| `pnpm build:mcp-skills`. The build validates both catalogs and checks their | ||
| sizes against Claude Code's limit. Each deployment packages the same skill | ||
| definitions and supporting files until the next API release. | ||
| source. To release a catalog update, bump the Skills commit SHA in | ||
| `scripts/mcp-skills/build.mjs` and run `pnpm build:mcp-skills`. This validates | ||
| the catalog and packages the skill definitions and supporting files with the API. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| import type { McpAuthInfo } from "../verifyApiKey"; | ||
|
|
||
| /** Staff skills are a read entitlement independent of administrative and write permissions. */ | ||
| export async function hasRecoupStaffSkills( | ||
| accountId: string, | ||
| auth?: McpAuthInfo, | ||
| ): Promise<boolean> { | ||
| if (!accountId || auth?.extra.oauth?.selectedContext) return false; | ||
| if (process.env.RECOUP_STAFF_SKILL_ACCOUNT_IDS?.split(",").some(id => id.trim() === accountId)) | ||
| return true; | ||
|
|
||
| try { | ||
| const { isRecoupAdmin } = await import("@/lib/organizations/isRecoupAdmin"); | ||
| if (await isRecoupAdmin(accountId)) return true; | ||
| const subject = auth?.extra.oauth?.subject; | ||
| if (!subject) return false; | ||
| const { getVerifiedPrivyEmails } = await import("@/lib/privy/getVerifiedPrivyEmails"); | ||
| const emails = await getVerifiedPrivyEmails(subject); | ||
| return emails.some(email => email.split("@").at(-1) === "recoupable.com"); | ||
| } catch { | ||
| return false; | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| import { recoupSkillFiles } from "./recoupSkillFiles"; | ||
|
|
||
| /** Read a file selected from an authorized catalog manifest. */ | ||
| export async function readRecoupSkillFile(uri: string) { | ||
| const url = new URL(uri); | ||
| return recoupSkillFiles.read(`${url.hostname}${decodeURIComponent(url.pathname)}`); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| import { join } from "node:path"; | ||
| import { nodeSkillFiles } from "@modelcontextprotocol/server/ext/skills/node"; | ||
|
|
||
| export const recoupSkillFiles = nodeSkillFiles(join(process.cwd(), ".mcp-skills/generated")); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| import { z } from "zod"; | ||
|
|
||
| export const recoupSkillsToolSchema = z | ||
| .object({ | ||
| query: z | ||
| .string() | ||
| .trim() | ||
| .max(200) | ||
| .optional() | ||
| .describe("Topic or words to find in skill names and descriptions"), | ||
| offset: z.number().int().min(0).optional().describe("Next offset from a previous search"), | ||
| skill: z | ||
| .string() | ||
| .regex(/^[a-z0-9-]{1,64}$/) | ||
| .optional() | ||
| .describe("Exact skill name to load"), | ||
| file: z | ||
| .string() | ||
| .min(1) | ||
| .max(1024) | ||
| .optional() | ||
| .describe("Skill-relative supporting file. Defaults to SKILL.md when a skill is selected"), | ||
| }) | ||
| .strict() | ||
| .refine( | ||
| ({ file, offset, query, skill }) => | ||
| skill ? query === undefined && offset === undefined : file === undefined, | ||
| "Provide a skill and optional file, or list skills with an optional query and offset.", | ||
| ); |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
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