Skip to content

Public API with API keys and hosted MCP server#33

Merged
RogutKuba merged 3 commits into
mainfrom
RogutKuba/integration-ideas
Jul 26, 2026
Merged

Public API with API keys and hosted MCP server#33
RogutKuba merged 3 commits into
mainfrom
RogutKuba/integration-ideas

Conversation

@RogutKuba

Copy link
Copy Markdown
Member

Adds an organization-scoped public API that is a separate surface from the internal cookie-authed API, authenticated with API keys (better-auth apiKey plugin) that users create, copy once, and revoke from a new "API" settings page. The public /v1 REST API is key-authed and returns explicit public DTOs decoupled from internal entities (interviews, assessments, submissions, invites, candidates), so the external contract can stay stable while internal shapes change freely. A hosted MCP server (Cloudflare McpAgent Durable Object) wraps /v1 at /mcp and /sse, sharing a single API-key verifier with the REST middleware and exposing one thin tool per endpoint. The API settings page also renders a ready-to-paste MCP client config, pre-filled with the new key at creation time.

Note: the apikey table is added to the DB schema, so run pnpm --filter @coderscreen/db db:push before this goes live.

🤖 Generated with Claude Code

Add an organization-scoped public API surface separate from the internal
cookie-authed API:

- API keys via the better-auth apiKey plugin, managed from a new "API"
  settings page (create/copy-once/revoke), scoped to the active org.
- Public /v1 REST API (key-authed) with explicit public DTOs decoupled
  from internal entities: interviews, assessments, submissions, invites,
  candidates.
- Hosted MCP server (Cloudflare McpAgent Durable Object) wrapping /v1 at
  /mcp and /sse, sharing one API-key verifier with the REST middleware.
- API settings page shows ready-to-paste MCP client config, pre-filled
  with the new key on creation.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@cursor

cursor Bot commented Jul 25, 2026

Copy link
Copy Markdown

Bugbot is not enabled for your account, so this pull request was not reviewed.

Enable Bugbot in the Cursor dashboard to get automatic reviews on future PRs.

@vercel

vercel Bot commented Jul 25, 2026

Copy link
Copy Markdown
Contributor

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

Project Deployment Actions Updated (UTC)
coderscreen-marketing Ready Ready Preview, Comment Jul 26, 2026 7:12pm

Request Review

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Jul 25, 2026

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Updated (UTC)
✅ Deployment successful!
View logs
coderscreen-web c0f3794 Jul 26 2026, 07:12 PM

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Jul 25, 2026

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Updated (UTC)
✅ Deployment successful!
View logs
coderscreen-api c0f3794 Jul 26 2026, 07:12 PM

- Move the apikey table out of the better-auth apiKey plugin into our own
  packages/db/src/apikey.db.ts with organizationId as a real, indexed FK
  column (no more JSONB metadata filtering) and createdBy for attribution.
- Remove the better-auth apiKey plugin; own key generation, SHA-256 hashing,
  and verification in lib/apiKeyAuth.ts.
- Add per-key Cloudflare Worker rate limiting (API_RATE_LIMITER binding).
- Trim McpProps to { apiKey, baseUrl } and set ctx.props via a typed
  assignment instead of an unknown double-cast.
- Make ApiKeysView full width and drop the extra divider.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@RogutKuba
RogutKuba merged commit 9da90d7 into main Jul 26, 2026
5 checks passed
@RogutKuba
RogutKuba deleted the RogutKuba/integration-ideas branch July 26, 2026 19:14
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