r/reactjs • • 3d ago

I built a React + Vue component library with a hosted MCP server so Cursor and Claude Code stop guessing props

chould i create a post in there ? with this
I built Orvain UI, a React (and Vue) component library with a hosted MCP server, so Cursor / Claude Code use the real component API instead of hallucinating props.

45 components are free on npm (@orvain/react, no account), there's a Figma library that matches the code 1:1, and theming is one token file.

https://orvain.dev

Happy to answer questions about how the MCP side works.

0 Upvotes

6 comments sorted by

1

u/xzinkx 2d ago

shipping both react and vue from one library is rare, most stop at react. the mcp angle makes sense too, made-up prop names are the most annoying claude code mistake in ui work. how do you keep the two apis in sync, is there one shared spec that generates both packages (and what the mcp server returns), or are they maintained by hand?

1

u/ozz_aj12 2d ago

Thanks , yeah react + vue was the hard part to commit to. there's one shared spec per component (props, variants, defaults, tokens) and both packages are built against it. the mcp server serves that same spec, so what claude code or cursor sees is exactly what ships in the package. if a prop changes, it changes in one place and all three update together. there's still hand-written code for the framework-specific bits (slots in vue, children/render props in react), but the public api comes from the spec, not from memory

1

u/xzinkx 2d ago

that's a clean setup, one spec feeding both packages and the mcp server means the docs can't drift either. curious how the spec handles two-way binding though, like v-model on the vue side vs value + onChange in react. is that a special prop type in the spec or part of the hand-written bits?

1

u/ozz_aj12 2d ago

good q. it's not a special prop type it's more a naming convention that a parity check enforces. react uses the usual controlled/uncontrolled pair: `checked` / `defaultChecked` + `onCheckedChange`, `value` + `onValueChange`, `open` + `onOpenChange` etc. vue mirrors each one as the same prop + an `update:x` emit, so you get `v-model:checked`, `v-model:open`, and plain `v-model` where react has `value` (value maps to modelValue).

the parity script (runs in our local ci) fails if a react `onXChange` for a controlled prop has no matching `update:x` on the vue side, or the other way round. the mcp reads the typed props straight from source per framework, so for vue it hands back the v-model bindings explicitly and for react the value + callback pair. so if claude asks for the vue Switch it gets `v-model:checked`, not `:checked` + `@change`.

the hand-written part is the state plumbing itself: one small `useControllableState` helper in each package that handles controlled vs uncontrolled and fires the events

1

u/xzinkx 2d ago

the parity check is the part I'd steal. a naming convention without a check drifts within a month. and handing back `v-model:checked` straight from the mcp is a nice touch, that's exactly the kind of vue detail ai tools tend to get wrong. thanks for the detailed breakdown 🙌