> ## Documentation Index
>
> Fetch the complete documentation index at: https://www.cosmicjs.com/llms.txt
> Use this file to discover all available pages before exploring further.
>
> For a question these docs do not answer, such as which plan fits a team, read https://www.cosmicjs.com/agent.txt and ask Cosmic's concierge.
>
> Machine-readable API spec: https://www.cosmicjs.com/openapi.json

# Agent Plugin

Cosmic's [MCP server](/docs/mcp-server) and [Agent Skills](/docs/agent-skills) packaged as a single [Agent Plugin](https://agent-plugins.org), targeting spec version 1.0.0. Install it once and your coding agent gets Cosmic's content tools plus the skills that teach it how to use them, in Cursor, VS Code, GitHub Copilot, and Kiro.

Agent Plugins is an open, vendor-neutral specification for bundling MCP servers, skills, and prompts into one directory so the same package loads in every conformant client. The plugin contains no product code of its own: it configures the same [`@cosmicjs/mcp`](https://www.npmjs.com/package/@cosmicjs/mcp) server and documents the same [`@cosmicjs/sdk`](https://www.npmjs.com/package/@cosmicjs/sdk) you can already use by hand. What it saves you is the setup: one install instead of hand-editing a different config file for every editor you work in.

[Install](#install)

[View on GitHub](https://github.com/cosmicjs/cosmic-agent-plugin)
[MCP Server](/docs/mcp-server)

## What the plugin includes

Two MCP servers and two skills.

**`cosmic`** is the working server. It runs locally over stdio via `npx @cosmicjs/mcp`, reads your bucket credentials from the environment, and exposes the full bucket toolset:

| Area           | Tools                             |
| -------------- | --------------------------------- |
| Objects        | list, get, create, update, delete |
| Media          | list, get, upload, delete         |
| Object types   | list, get, create, update, delete |
| AI generation  | text, image, video, audio         |
| Content blocks | list                              |

Reads work with a read key alone. Create, update, delete, upload, and AI generation require a write key. See the [MCP Server docs](/docs/mcp-server#available-tools) for what each tool does and when an agent should reach for it.

**`cosmic-signup`** is the bootstrap server, hosted at `mcp.cosmicjs.com/v1/agent` over Streamable HTTP. It takes no credentials at all and exposes `cosmic_agent_signup`, `cosmic_agent_verify`, and `cosmic_agent_status`, so an agent on a machine that has never heard of Cosmic can provision a project. See [the two servers](#the-two-servers) for when each one applies.

**Skills** load alongside the tools, so the agent gets the tool and the guidance for using it well at the same time:

- `cosmic-sdk` covers objects, queries, media, imgix transforms, and AI generation with the JavaScript and TypeScript SDK, plus provisioning a project when the user has no credentials yet.
- `cosmic-content-modeling` covers object types, the metafield type table, validation rules, relationships, and rich-text fields.

## Install

### Cursor

Clone the repository and link it into your local plugins directory:
```bash
git clone https://github.com/cosmicjs/cosmic-agent-plugin.git
ln -s "$PWD/cosmic-agent-plugin" ~/.cursor/plugins/local/cosmic

```
Restart Cursor or run **Developer: Reload Window**. See the [Cursor plugins reference](https://cursor.com/docs/reference/plugins).

### VS Code

Set `chat.plugins.enabled` to `true`, then run **Chat: Install Plugin From Source** from the Command Palette and enter:
```text
https://github.com/cosmicjs/cosmic-agent-plugin.git

```
To load a local checkout instead, use the `chat.pluginLocations` setting:
```json
{
  "chat.pluginLocations": {
    "/absolute/path/to/cosmic-agent-plugin": true
  }
}

```
VS Code reads the portable `skills/` directory and `mcp.json` directly. See the [VS Code Agent Plugins docs](https://code.visualstudio.com/docs/agent-customization/agent-plugins).

### GitHub Copilot
```bash
copilot plugin install cosmicjs/cosmic-agent-plugin

```
Or run `/plugin install` inside an interactive session. To enable it for a repository instead, add it to `enabledPlugins` in `.github/copilot/settings.json`, which is also the only form the Copilot cloud agent supports. See the [CLI plugin reference](https://docs.github.com/en/copilot/reference/copilot-cli-reference/cli-plugin-reference).

Copilot's documented MCP config locations are `.mcp.json` at the plugin root
or `.github/mcp.json`. Whether its Agent Plugins mode reads the portable
`mcp.json` is not documented, so the skills may load while the MCP server does
not. If that happens, configure the server through Copilot's own MCP settings
using the [credentials](#credentials) below.

### Kiro

Kiro calls these "powers" and follows the Agent Plugins spec. In the Powers panel, choose **Add Custom Power → Import power from GitHub**, enter `https://github.com/cosmicjs/cosmic-agent-plugin`, and select **Install**. **Import power from a folder** loads a local checkout instead. See the [Kiro powers docs](https://kiro.dev/docs/powers/installation/).

Kiro manages MCP servers internally rather than writing to `~/.kiro/settings/mcp.json`, and it namespaces server names, so the `cosmic` server appears prefixed.

### ChatGPT and Codex

Not supported through this package yet. OpenAI's plugin documentation specifies a `.codex-plugin/plugin.json` manifest and a `.mcp.json` MCP config, neither of which is the portable Agent Plugins layout. Until that changes, configure the Cosmic MCP server directly as described in the [MCP Server docs](/docs/mcp-server).

### Any conformant client

Every conformant client loads a plugin from a directory containing `plugin.json`, so cloning the repository and pointing your client at the directory works generally:
```bash
git clone https://github.com/cosmicjs/cosmic-agent-plugin.git

```
## Credentials

The `cosmic` server reads its credentials from the environment. The plugin itself declares none, and contains no key or bucket slug.

| Variable             | Required | Purpose                                                                        |
| -------------------- | -------- | ------------------------------------------------------------------------------ |
| `COSMIC_BUCKET_SLUG` | Yes      | Which bucket to operate on                                                     |
| `COSMIC_READ_KEY`    | Yes      | Authorizes read tools                                                          |
| `COSMIC_WRITE_KEY`   | No       | Authorizes writes, uploads, and AI generation. Omit it for a read-only install |

Find all three in your dashboard under **Bucket** → **Settings** → **API Access**.
```bash
export COSMIC_BUCKET_SLUG=your-bucket-slug
export COSMIC_READ_KEY=your-read-key
export COSMIC_WRITE_KEY=your-write-key   # omit for a read-only install

```
Agent Plugins v1 has no portable mechanism for supplying a secret to a plugin. Configured `env` values in `mcp.json` are visible package data, and clients expand only `${PLUGIN_ROOT}` and `${PLUGIN_DATA}`, never `${COSMIC_READ_KEY}`. So you supply credentials one of two ways:

1. **Export them in the environment your client inherits**, through your shell profile, a launch agent, or the client's own environment settings. This is the portable option.
2. **Set them in your client's native MCP configuration**, which sits outside the Agent Plugins format but is supported by every client above.

Treat `COSMIC_WRITE_KEY` as a production credential. Never put it in a browser
bundle, a client-side variable such as `NEXT_PUBLIC_*`, or a committed file.

## Verify the install

Ask your agent:
```
List the object types in my Cosmic bucket

```
A list of your content models confirms that both the server and your credentials are working. To check that the skills loaded too, ask something that needs modeling guidance rather than a tool call:
```
Add a Products object type with a name, price, description, and image

```
## The two servers

The plugin declares two MCP servers because Cosmic's two hosted scopes have opposite credential requirements, and only one of them can be expressed portably.

**`cosmic-signup` is remote.** `https://mcp.cosmicjs.com/v1/agent` is one fixed URL for every user and needs no credentials, which satisfies the spec's rules for remote servers with nothing left over.

**`cosmic` is stdio**, because the hosted bucket endpoint cannot be expressed portably. Its URL embeds the bucket slug (`https://mcp.cosmicjs.com/v1/buckets/{bucket-slug}`) and it authenticates with an `Authorization` header, while the spec forbids placeholder and environment expansion in `url` and `headers`, and forbids credentials in `headers` outright. A remote entry would therefore mean publishing one customer's bucket slug and key in a public repository. Running the same server locally over stdio keeps your credentials in your own environment.

To use the hosted bucket endpoint anyway, configure it directly in your client as described under [Hosted MCP](/docs/mcp-server#hosted-mcp).

### Which server an agent should use

Prefer `cosmic` whenever `COSMIC_BUCKET_SLUG` and `COSMIC_READ_KEY` are set. Reach for `cosmic-signup` only when they are not. A freshly provisioned bucket starts restricted: 50 objects, 5 MB of media, no AI credits, and hard-deleted after 14 days unless the human completes the emailed verification. The `cosmic-sdk` skill documents the whole flow, including the OTP the human has to relay back, and [Agent Skills](/docs/agent-skills#agent-signup) covers it in full.

Clients that implement only stdio will skip `cosmic-signup` and load everything else.

## Plugin vs MCP server vs Agent Skills

The plugin is a distribution format, not a fourth product. It is the same MCP server and the same skills, bundled so they install together.

|                | Agent Plugin                  | MCP Server                       | Agent Skills                              |
| -------------- | ----------------------------- | -------------------------------- | ----------------------------------------- |
| **What it is** | One package containing both   | Tools your agent calls           | Guidance your agent reads                 |
| **Install**    | Once, per client              | Per-client MCP config            | Skills CLI or rules file                  |
| **Best for**   | Working in a supported editor | Any MCP client, including hosted | Any assistant, including ones without MCP |

Install the plugin if you work in Cursor, VS Code, Copilot, or Kiro and want both at once. Configure the [MCP server](/docs/mcp-server) directly if you want the hosted endpoint, are using a client the plugin does not cover, or need the agent scope on its own.

## Resources

[GitHub Repository](https://github.com/cosmicjs/cosmic-agent-plugin)
[Agent Plugins Spec](https://agent-plugins.org/specification)

- [MCP Server](/docs/mcp-server)
- [Agent Skills](/docs/agent-skills)
- [CLI](/docs/cli)
- [Discord Community](https://discord.com/invite/MSCwQ7D6Mg)

## FAQ

### How much does Cosmic cost?

Project plans are Free ($0), Builder ($99/mo), Team ($299/mo), Business ($499/mo), Enterprise (custom pricing). Yearly billing saves 10%. Workspace plans are Small Workspace ($999/mo) and Large Workspace ($2,999/mo), and they start with a 30-day free trial. Allowances, add-on rates, and the rest of the pricing FAQ are plain text at https://www.cosmicjs.com/pricing.md.

### Are API keys required, and is content private?

Each Bucket has a read key and a write key in Bucket Settings > API Access. GET requests use the read key. POST, PATCH, and DELETE use the write key as Authorization: Bearer. Do not put the write key in a browser bundle, a mobile app, or a NEXT_PUBLIC_ variable. SAML single sign-on is on Large Workspace and Enterprise. The audit log is append-only. Text versions: https://www.cosmicjs.com/security.md and https://www.cosmicjs.com/docs/dashboard/audit-log.md.

### Can an agent create a Cosmic project without an existing account?

Yes. POST https://dapi.cosmicjs.com/v3/agents/sign-up provisions a free-tier project and bucket tied to a human email, with no existing Cosmic account. The human claims it with the emailed one-time code. The playbook is https://www.cosmicjs.com/docs/ai-onboarding.md.
