Skip to main content
Glama

UX-KB — UI/UX Designer Agent Knowledge Base

CI Node.js TypeScript MCP Prisma License: MIT

Cloud MCP knowledge base + UI/UX design agent. 73 cited topic docs, 6 workflow stage packs, session-scoped retrieval, citation verification, API keys, rate limits, and usage/gap logging. Built with TypeScript, Prisma, and Postgres.

Live page: https://ux-kb-site.vercel.app


Why UX-KB

Generic AI output looks like a template: default gradients, five-card grids, weak hierarchy, no accessibility, and rules invented on the fly. UX-KB turns UX guidance into a queryable, versioned, citable knowledge base that an agent must read before proposing a design.

  • Rules are fetched, not memorized. Every proposal cites doc IDs that were actually retrieved in the session.

  • Stage packs load only the rules relevant to the current workflow stage, with token budgets, instead of dumping the whole catalogue.

  • Feature routing pulls in extra docs for the specific thing being designed.

  • Citation verification proves a cited ID was fetched — and flags unfetched, unknown, and deprecated IDs before submission.

  • Gap reporting records missing topics instead of letting the agent invent rules.


Related MCP server: open-design-system-mcp-starter

What's inside

Surface

Count

Topic documents

73

Workflow stage packs

6 (need_check, research, audit, proposal, critique, implement)

Feature routes

10

MCP tools

7

MCP resources

3

Core unit tests

35

Content release candidate: 2.0.0 (content/release.json).


Architecture

flowchart LR
    A[AI Agent] -->|MCP stdio/HTTP| B[MCP Server]
    B --> C[Core Services]
    C --> D[Content Repository]
    D --> E[Markdown content/]
    C --> F[KbStore]
    F --> G[MemoryStore dev/tests]
    F --> H[PrismaStore Postgres]
    C --> I[Auth, rate limit, sessions, citations, gaps]
  • MCP is the delivery layer; core owns the logic. REST and admin (Phase 4) reuse the same services.

  • Agents read only published, immutable releases. Each session pins one KB version.

  • Project design-system files override the KB on tokens, brand, components, and voice.


Quick start (no database)

cd ux-kb
pnpm install
pnpm lint:kb:strict   # 0 errors, 0 warnings across 73 docs
pnpm typecheck        # tsc across all packages
pnpm test             # 23 core unit tests
pnpm smoke            # 7 tools + 3 resources over MCP stdio
pnpm dev:mcp          # stdio MCP server
pnpm dev:web          # Next.js site + dashboard + /api/mcp (https in dev)

Node.js ≥ 20 and pnpm 10 are required. Postgres is optional for local dev.


Connect an agent

Claude Code (stdio)

claude mcp add ux-kb -- node --import tsx \
  /absolute/path/to/ux-kb/apps/stdio/src/index.ts

Or with the built server (pnpm build first):

claude mcp add ux-kb -- node /absolute/path/to/ux-kb/apps/stdio/dist/index.js

Cursor / Claude Desktop

{
  "mcpServers": {
    "ux-kb": {
      "command": "node",
      "args": ["--import", "tsx", "/absolute/path/to/ux-kb/apps/stdio/src/index.ts"]
    }
  }
}

Streamable HTTP (with API key)

MCP_DEV_KEY=dev-local-key pnpm dev:mcp:http   # http://127.0.0.1:3333/mcp
claude mcp add --transport http ux-kb http://127.0.0.1:3333/mcp \
  --header "Authorization: Bearer dev-local-key"

Tool reference

Tool

Input

Output

Side effect

start_session

feature, mode?, screen?, tokenBudget?, idempotencyKey?

sessionId, mode, routing, next steps

creates/resumes session

start_gate

sessionId, screen, components?, screenType?, extraStates?

gate items + counts

creates gate

report_check

sessionId, gateId, results[]

accepted, rejected, weak, remaining

records results

gate_status

sessionId, gateId, view?

done, counts, open items

none

search_kb

query, domain?, limit?

IDs, titles, summaries

none

get_stage_pack

sessionId, stage, depth?, maxTokens?, page?

stage docs + routed docs

records fetched IDs

get_doc

sessionId, id, sections?, includeSources?, ifNoneMatch?, maxTokens?

one published doc

records fetched ID

get_docs

sessionId, ids[], sections?, includeSources?, maxTokens?

batch docs

records fetched IDs

get_checklist

ids[], depth?

CHECK items (+verify)

none

verify_citations

sessionId, citedIds[]

unfetched, unknown, deprecated

stores result

report_gap

