Introducing a new way to review your PRs.

Read the announcement

chakra-ui / panda

🐼 Universal, Type-Safe, CSS-in-JS Framework for Design Systems ⚡️

View on GitHub

19 documents · Updated Sep 23, 2026

docs / developer-observability

Developer observability

Developer observability gives engineers and assistant tools a clear view of how Panda processes a project. It combines runtime logs with usage analysis and exposes the resolved design system through a programmatic interface. This helps a person or an AI assistant inspect compiler behavior without changing the styling workflow.

Observability model

Panda provides two related diagnostic paths. Logs explain what the compiler is doing during a run. Reports explain what the source files use after Panda parses and classifies them. The reporting and logging page describes the user-facing diagnostic controls.

flowchart LR
    A[Project source and config] --> B[Panda context]
    B --> C[Compiler logs]
    B --> D[Usage analysis]
    C --> E[Terminal or log consumer]
    D --> F[Human report]
    D --> G[JSON report]
    B --> H[MCP server]
    H --> I[AI assistant]

The same project context supports both human diagnostics and assistant queries. This keeps the information shown in a report or returned to an assistant tied to the active Panda configuration and source scope.

Runtime logging

The logger is the live diagnostic channel for compiler work. It groups entries by level and type so an engineer can reduce output to the events that matter. It also supports timing messages, caught-error context, and an optional callback for tools that need to collect log entries instead of only printing them.

Logging is separate from usage reporting. A log can show that a stage ran or failed, while a report describes the design-system values found in project files. The CLI can silence logs when another output, such as a JSON report or an MCP protocol stream, must remain clean.

References: packages/…/create-logger.ts• L5-36 packages/…/create-logger.ts• L46-83 packages/…/logger.ts• L1-27 packages/…/cli-main.ts• L403-417

Usage analysis

Usage analysis turns parsed project files into evidence about design-system use. It reports token and recipe use, including common values, use across files, and values that are not used or do not match the configured system. The result can serve a person at the terminal or a program that needs structured data.

The analysis API supports both formatted output and a JSON snapshot. Formatted output is available as text, tables, Markdown, or CSV. The snapshot preserves enough detail for later inspection of components, properties, file locations, and derived usage views.

References: packages/…/reporter.ts• L20-29 packages/…/reporter.ts• L32-85 packages/…/analyze.ts• L5-28 packages/…/report-format.ts• L7-17 packages/…/reporter.ts• L146-167

Assistant access

Panda exposes assistant-facing access through the Model Context Protocol (MCP). MCP is an open protocol that lets an AI assistant call tools backed by a project. Panda uses it to make the project’s resolved design system and usage information available without asking the assistant to infer them from generated files.

The MCP integration page explains setup and supported clients. The separate @pandacss/mcp package keeps the assistant connection optional instead of adding its protocol dependencies to every @pandacss/dev install.

Design-system queries

The MCP server provides read access to the main design-system concepts. An assistant can ask for tokens, semantic tokens, recipes, patterns, conditions, styles, animation data, colors, or the resolved configuration. Filters allow a query to focus on one token category, recipe, or pattern.

These queries give an assistant current project facts. For example, a request about a button variant can use the project’s recipe data rather than a generic answer. A request about responsive behavior can use the configured conditions rather than assume common breakpoints.

References: packages/…/server.ts• L47-132 packages/…/server.ts• L19-33 website/…/mcp-server.mdx• L9-19

Assistant usage audits

The MCP usage report connects assistant questions to the same analysis used by the CLI and Node API. An assistant can request token usage, recipe usage, or both. This supports audits such as finding unused design-system values and checking which configured values appear in source files.

The report follows the project context loaded for the MCP session. If the selected source scope does not contain Panda usage, the assistant receives an empty result rather than a view of unrelated files.

References: packages/…/server.ts• L134-165 packages/…/analyze.ts• L5-23 website/…/mcp-server.mdx• L109-129

MCP session lifecycle

The MCP command starts a server for the project’s working directory and loads the selected Panda configuration. It normally communicates over standard input and output so the host assistant can manage the session. Setup can create or merge the client configuration for Claude, Cursor, VS Code, Windsurf, or Codex.

The server keeps protocol output separate from startup and error messages. It also closes when the host disconnects or sends a termination signal. These boundaries prevent a closed assistant session from leaving a running process behind and protect the MCP message stream from ordinary logs.

References: packages/…/cli.ts• L18-55 packages/…/init.ts• L12-101 packages/…/clients.ts• L1-63 packages/…/server.ts• L181-216 packages/…/server.ts• L233-280

Programmatic access

Engineers can use the Node analysis API when a script needs structured diagnostics without driving the CLI. The API builds one analysis for a Panda context, then exposes token and recipe reports or writes the full report as JSON. MCP builds on this same access for assistant queries, which keeps manual and automated inspection aligned.

Use the CLI for a quick human view, the Node API for application or tool integration, and MCP when an AI assistant must query the active design system. These surfaces differ in how they deliver information, but they share the same project context and analysis purpose.

References: packages/…/analyze.ts• L1-34 packages/…/cli-main.ts• L395-438 packages/…/server.ts• L146-163

Change checklist

When these files or sections are changed, remember to consider these:

  • Keep the report schema and its JSON conversion aligned when report indexes or derived views change. The CLI output and MCP usage tool both depend on that structured shape.
  • Keep logger output away from protocol output when MCP transport behavior changes. Assistant clients need a clean message stream.
  • Keep MCP tool names and input scopes aligned with the client-facing documentation. A mismatch can make a tool appear available but return the wrong project view.
  • Keep client config keys aligned with each assistant’s expected file shape. VS Code uses servers; the other supported clients use mcpServers.
  • Keep the CLI migration path aligned with the separate MCP package. Users of old panda mcp commands must receive the current replacement.

Important failure modes

TriggerConsequenceGuard
The analysis scope does not include the project source filesToken or recipe usage appears empty even when the project uses PandaCheck the configured include scope before treating an empty report as proof of no usage
A log filter or level hides the event needed for diagnosisThe compiler may appear to skip a stage or lose useful error contextUse the matching log type and enable debug output when tracing a stage
Ordinary output is written to the MCP protocol streamThe assistant cannot parse server messagesKeep startup, error, and diagnostic text on the error stream
The client configuration uses the wrong config key or locationThe assistant does not discover the Panda serverUse the client-specific setup generated by @pandacss/mcp init
The MCP host closes without the server lifecycle handler runningA disconnected server can remain alive and consume resourcesLet the server handle pipe close, termination signals, and broken pipes

Key files

FileWhy to read it
packages/…/analyze.tsShows the programmatic entry point for token and recipe analysis.
packages/…/reporter.tsShows how source parsing becomes a structured usage report.
packages/…/report-format.tsShows the output forms intended for people and tools.
packages/…/create-logger.tsShows the levels, filters, timing, error context, and log collection hooks.
packages/…/server.tsShows the assistant-facing design-system and usage query surface.
packages/…/init.ts and packages/…/clients.tsShow how assistant client configuration is created and merged.
packages/…/cli.tsShows how users start the MCP server or initialize client setup.
packages/…/reporter.tsDefines the structured report contract shared by diagnostic consumers.