Slice · AI prompt
Framework-parity MCP/OAuth integration: React/Next remains the default admin UI and adapter, while explicit SvelteKit installs native Svelte 5 admin UI plus SvelteKit handler factories over the same OAuth 2.1 + PKCE, JSON-RPC, Convex token backend, scope enforcement, and static MCP_API_KEY fallback. Shared HTTP behavior uses Web Request/Response primitives; host adapters stay thin.
# Install `create-your-mcp` — Create Your MCP
> Framework-parity MCP/OAuth integration: React/Next remains the default admin UI and adapter, while explicit SvelteKit installs native Svelte 5 admin UI plus SvelteKit handler factories over the same OAuth 2.
📚 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
- npm: `convex`, `class-variance-authority`
- shadcn primitives: `button`
- 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 OAuth/MCP discovery and setup UI; route handlers can fall back to request origin.
- convex feature paths: `convex/features/create_your_mcp`
## 3. Wire it up
Run `npx rr add create-your-mcp` for React/Next or add `--framework sveltekit` for native Svelte 5. Compose `createYourMcpTables` from `convex/features/create_your_mcp/_schema`. Next: move the two route adapters into `app/api`. SvelteKit: create `+server.ts` endpoints from `createSvelteKitMcpHandlers` and `createSvelteKitOauthTokenHandlers`. Mount the framework-native `McpAdminView`, wire adminList/revokeToken through your authenticated Convex client, and set MCP_OAUTH_ALLOWED_HOSTS for remote OAuth redirects.
## 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.