Skip to content

CSS

Style your xmcp MCP tools with Tailwind CSS, CSS Modules, or plain CSS, including class management and theming for tool-rendered UI components.

For the complete documentation index, see llms.txt. Markdown variants of every page are available by appending .md to the URL.

If you're using MCP Apps, xmcp provides your application multiple ways to use CSS:

Callout

xmcp automatically detects and imports a globals.css file if it exists in globals.css, src/globals.css, or src/tools/globals.css (in priority order). You don't need to manually import it in every tool.

Tailwind CSS

A CSS framework that provides utility classes like flex, pt-4, text-center, and rotate-90. You use these classes directly in your component to build layouts and designs.

Install Tailwind CSS:

Shell

Add the PostCSS plugin to your postcss.config.mjs file:

JavaScript

Create a globals.css file in your project root (or src/globals.css) and import Tailwind:

CSS

Now you can use Tailwind classes in your tools:

TSX

UI package

If you want a schema-driven UI layer or React MCP App helpers on top of xmcp, use @xmcp-dev/ui.

It gives you:

  • a packaged renderJson tool contract for schema-driven MCP app rendering
  • a packaged Rendered preview component for custom tool wrappers
  • an App renderer for fully custom rendering flows
  • useMcpApp() and useAutoMcpAppSize() for handwritten React MCP Apps
  • a package-owned stylesheet import so you do not need to point Tailwind at package internals directly

Minimal CSS setup:

CSS

That import is important because @xmcp-dev/ui components are Tailwind-styled. The package stylesheet handles the internal Tailwind scanning, so you do not need a manual @source entry that points into node_modules or a monorepo path.

Minimal tool setup:

TSX

With this setup, the normal path is:

  • import the package stylesheet once in globals.css
  • expose a tiny local render-json tool
  • let the package own parsing, progressive preview, validation hardening, and theme fallback

The renderer defaults to transportMode: "auto", which prefers the MCP App host and falls back to HTTP for standalone previews. To require a host, use:

TSX
Info

The full @xmcp-dev/ui rendering flow, customization levels, and theme behavior are documented in UI rendering.

CSS

Write standard CSS to style your components without any framework or tooling.

Create a globals.css file:

CSS

Use the styles in your tool:

TSX

CSS Modules

Scoped styles that are tied to a specific tool file.

Create a CSS module file with the .module.css extension:

CSS

Import the styles object and use it in your tool:

TSX

Summary

Pick the approach that fits your project. You can also mix them, for example, use Tailwind for layout and CSS Modules for component-specific styles.

If you're building schema-driven MCP app UIs, @xmcp-dev/ui is the package-owned path that sits on top of these styling options and uses the same globals.css entrypoint.

One framework to rule them all