Skip to main content
MCP server CX Codex

Cosmic — Claude Code MCP server: what it does, how to install

Connects AI assistants to the Cosmic headless CMS to query content, update schema types, and upload media directly from editor chats.

Install into Claude Code · Platform CLI All methods and platforms ↓
claude mcp add mcp -e COSMIC_BUCKET_SLUG=<COSMIC_BUCKET_SLUG> -e COSMIC_READ_KEY=<COSMIC_READ_KEY> -e COSMIC_WRITE_KEY=<COSMIC_WRITE_KEY> -- npx -y @cosmicjs/mcp
Open on GitHub

What Cosmic does

This server bridges AI agents with Cosmic CMS buckets. It exposes tools to inspect and mutate content objects, fetch schema definitions, and configure metadata fields. The server also handles media operations, allowing assistants to upload files directly or trigger Cosmic AI text and video generation.

Cosmic offers a hosted HTTP endpoint at https://mcp.cosmicjs.com/v1/buckets/{bucket-slug}, avoiding local dependency installations. Teams working without remote server support can run the package locally via npx -y @cosmicjs/mcp. Local execution requires setting COSMIC_BUCKET_SLUG alongside access keys.

Read access and write operations rely on distinct credentials. Supplying only COSMIC_READ_KEY blocks all mutations. To modify records, alter schema types, or publish generated assets, you must provide COSMIC_WRITE_KEY.

What it helps with

  • update and delete entries inside Cosmic content buckets
  • upload images and assets directly into the media library
  • define object types with custom metafield structures
  • trigger media generation through Cosmic AI utilities

Example prompts for the agent

  • List all blog post objects currently stored in the Cosmic bucket.
  • Create a new object type named Products with price and description fields.
  • Upload this image URL into the blog media folder.

How to install Cosmic

1Platform CLI

claude mcp add mcp -e COSMIC_BUCKET_SLUG=<COSMIC_BUCKET_SLUG> -e COSMIC_READ_KEY=<COSMIC_READ_KEY> -e COSMIC_WRITE_KEY=<COSMIC_WRITE_KEY> -- npx -y @cosmicjs/mcp

Replace <…> with your own values

2Platform CLI: remote server

claude mcp add --transport http cosmic https://mcp.cosmicjs.com/v1/buckets/{bucket_slug}

Step by step, with commands for each platform: How to add an MCP server to Claude Code, Codex, Cursor, VS Code, Gemini CLI and more

Questions about Cosmic

How to install Cosmic in Claude Code?

Register the hosted URL with claude mcp add --transport http cosmic https://mcp.cosmicjs.com/v1/buckets/{bucket_slug} or run local stdio using `claude mcp add mcp -e COSMIC_BUCKET_SLUG=<COSMIC_BUCKET_SLUG> -e COSMIC_READ_KEY=<COSMIC_READ_KEY> -e COSMIC_WRITE_KEY=<COSMIC_WRITE_KEY> -- npx -y @cosmicjs/mcp`.

What does the Cosmic MCP server do?

It grants agents direct control over Cosmic CMS records, media uploads, and object schemas, with additional endpoints for AI-driven media generation.

Why are there separate read and write keys?

Cosmic isolates permissions between read and write scopes. Omission of COSMIC_WRITE_KEY restricts the assistant to search and fetch operations, preventing accidental bucket modifications.

Similar MCP servers

All MCP servers for Backend and APIs →

Project sponsors

Companies that keep this analytics open
Gold sponsor

Impressions, clicks and code copies — open statistics. We keep the numbers public for the same reason NeBlask itself is public. Become a sponsor