Setting up SCHMA with Cursor via MCP
How to integrate Cursor IDE with your SCHMA workspace using the Model Context Protocol (@schmadev/mcp-server) for AI-driven schema inspection and content generation.
Before you begin
- A SCHMA workspace on the Pro plan (MCP tool integration is a Pro feature)
- Cursor IDE installed on your machine
- Node.js 18+ and npm installed locally
- A valid SCHMA API key with Management or Delivery scopes
Cursor is an AI-powered code editor that supports the Model Context Protocol (MCP). By connecting Cursor to SCHMA's official MCP server (@schmadev/mcp-server), Cursor's AI agent gains direct awareness of your content models, field types, and published entries right inside your development environment.
Why integrate SCHMA with Cursor?
Connecting SCHMA to Cursor eliminates context switching and manual copy-pasting between your CMS and code editor. With the integration active, you can:
- Generate type-safe frontend components: Ask Cursor to generate React/Next.js components matching the exact fields of a SCHMA content model.
- Inspect CMS schemas in chat: Ask 'What fields are on the Author model in SCHMA?' and receive immediate schema declarations.
- Seed test content: Prompt Cursor to create mock or staging entries directly through the CMS API.
- Evolve schemas with AI: Synthesize new content models and fields from natural language prompts without opening the web browser.
Prerequisites and API credentials
Before configuring Cursor, gather three pieces of configuration from your SCHMA Studio dashboard:
- API Endpoint: The base URL of the SCHMA API (
https://api.schma.devfor production cloud workspaces, orhttp://localhost:3001for local development). - Workspace Slug: The unique identifier of your workspace (found in your Studio browser URL or in Settings > General).
- API Key: An active API key created under Settings > API Keys. If you only need Cursor to read schemas and entries, use a key with
deliveryscope. If you want Cursor to create entries or schemas, use a key withmanagementscope.
Configuring .cursor/mcp.json
You can configure the MCP server either for a specific project repository or globally across all Cursor projects.
Project-level setup: Create a file at .cursor/mcp.json in the root of your project directory with the following structure:
{
"mcpServers": {
"schma": {
"command": "npx",
"args": ["-y", "@schmadev/mcp-server"],
"env": {
"SCHMA_API_URL": "https://api.schma.dev",
"SCHMA_API_KEY": "schma_live_your_actual_api_key_here",
"SCHMA_TENANT_SLUG": "your-workspace-slug"
}
}
}
}Global setup: Open Cursor, go to Settings > Features > MCP, click Add New MCP Server, enter schma as the name, select type command, and provide the command npx -y @schmadev/mcp-server with the environment variables listed above.
Available tools and practical prompt examples
Once connected, Cursor's AI agent can call the following verified SCHMA MCP tools:
| Tool Name | Required Scope | Description |
|---|---|---|
| list_content_types | Delivery or Management | Lists all content types and their IDs/slugs |
| get_schema | Delivery or Management | Returns full field definitions and validations for a content type |
| get_entries | Delivery or Management | Fetches published or draft entries matching a content type |
| search_content | Delivery or Management | Executes semantic text search across workspace entries |
| create_entry | Management | Creates a new draft or published entry |
| update_entry | Management | Modifies field values on an existing entry |
| publish_entry | Management | Publishes an existing draft entry |
| create_content_type | Management | Creates a new content type schema with defined fields |
| update_schema | Management | Updates fields or validation rules on an existing schema |
Here are sample prompts you can type into Cursor Composer or Chat:
- *'Inspect the "article" schema in SCHMA and write a TypeScript interface for it.'*
- *'Fetch 3 published entries of type "feature-card" and render a responsive grid component in Next.js.'*
- *'Create a new content type called "Testimonial" with quote, authorName, authorRole, and rating fields.'*
Troubleshooting Cursor MCP connection issues
If Cursor displays a red status indicator next to the schma MCP server:
- Verify Node.js path: Open your terminal and run
node -vandnpx -v. Ensure Node 18 or newer is installed and in your system PATH. - Test the package standalone: In your terminal, run
npx -y @schmadev/mcp-server. The process should launch silently and wait for stdio input without throwing a module resolution error. - Verify API Key scope: If read tools work but
create_entryorcreate_content_typefails with a 403 error, your key hasdeliveryscope only. Generate a new key withmanagementscope in SCHMA Studio. - Check plan entitlement: MCP tooling is a Pro feature. If your workspace is on the Free tier, API requests return an HTTP 403 plan restriction error.