npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@theme-registry/refract-mcp

v0.1.18

Published

Model Context Protocol server for refract — query + validate a project's theme from an AI agent.

Readme

@theme-registry/refract-mcp

A Model Context Protocol server for refract. It lets an AI agent (Claude Code, claude.ai, or any MCP client) query and validate your project's theme while authoring — the "middleware" that keeps an agent bound to the theme's real vocabulary instead of guessing.

It is project-scoped: it loads your theme.config.(ts|js|mjs) once at startup and serves queries against it, so the agent asks about your theme without ever resending it. It reloads on change.

The reload watches the config's directory recursively — so a theme split across ./tokens/*.ts reloads too, not just an edit to the config itself. Hidden paths are never watched (that includes .git, .next, .turbo, and the hidden .mjs files a .ts config's graph-compile emits beside your sources and unlinks again), and neither are node_modules / dist / out / coverage. Reloads never overlap.

Tools

| Tool | Answers | | --- | --- | | resolveToken | What does colors.brand.dark resolve to — its value, CSS varName, unit, and derivedFrom? | | listTokens | What token paths exist (the addressable vocabulary)? | | findToken | Which token paths start with a prefix? | | searchTokens | Which tokens match a query on their path OR resolved value? | | listRecipes | What recipes are defined? | | getClass | What real class (and composed class-list) does a recipe get — with the project's configured prefix? | | renderRecipe | What exact CSS does one recipe emit? | | checkContrast | Do the theme's colour pairings pass WCAG-2 (+ advisory APCA)? | | validateTheme | Is a candidate theme valid on every configured target? — returns every problem at once (collect-all), per target. | | diffTheme | What's the blast radius of a candidate edit — which tokens moved, classes changed, pairings crossed a threshold, targets stopped building? | | reload | Reload the project's theme config from disk (also happens automatically on change). |

diffTheme is the plan-then-apply guardrail: pass a candidate edit and it builds it against the project's real adapters and reports the blast radius before the agent writes — the claim a token file can't make. validateTheme surfaces refract's collect-all errors with their stable code per target, so an agent fixes all problems in one pass and catches adapter-level rules (unknown state, naming collision) a generic check would miss. getClass / resolveToken read the real emitted names, so the prefix matches what ships. The query tools take no theme argument — they read the loaded project theme.

Note: over MCP, getClass takes named arguments — { subsystem, group, variant } (a JSON object, as the tool schema requires) — whereas the runtime theme.getClass(subsystem, group, variant) takes the same three positionally. Same identifiers, different call shape for the two surfaces.

Architecture

Pure tools (src/tools.ts, unit-tested) operate on a built Theme the server holds; callTool (src/server.ts) is the transport-agnostic dispatch core; the transport is the official @modelcontextprotocol/sdk over stdio.

agent ⇄ (MCP stdio, SDK) ⇄ callTool ⇄ tools.ts ⇄ the project theme (loaded once from theme.config)

Connect

Register the server with your agent. Once published:

claude mcp add refract -- npx -y @theme-registry/refract-mcp

Or from a local build:

pnpm --filter @theme-registry/refract-mcp build      # → dist/server.js (a runnable bin)
claude mcp add refract -- node ./packages/refract-mcp/dist/server.js

The server auto-discovers theme.config.(ts|js|mjs) in the working directory; pass --config <path> to point elsewhere. A .ts config needs the typescript optional peer at 5.x (same as refract build — a bare npm i -D typescript now resolves to 7.x, which doesn't expose the compiler API from its main entry). A .mjs or .js config never loads typescript at all.

For project scope, commit a .mcp.json:

{ "mcpServers": { "refract": { "command": "npx", "args": ["-y", "@theme-registry/refract-mcp", "--config", "theme.config.ts"] } } }

Test

pnpm --filter @theme-registry/refract-mcp test

Notes

  • Stable — published on the npm latest tag in lockstep with core and the adapters.
  • It's the refract half of a Figma → refract → AI loop: an agent reads a design, authors a theme, and validateTheme is the guardrail that stops it drifting.