topic, context, sessionId?

ticket id, similar reports

upserts gap

report_false_positive

itemId, reason, context?, sessionId?

ticket, noise score

records report

top_failures

domain?, limit?, window?

failing items + rates

none

diff_since

sessionId, sinceVersion, ids[]

changed docs + checks

none

Resources: kb://doc/{id}, kb://pack/{stage}, kb://core.

Stages: need_check, research, audit, proposal, critique, implement.


Session workflow

  1. Call start_session once per task.

  2. Call get_stage_pack before each stage; get_doc for extra topics.

  3. Call verify_citations before submitting — it compares cited IDs against the session's fetch history.

  4. Call report_gap when the KB lacks a topic instead of inventing a rule.

get_stage_pack reports an estimated token count and marks over-budget packs (characters / 4, not a model-specific tokenizer).


Database (optional, for persisted auth/usage/gaps)

cp .env.example .env        # set DATABASE_URL, DIRECT_URL, KEY_HASH_SECRET, AUTH_SECRET
pnpm db:generate
pnpm db:push
pnpm db:seed
pnpm kb:keys create --name laptop --rate-limit 120

KB_STORE=db (or a non-empty DATABASE_URL) selects PrismaStore; KB_STORE=memory forces the in-memory store used by tests and smoke:http. DIRECT_URL is the non-pooled connection used by migrations; on Prisma Postgres it is the direct (non-pooled) URL. The seed is idempotent.


Testing

pnpm lint:kb:strict                 # 0 errors, 0 warnings across 73 docs
pnpm typecheck                      # tsc in core, mcp, stdio, web
pnpm test                           # 46 core unit tests (incl. auth/security)
pnpm smoke                          # stdio end-to-end
pnpm smoke:http                     # HTTP auth, pinning, revocation, 429
pnpm --filter @ux-kb/web build      # Next.js production build

See docs/testing.md for the full manual test guide.


Project structure

ux-kb/
  content/                 Markdown knowledge base (source of truth)
  prisma/schema.prisma     DB schema (docs, versions, releases, keys, usage, gaps, rate limits)
  prisma/seed.ts           content/ -> Postgres
  packages/core/src/
    schemas/               zod front matter, packs, routes, releases
    content/               path resolution, parser, repository, token estimate
    services/              docs, packs + routing, search, release, auth,
                           rate limit (in-memory + Postgres), sessions/citations, gaps
    store/                 KbStore boundary: memory + Prisma implementations
    lint/                  doc + catalog linter
    cli/                   lint, info, key/gap commands
  packages/mcp/src/        MCP server factory, tools, resources (shared)
  apps/stdio/src/          stdio transport (local agents: Claude Code, Cursor)
  apps/stdio/scripts/      smoke.ts (stdio), http-smoke.ts (auth/429)
  apps/web/                Next.js app (public site, /api/mcp, /dashboard)
    app/                   App Router pages and route handlers
    lib/                   db, kb, store, auth, mcp auth helpers
    proxy.ts               route guard for /dashboard

Web app (Next.js)

The public site, MCP endpoint, and admin dashboard ship as one Next.js app in apps/web.

pnpm dev:web       # https://localhost:3000 (self-signed cert in dev)
pnpm build         # builds stdio + web

Surfaces:

  • / — public landing page

  • /api/healthz — health and KB version

  • /api/mcp — Streamable HTTP MCP (Bearer API key or OAuth access token, rate limited in Postgres)

  • /signin — GitHub OAuth; any GitHub user can sign in, allowlisted logins become admins

  • /dashboard — your keys, usage, and releases (requires sign-in)

  • /dashboard/users, /dashboard/gaps — admin only

HTTPS is provided by Vercel in production (HSTS + security headers configured in next.config.ts). Local dev uses next dev --experimental-https.

Accounts and API keys

  1. Open /signin and authorize with GitHub. Only id and login are used for identity; the OAuth token is not stored.

  2. Create a key at /dashboard/keys. The plaintext is shown once; the database stores only an HMAC-SHA256 hash.

  3. Use it as a Bearer token:

    claude mcp add --transport http ux-kb https://ux-kb-site.vercel.app/api/mcp \
      --header "Authorization: Bearer <your-key>"

OAuth for MCP connectors

Connectors that cannot send a static header (Claude.ai, ChatGPT, and other MCP clients) can authorize through OAuth 2.1 instead. The endpoint advertises RFC 9728 protected-resource metadata in its 401 challenge, so a client discovers everything from https://<host>/api/mcp alone:

Endpoint

Purpose

