How 21st-dev/codex-plugin works
Purpose and Distribution
This repository is a self-hosted Codex plugin marketplace entry for 21st.dev. It connects Codex agents to the hosted 21st component/design platform so they can discover, generate, install, publish, and manage UI assets rather than manually authoring them.
Plugin discovery and installation are defined by:
• marketplace.json
• .codex-plugin/plugin.json
Plugin Entry Points
.codex-plugin/plugin.json is the primary plugin manifest. It registers the bundled skills and the 21st MCP integration with Codex.
.mcp.json is the runtime connection entry point for the remote MCP server. The repository contains no local application server or executable; Codex invokes the hosted service directly.
Remote MCP Boundary
The central integration boundary is the remote 21st MCP endpoint at https://21st.dev/api/mcp, configured in:
• .mcp.json
• .codex-plugin/plugin.json
Codex authenticates requests using API_KEY_21ST, supplied as a bearer token. The remote service owns search, retrieval, AI generation, usage, bookmarks/lists, teams, and component/theme/template write operations. This repository supplies registration and agent guidance, not the implementations of those tools.
Skill Routing Layer
Four Markdown skills provide task-specific operating guidance to the Codex agent:
• skills/21st-cli-use/SKILL.md
• skills/21st-ai/SKILL.md
• skills/21st-registry/SKILL.md
• skills/21st-design-sync/SKILL.md
They are intended to activate in projects containing components.json, creating a project-level boundary: 21st workflows apply when a compatible component-oriented project is detected.
Core Workflows
1. Search and consume assets: 21st-cli-use directs search, component retrieval, and installation/addition flows.
2. Generate and refine UI: 21st-ai guides use of hosted AI generation, iterative changes, and code retrieval.
3. Publish and administer registry assets: 21st-registry covers publishing and management of reusable components and related assets.
4. Synchronize design tokens: 21st-design-sync publishes local project design tokens as a 21st theme.
These workflows route agent intent through either the 21st CLI guidance or MCP tools; resulting code/assets cross from 21st.dev into the user’s local project.
Infrastructure and Commercial Boundaries
The required external runtime is Codex with plugin and MCP support. The required external service is 21st.dev, including its MCP API and API-key authentication.
Metadata search is free, while component code access, AI generation, and mutating operations are metered by 21st.dev. Agents should therefore treat retrieval/generation/write calls as potentially billable remote operations, distinct from local skill interpretation.
Main entry points: plugin.json Plugin manifest · 21st-design-sync/SKILL.md Design sync skill · 21st-cli-use/SKILL.md CLI use skill · 21st-ai/SKILL.md AI skill
Components 13
Plugin package
Repository-supplied registration and agent guidance.
- Marketplace entry
marketplace.json - Plugin manifest · Registers skills and the 21st MCP integration.
.codex-plugin/plugin.json - MCP connection config · Points Codex to the hosted MCP endpoint.
.mcp.json - CLI use skill · Guides search, retrieval, and installation.
skills/21st-cli-use/SKILL.md - AI skill · Guides hosted UI generation and refinement.
skills/21st-ai/SKILL.md - Registry skill · Guides publishing and registry administration.
skills/21st-registry/SKILL.md - Design sync skill · Guides publishing local design tokens as a theme.
skills/21st-design-sync/SKILL.md
Codex runtime
- Codex agent · Interprets skills and invokes configured MCP tools.
- API_KEY_21ST · Authenticates remote MCP requests.
21st.dev
Hosted MCP service and asset platform.
- 21st MCP API · Provides search, retrieval, generation, and write tools.
- 21st asset platform · Owns components, themes, templates, teams, lists, and usage.
User project
- Compatible project · Workflows apply when the project contains components.json.
- Installed code and tokens · Retrieved components and synchronized design assets.
Connections 22
- Marketplace entry → Plugin manifest: discovers
- Plugin manifest → Codex agent: registers with
- Plugin manifest → CLI use skill: bundles
- Plugin manifest → AI skill: bundles
- Plugin manifest → Registry skill: bundles
- Plugin manifest → Design sync skill: bundles
- Plugin manifest → 21st MCP API: configures
- MCP connection config → 21st MCP API: connects to
- CLI use skill → Codex agent: guides
- AI skill → Codex agent: guides
- Registry skill → Codex agent: guides
- Design sync skill → Codex agent: guides
- Compatible project → CLI use skill: activates
- Compatible project → AI skill: activates
- Compatible project → Registry skill: activates
- Compatible project → Design sync skill: activates
- Codex agent → 21st MCP API: invokes tools · Retrieval, generation, and writes may be metered.
- API_KEY_21ST → 21st MCP API: bearer auth
- 21st MCP API → 21st asset platform: serves platform operations
- 21st asset platform → Installed code and tokens: delivers assets
- Design sync skill → 21st asset platform: publishes themes
- Installed code and tokens → Compatible project: added to