Model Context Protocol

An MCP server that gives your AI client real access to your content

Point Claude Desktop, Cursor, or any MCP-compatible client at your Cosmic bucket and it can read, write, and generate content through 18 bucket-scoped tools. Hosted endpoint, nothing to install.

What the Cosmic MCP server does

The Model Context Protocol is an open standard for connecting AI clients to external systems. Cosmic ships an MCP server so the assistant you already use can read and write your actual content through a typed tool surface.

Connect your client to your bucket and it gets 18 tools: list and search objects, read a single object with its metafields, create and update content, manage media, inspect and evolve your content model, and generate text, images, video, and audio straight into your media library.

Everything runs against the same REST API and JavaScript SDK your application already uses, so anything the agent writes is immediately available to your front end.

There are two scopes. /v1/buckets/{your-bucket-slug} serves a human who already has a bucket, and exposes the 18 bucket-scoped tools. /v1/agent serves a human who has no Cosmic account yet, and lets an agent provision one for them. The full reference for both lives in the MCP server docs.

If you want a walkthrough rather than a reference, we have step-by-step guides for connecting Claude Desktop to Cosmic and for connecting Claude Code to Cosmic. For help writing application code against the SDK, see Agent Skills, which is the companion surface to this one.

18 bucket-scoped tools

Your AI client gets a defined tool surface: 5 for objects, 4 for media, 5 for object types, and 4 for AI generation. Every tool is scoped to a single bucket, so an agent connected to one project cannot reach another.

Read-only keys block every write

Cosmic issues separate read and write keys per bucket, and the hosted endpoint takes them as Authorization: Bearer READ_KEY:WRITE_KEY. Drop the write key and every write tool (creates, updates, deletes, and all four AI generation tools) is blocked with a clear error message, while read tools work as normal. You can verify it in under a minute: connect read-only, ask the agent to create an object, and watch the write come back blocked.

Hosted endpoint or local process

Point your client at the hosted streamable HTTP endpoint at mcp.cosmicjs.com, or run it locally with npx @cosmicjs/mcp. Both talk to the same REST API and JavaScript SDK your app already uses, so there is no second content store to keep in sync.

Sign a new user up without leaving the chat

The hosted server exposes a second scope at /v1/agent with three tools: cosmic_agent_signup, cosmic_agent_verify, and cosmic_agent_status. An AI agent can provision a brand new Cosmic project and bucket for a human who has no Cosmic account, hand them a 6-digit verification code, and start writing content into it, all over the MCP transport.

Connect in under a minute

Add one entry to your MCP config in Claude Desktop or Cursor:

{ "mcpServers": { "cosmic": { "url": "https://mcp.cosmicjs.com/v1/buckets/your-bucket-slug", "headers": { "Authorization": "Bearer your-read-key:your-write-key" } } } }

Drop the :your-write-key suffix for read-only access.

Claude Desktop reads ~/Library/Application Support/Claude/claude_desktop_config.json on macOS and %APPDATA%\Claude\claude_desktop_config.json on Windows. Cursor reads .cursor/mcp.json in your project, or ~/.cursor/mcp.json globally.

Self-hosted over stdio

{ "mcpServers": { "cosmic": { "command": "npx", "args": ["@cosmicjs/mcp"], "env": { "COSMIC_BUCKET_SLUG": "your-bucket-slug", "COSMIC_READ_KEY": "your-read-key", "COSMIC_WRITE_KEY": "your-write-key" } } } }

Your bucket slug, read key, and write key live in the Cosmic dashboard under Settings, then API Access. Once connected, you can ask in plain language: list all blog posts in my Cosmic bucket, show me every image in the blog-images folder, or create a new object type called Products with name, price, description, and image fields.

The package is open source on GitHub and published on npm.

No Cosmic account yet? Use the agent scope

If the person you are helping has never used Cosmic, point your client at the agent endpoint instead:

{ "mcpServers": { "cosmic-agent-signup": { "url": "https://mcp.cosmicjs.com/v1/agent" } } }

cosmic_agent_signup is unauthenticated and takes a human_email, a project_name, and your agent_id. It returns an agent_key, a read key, a write key, and a claim URL, and Cosmic emails the human a 6-digit code. cosmic_agent_verify submits that code and lifts restricted-mode limits. cosmic_agent_status checks claim status and recovers the keys. Once verified, the agent switches to the bucket scope using the keys it already holds, and starts creating content in the same conversation.

New buckets start in restricted mode: no AI credits, a maximum of 50 objects, and 5 MB of media. Unclaimed projects are hard-deleted after 14 days. The agent scope docs cover the full lifecycle, error codes, and limits.

How do I stop an AI agent from publishing or deleting content?

Connect it with a read-only key. Cosmic issues separate read and write keys per bucket, and the hosted endpoint takes them together as Authorization: Bearer READ_KEY:WRITE_KEY. Drop the write key and the colon, and every write tool (cosmic_objects_create, cosmic_objects_update, cosmic_objects_delete, the media and object type write tools, and all four AI generation tools) is blocked with a clear error message. Read tools keep working as normal. Issue the write key only to a client you control.

How is this different from Cosmic Agents?

The MCP server exposes your bucket as tools to an AI client that you run, such as Claude Desktop or Cursor. Cosmic Agents run inside Cosmic on a schedule or a trigger. Use the MCP server when you want your own client working against your content, and Cosmic Agents when you want the automation to live in the platform.

Which AI clients does it work with?

Any client that speaks MCP. The hosted endpoint uses the streamable HTTP transport, and we document config for Claude Desktop and Cursor on both macOS and Windows. If your client cannot send a colon-packed bearer token, you can pass the write key out of band in an X-Cosmic-Write-Key header instead. If you would rather keep the MCP process inside your own dev environment, the @cosmicjs/mcp package runs over stdio via npx.

Does the MCP server cost anything?

It is included on every Cosmic plan. The Free plan is $0 per month with 1 Bucket, 2 team members, 1,000 Objects, and 300k input and 300k output AI tokens per month, which is enough to connect a client and work end to end. Builder is $49 per month with 2 Buckets, 3 team members, and 5,000 Objects. Additional team members are $29 per user per month. The four AI generation tools draw on your plan's monthly AI token allowance.

Connect your AI client to Cosmic

Create a free account, copy your bucket keys from Settings, then API Access, and paste one config block into Claude Desktop or Cursor. The Free plan is $0 per month and includes 1 Bucket, 2 team members, and 1,000 Objects, which is enough to wire up an MCP client and see it work end to end. Compare it against the paid plans when you outgrow it. If you would rather see it running against your own content model first, book a 30 minute intro with our CEO.

cosmic logo
cosmic logo

Start building today

No credit card required • Free forever