/.well-known/oauth-protected-resource

Resource metadata (RFC 9728)

/.well-known/oauth-authorization-server

Authorization-server metadata (RFC 8414)

/oauth/register

Dynamic client registration (RFC 7591, IP limited)

/oauth/authorize

GitHub sign-in + consent screen

/oauth/token

authorization_code and refresh_token grants

/oauth/revoke

Token revocation (RFC 7009)

Authorization requires PKCE (S256), then an explicit Allow from the signed-in user. Access tokens last one hour; refresh tokens rotate on every use. Each client/user pair is backed by one hidden OAuth · <client> key, so sessions, usage history, and per-key quotas stay coherent. Redirect URIs must be HTTPS, or loopback HTTP for native clients. Rejecting everything else keeps an open registration endpoint from becoming an open redirect.

Issuer URLs are derived from AUTH_URL, then the request's forwarded host, then NEXTAUTH_URL. Set AUTH_URL in production if you serve more than one domain.

Gemini (manual client registration)

Gemini's connector does not always complete dynamic registration, so if it asks for a Client ID and Secret, register one manually with Gemini's redirect URI:

curl -X POST https://<host>/oauth/register \\
  -H 'Content-Type: application/json' \\
  -d '{"client_name":"Gemini","redirect_uris":["https://vertexaisearch.cloud.google.com/oauth-redirect","https://gemini.google.com/oauth-redirect","https://oauth-redirect.googleusercontent.com/r"],"token_endpoint_auth_method":"client_secret_basic"}'

Paste the returned client_id and client_secret into Gemini's connection dialog. The server also accepts the redirect URIs Gemini uses for its relay (oauth-redirect*.googleusercontent.com), so registration succeeds even if Gemini sends a redirect URI that was not listed above.

Quotas are applied per key:

Limit

Member

Admin

Active keys

3

10

Requests / minute

10–120 (default 60)

10–600 (default 300)

Requests / day

10 000

100 000

Key expiry

30 / 90 / 365 days

same, plus "never"

Rotate issues a replacement and revokes the old key in one step. Revocation is immediate. Admins can suspend an account, which blocks new sessions and stops its keys from working.

Security and limitations

  • Keys are uxkb_ + 192 random bits, stored only as an HMAC-SHA256 hash, and checked syntactically before any database lookup. Revocation and expiry are enforced on every request.

  • /api/mcp is POST-only, requires application/json, caps bodies at 256 KB and batches at 20, and enforces per-key minute and daily quotas plus a per-IP limit for unauthenticated callers.

  • Dashboard and API responses are no-store; CSP, HSTS, X-Frame-Options, nosniff, and COOP are set in next.config.ts.

  • Every dashboard query is filtered by key owner; admin pages re-check the role server-side.

  • The server trusts reviewed Markdown. A bad doc becomes an instruction the agent follows, so review is the security boundary.

  • Citation verification proves fetch history, not that a source semantically supports a claim.

  • Rate limiting is a Postgres fixed window. It is abuse control, not billing: a caller can burst across a window boundary.

  • The concurrency guard is per serverless instance, so it bounds per-instance pressure rather than global throughput.

  • Usage logs store tool arguments — avoid sending secrets in feature, context, or query text.

  • Token estimates are approximate (±15% for prose); pack budgets are advisory.

See docs/security-checklist.md (OWASP API Top 10) and docs/auth-checklist.md for the full control list and known limitations.


Roadmap

  • Phase 4: admin docs, packs, releases (draft → review → publish)

  • Phase 5: usage, compliance, and gap observability

  • Phase 6: agent files, critic, evals, Playwright/axe

  • Phase 7: CI regression and content expansion from ranked gaps


Contributing

Issues and PRs welcome. Before submitting:

  1. Keep doc changes minimal and justified.

  2. Write docs in your own words — never paste copyrighted source text.

  3. Run pnpm lint:kb:strict, pnpm typecheck, and pnpm test.


License

Released under the MIT License. Content is a release candidate and may change between versions.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      A
      quality
      B
      maintenance
      Enables AI agents to score live URLs against a deterministic design contract, validate DTCG tokens and Lottie animations, audit accessibility, and retrieve design-system contracts, catalogs, and review rubrics.
      17
      MIT
    • A
      license
      Not graded
      quality
      B
      maintenance
      Enables AI agents to fetch current, version-accurate library documentation at request time instead of relying on training memory, with search for answering questions and full-fidelity retrieval of pages or specific declarations. Supports bare or module-path library names, version pinning, and disambiguation when names collide.
      32 npm
      MIT