# petal-components-mcp [Health: Active]

**Category:** 💻 Developer Tools  
**Repository:** https://github.com/petalframework/petal-components-mcp  
**GitHub Stars:** 1  
**npm Downloads (last month):** 181  
**Views:** 0  
**Installs:** 0  
**Upvotes:** 0  
**Directory Page:** https://allmcps.com/mcp/petal-components-mcp

## Description
Phoenix LiveView component schemas from petal_components, exposed to AI coding assistants.

## Tools
Capabilities this server exposes over MCP:

- **get_install_instructions** — Get the canonical steps for installing petal_components in a Phoenix project. Call this when the user asks to install petal_components, when you are setting up a new Phoenix project that needs UI components, or when verifying an existing installation. Returns step-by-step instructions covering mix.exs, mix deps.get, Tailwind v4 CSS config, and the web module import, plus an optional step that keeps the petal_components usage rules synced into CLAUDE.md or AGENTS.md with the usage_rules package. Steps are idempotent - safe to follow on a project that is partially configured.
- **list_components** — List every component shipped by petal_components, the shadcn-style component library for Phoenix LiveView. This is the canonical Phoenix UI vocabulary - call it before composing any HEEx so you reach for an existing component instead of hand-rolling Tailwind divs.
- **get_component** — Get the full schema for one petal_components component: attrs, slots, defaults, allowed values, and a working HEEx usage example. Call this every time you are about to write a tag like <.button>, <.modal>, <.table>, or <.field> so the attrs and slots match the real library instead of training-data guesses.

## Claude Desktop Quick Installation
Remote MCP endpoint (confidence: high). Install path detected from listing signals. Add as a URL/SSE server in your client:

```json
"mcpServers": {
  "petal-components-mcp": {
    "url": "https://mcp.petal.build/mcp"
  }
}
```

## Documentation

## What petal-components-mcp does

petal-components-mcp gives MCP-compatible coding assistants structured access to petal_components, a component library for Phoenix LiveView. Its responses help an agent discover the available UI vocabulary and use components with the correct HEEx interface.

The server covers three focused tasks:

- Retrieve installation instructions for a Phoenix project.
- Enumerate all components included in petal_components.
- Inspect one component's complete schema and an example of how to use it in HEEx.

The component schema includes attributes, slots, default values, accepted values, documentation, and a working usage example. This makes the server useful before writing tags such as `<.button>`, `<.modal>`, `<.table>`, or `<.field>`.

## How it works

A TypeScript service packages a JSON snapshot of the component metadata. That snapshot is generated from the petal_components package by a Mix extraction task. The task loads the library's `PetalComponents.*` modules and reads their `Phoenix.Component.__components__/0` metadata, then writes the result to `src/schemas.json`.

The built service runs as a standalone application and exposes the MCP endpoint at `https://mcp.petal.build/mcp`. The deployment is hosted on Fly.io. A health endpoint is also available at `/healthz`; it reports whether the service is healthy along with the bundled petal_components version and component count.

## Setup and configuration

For Claude Code, add the hosted endpoint with:

```sh
claude mcp add petal --transport http https://mcp.petal.build
```

After registration, ask the coding assistant to work on a Phoenix project. It can call the installation tool before making project changes, then use the component listing and schema tools while composing HEEx.

To run the service locally, install dependencies, build it, and start it on a chosen port:

```sh
npm install
npm run build
PORT=8765 npm start
```

The local MCP endpoint is `http://localhost:8765/mcp`. A local Claude Code registration uses:

```sh
claude mcp add petal-local --transport http http://localhost:8765/mcp
```

Schema extraction is performed with `npm run extract`. The extraction project downloads petal_components from Hex and does not require a local clone of that library.

## Tools and capabilities

`get_install_instructions` returns the steps needed to add petal_components to a Phoenix project. Its guidance covers the dependency declaration, fetching dependencies, Tailwind v4 CSS configuration, and importing the library in the web module. It also includes an optional `usage_rules` step for synchronizing component guidance into `CLAUDE.md` or `AGENTS.md`. The instructions are designed to be safe for partially configured projects.

`list_components` returns every component shipped by petal_components with a short description. Use it to check whether an existing component fits before creating custom Tailwind markup.

`get_component` accepts a component name and returns its detailed schema, including attrs, slots, defaults, allowed values, documentation, and a HEEx example.

## Limitations and notes

The service exposes the bundled schema snapshot, so the deployed data must be regenerated and redeployed when petal_components changes. The project describes natural-language component search and composed pattern generation as planned additions rather than available tools. The server is focused on petal_components and Phoenix LiveView rather than general-purpose UI libraries.

_Full upstream README: https://allmcps.com/mcp/petal-components-mcp/readme_

