rmnr
DocsTourSlicesBest PracticeAgentsInstall

Command Palette

Search for a command to run...

New

Slice · AI prompt

Create Your MCP

Turn any rr-based app into an MCP server that ChatGPT custom apps, Claude.ai connectors, Cursor MCP, and other AI clients authenticate to. OAuth 2.1 + PKCE flow with code → bearer exchange, env-configured vendor-host allowlist, single-use codes, 1-year bearer tokens, scope-tagged tools, opaque error collapsing, constant-time token compare. Static MCP_API_KEY fallback for service-account / CI scripts. Sanitized 2026-05-16 from rahmanef.com's production MCP integration — vendor literals (chatgpt.com / OpenAI paths) replaced with MCP_OAUTH_ALLOWED_HOSTS + MCP_OAUTH_ALLOWED_PATH_PREFIXES env vars so the slice ships portable.

Resource detail View source
Copy this prompt into Claude / Codex / Cursor
create-your-mcp.prompt.mdmarkdown
# Install `create-your-mcp` — Create Your MCP

> Turn any rr-based app into an MCP server that ChatGPT custom apps, Claude.

📚 Knowledge base : https://resource.rahmanef.com/llms.txt
📦 Slice detail   : https://resource.rahmanef.com/slices/create-your-mcp
🧠 JSON catalog   : https://resource.rahmanef.com/api/knowledge?slice=create-your-mcp
🔗 Source         : https://github.com/rahmanef63/resource-site/tree/main/frontend/slices/create-your-mcp

## 1. Install

```bash
npx rahman-resources add create-your-mcp
# alias: npx rr add create-your-mcp
```

The CLI copies `frontend/slices/create-your-mcp/` into your project + augments `.env.example` + installs npm deps automatically. Run it from your project root.

## 2. What it ships

- peer slices (cascade install):
  - `convex-auth` — requireAdmin uses getAuthUserId from @convex-dev/auth.
- env vars:
  - `MCP_API_KEY` (server) — Static bearer for service-account / CI access. Min 32 chars. Must match Convex env.
  - `MCP_OAUTH_ALLOWED_HOSTS` (convex) — CSV vendor domains for redirect_uri (chatgpt.com,claude.ai,cursor.sh).
  - `MCP_OAUTH_ALLOWED_PATH_PREFIXES` (convex) — CSV path prefixes under allowed hosts (/aip/,/connector/,/oauth/).
  - `NEXT_PUBLIC_SITE_URL` (next-public, required) — Public site origin for WWW-Authenticate challenge.
- convex feature paths: `convex/features/create_your_mcp`

## 3. Wire it up

Run `npx rr add create-your-mcp`. Compose `createYourMcpTables` into root schema. Move `slices/create-your-mcp/routes/mcp.route.ts` → `app/api/mcp/route.ts` and `oauth-token.route.ts` → `app/api/oauth/token/route.ts`. Set MCP_OAUTH_ALLOWED_HOSTS (CSV vendor domains). Mount `<McpAdminView />` at /admin/mcp. Connect ChatGPT/Claude/Cursor via the setup form rendered by the admin view.

## Rules of engagement

- shadcn-only UI primitives. No raw `<button>` / `<dialog>` / native date or file inputs.
- 200-line hard cap per source file (extract neighbours when over).
- All Convex queries hit an index (`.withIndex(...)`); never bare `.collect()`.
- Public mutations/queries declare `args:` validators + authz.
- Full ruleset: https://resource.rahmanef.com/best-practice

The agent will fetch /llms.txt for the full ruleset and use /api/knowledge for the JSON catalog.