MCP server

Run banira as an MCP server so an AI assistant introspects, verifies and scaffolds your components against real data — not hallucinated APIs.

Why an MCP server

AI coding assistants are good at reading your files but bad at two things: they hallucinate component APIs (attributes, events, slots that don't exist), and they write generic, framework-shaped code instead of your toolchain's conventions. banira already solves the data side — its manifest is structured, typed metadata, and its compiler and test helper produce real diagnostics. The Model Context Protocol exposes all of that to the agent: typed data to kill hallucination, and a verify loop — compile and actually mount the component — to check the agent's work.

Add it to your client

The server runs as a local stdio process — no hosted service, nothing leaves your machine. Point any MCP client at it:

mcp client config
{
  "mcpServers": {
    "banira": { "command": "npx", "args": ["-y", "banira", "mcp"] }
  }
}

Or run it directly and explore it with the official MCP Inspector:

inspect
$ npx @modelcontextprotocol/inspector npx banira mcp

Tools

Ten tools across four groups. Introspection and guidance are read-only; compile/verify and docs do the work.

ToolWhat it does
get_component_manifestThe full Custom Elements Manifest for the given file(s).
get_component_apiA compact typed view of one component — attributes, properties, methods, events, slots, parts, custom properties.
list_componentsEvery custom element in a file or directory, with a summary and per-feature counts.
get_component_demoA component's @demo blocks as structured { language, code }.
check_componentType-check in memory (no files written) and return structured diagnostics, so the agent can self-correct.
compile_componentCompile to browser-ready ES modules, writing .js/.js.map. (read-only mode omits it)
test_componentMount the component (JSDOM by default) and report whether it registers and upgrades; optional real-browser run.
generate_docsProduce the HTML documentation page as a string.
get_authoring_guidelinesbanira's conventions — the jsdoc tag contract and per-variant starter components.
scaffold_componentGenerate a banira-shaped starter component from a spec. (read-only mode omits it)

Resources & prompts

Resourcesresource://banira/components (a manifest of every component in the workspace) and resource://banira/authoring-guide (the conventions as Markdown). Promptsimplement_component_with_attributes, add_event_to_component, and document_and_verify: the composable scaffold → check → test → docs flow that makes MCP outperform plain retrieval.

Modes

FlagEffect
--read-onlyExpose only the read/analysis tools — no writes or scaffolding. Safe to leave always-on.
--local-onlyConfine file access to the project and never emit network-reaching output (e.g. a CDN doc stylesheet).
-p, --projectA tsconfig.json whose options override the compiler defaults for the compile/analysis tools.
banira implements the MCP base protocol by hand — newline-delimited JSON-RPC 2.0, revision 2025-11-25 — so the server adds no heavy dependencies on top of the toolchain you already have.

Next steps