跪拜 Guibai
← All articles
Android · JetpackCompose · ComposeMultiplatform · MCP

Composables CLI Ships with MCP Server for Compose Multiplatform Projects

By 黄林晴 ·
Read original on juejin.cn ↗ Google Translate ↗ Alt translation

Compose Multiplatform tooling has lagged behind the declarative UI itself; this CLI closes the gap with a single entry point for project creation, module addition, and MCP-based documentation access. The explicit agent-mode design means teams building AI-assisted Kotlin workflows get a tool that won't stall on interactive prompts.

Summary

Composables CLI bundles four commands under a single `composables` binary: `init` generates a full Compose Multiplatform project with Composables UI, Spotless, and Gradle config pre-wired; `add module` drops a new app or library module into an existing Gradle root; `docs search` pulls up Composables UI documentation inside the terminal; and `mcp install` writes MCP configuration for eight different AI coding clients, including Android Studio, Cursor, Codex, and Claude.

The tool is built with agent-driven workflows in mind. Every interactive wizard accepts a full set of CLI flags so an AI agent can pass all parameters in one shot without getting stuck on prompts. The MCP server exposes two transports: a hosted HTTP endpoint for read-only doc queries, and a local stdio mode that can execute project-scaffolding actions like creating a module.

Dependency integration follows two paths. New projects get Composables UI wired in automatically. Existing projects can either pull the full `com.composables:ui` artifact or vendor component source code by depending only on the unstyled base libraries, trading upgrade convenience for full control over internal component behavior.

Takeaways
`composables init` scaffolds a Compose Multiplatform project with Composables UI, Spotless, and Gradle config included.
`composables add module` inserts an app or library module into an existing Gradle project from the root directory.
All interactive wizards accept full CLI flags so AI agents can pass parameters non-interactively.
`--targets` accepts a comma-separated list of `android`, `jvm`, `ios`, `wasm`.
`composables mcp install --client` writes MCP config for eight clients: Android Studio, Antigravity, Claude, Codex, Cursor, Firebender, OpenCode, and Zed.
The MCP server runs in two modes: a hosted HTTP endpoint for doc queries and a local stdio transport for project-scaffolding actions.
Existing projects can depend on the full `com.composables:ui` artifact or vendor component source using only `composeunstyled` and `compose-interaction-capabilities` base libraries.
Conclusions

Baking agent-mode flags into every command signals that the team expects a significant portion of usage to come through AI coding tools, not just human developers typing interactively.

The split between a hosted MCP endpoint for read-only docs and a local stdio transport for write actions is a pragmatic security boundary: agents can query docs without touching the filesystem, but scaffolding requires explicit local execution.

Offering both a full UI dependency and a source-copy path with minimal base libraries acknowledges the real tension in Compose Multiplatform projects between fast upgrades and deep component customization.

Concepts & terms
MCP (Model Context Protocol)
An open protocol that standardizes how AI coding agents connect to external tools and data sources. An MCP server exposes capabilities like documentation search or project scaffolding that an MCP-compatible client can invoke.
Compose Multiplatform
JetBrains' declarative UI framework that extends Jetpack Compose beyond Android to desktop (JVM), iOS, and web (Wasm) targets from a single Kotlin codebase.
Spotless
A Gradle plugin that enforces code formatting and style rules across a project, commonly used in Kotlin and Java builds to keep formatting consistent.
Source: juejin.cn ↗ Google Translate ↗ Backup ↗