MCP server
Expose the matching contract to an MCP client through a read-only stdio server.
Build and launch
@lenso/mcp is an unpublished source candidate with the lenso-mcp binary. Prepare the current documentation contract before building it:
pnpm --filter @lenso/ui-docs buildpnpm --filter @lenso/mcp buildnode packages/mcp/dist/server.mjsThe last command starts a stdio server, not an interactive help prompt. Stdout carries JSON-RPC; diagnostics use stderr. The built candidate includes the validated format-2 contract and private query core. The official MCP TypeScript SDK remains a runtime dependency.
Configure your MCP client's stdio launcher. This example uses a built source candidate rather than an unverified npm install:
{ "mcpServers": { "lenso-ui": { "command": "node", "args": ["/absolute/path/to/lenso-ui/packages/mcp/dist/server.mjs"] } }}Replace the absolute path and ensure node satisfies the contract's supported runtime range. The surrounding client configuration format is client-dependent.
Discover the six tools
| Tool | Input | Result |
|---|---|---|
list_components | No component argument | Canonical families and public parts |
get_component_api | component | Native signatures, state and resolved property rows |
get_component_examples | component, optional locale | Local source and ordered supporting files |
get_component_styles | component | Actual StyleX map source |
search_documentation | query, optional locale, limit | Authored documentation matches |
get_documentation | slug, optional locale | Exact authored Markdown |
Locales are en and cn, defaulting to en. Search limits are integers from 1 to 50, defaulting to 10. Every tool accepts optional lensoVersion and digest identity arguments, which must match the server's contract.
Responses include release metadata and digest. Discover schemas through the protocol and take canonical component names from list_components; menu is the public popup menu family.
Read-only boundary
The server has no shell execution, file-writing, caller-selected filesystem path, remote transport or upstream request forwarding. Tools do not open network connections. Returned source and prose are reference data, not executable instructions.
Startup validates the encoded contract once. Individual tools resolve selected records on demand, and search stops at its requested result bound. A stale or mismatched contract is an error, not a reason to fall back to another cached release.