Headlesshost MCP

Agentic first headless CMS

Headlesshost MCP Server

A Model Context Protocol (MCP) server that provides complete communication with the Headlesshost platform API. This server enables AI assistants to manage content sites, staging sites, pages, sections, audiences, users, and file uploads through the Headlesshost platform.

Built with @modelcontextprotocol/sdk v1.26 and includes tool annotations, structured logging, and Zod input validation.

Demo

https://www.youtube.com/watch?v=xGGwcrI7gSo&feature=youtu.be

Installation

  1. Clone this repository

  2. Install dependencies:

    npm install
    
  3. Build the server:

    npm run build
    

Configuration

The server requires a Headlesshost API key set via the HEADLESSHOST_API_KEY environment variable.

Usage

With Claude Desktop

Add this configuration to your Claude Desktop config file:

MacOS: ~/Library/Application Support/Claude/claude_desktop_config.json
Windows: %APPDATA%\Claude\claude_desktop_config.json

Local development

{
  "mcpServers": {
    "headlesshost-cms": {
      "command": "node",
      "args": ["/path/to/kapiti.mcp/build/index.js"],
      "env": {
        "HEADLESSHOST_API_KEY": "your-auth-token"
      }
    }
  }
}

Via npx

{
  "mcpServers": {
    "headlesshost-cms": {
      "command": "npx",
      "args": ["headlesshost-mcp-server"],
      "env": {
        "HEADLESSHOST_API_KEY": "your-auth-token"
      }
    }
  }
}

With Claude Code

Add to your .claude/settings.json:

{
  "mcpServers": {
    "headlesshost-cms": {
      "command": "node",
      "args": ["/path/to/kapiti.mcp/build/index.js"],
      "env": {
        "HEADLESSHOST_API_KEY": "your-auth-token"
      }
    }
  }
}

With Other MCP Clients

This server is compatible with any MCP client including VS Code, Zed Editor, Continue.dev, and custom MCP implementations.

Configure your client to use:

  • Command: node
  • Args: ["/path/to/kapiti.mcp/build/index.js"]
  • Environment: Set HEADLESSHOST_API_KEY

Tools (53)

All tools include MCP annotations (readOnlyHint, destructiveHint, idempotentHint, openWorldHint) to help clients present appropriate UI and confirmation prompts.

General (3)

ToolDescription
pingTest authentication and connection
healthCheck API health status
get_ref_dataGet system reference data and lookups

User Management (4)

ToolDescription
create_userCreate a new user in the current account
get_userGet user details by ID
update_userUpdate user information and claims
delete_userDelete a user from the system

Account Management (3)

ToolDescription
create_accountCreate a new user account
get_accountGet current account information
update_accountUpdate account information

File Uploads (3)

ToolDescription
upload_user_profile_imageUpload a profile image for a user
upload_staging_site_fileUpload a file to a staging site
upload_staging_site_imageUpload an image to a staging site

Content Sites (5)

ToolDescription
create_content_siteCreate a new content site
get_content_sitesGet all content sites in the account
get_content_siteGet content site details by ID
update_content_siteUpdate content site information
delete_content_siteDelete a content site

Staging Sites (9)

ToolDescription
update_staging_siteUpdate staging site information
delete_staging_siteDelete a staging site
publish_staging_sitePublish a staging site to make it live
get_staging_siteGet staging site details
get_staging_site_pagesGet staging site pages
get_staging_site_configurationGet staging site configuration including section types
get_staging_site_logsGet change logs since last publish
get_published_sitesGet published sites for a content site
revert_staging_siteRevert a staging site to a previous state
clone_staging_siteClone a staging site

Pages (6)

ToolDescription
create_staging_site_pageCreate a new page
get_staging_site_pageGet page details (with optional sections)
update_staging_site_pageUpdate a page
delete_staging_site_pageDelete a page
revert_staging_site_pageRevert a page to a previous state
get_staging_site_page_logsGet page change logs since last publish

Sections (7)

ToolDescription
create_staging_site_sectionCreate a new section in a page
get_staging_site_sectionGet section details
update_staging_site_sectionUpdate a section
delete_staging_site_sectionDelete a section
publish_staging_site_sectionPublish a single section
revert_staging_site_sectionRevert a section to a previous state
get_staging_site_section_logsGet section change logs since last publish

Site Audiences (4)

ToolDescription
create_staging_site_audienceCreate an audience (locale/segment combination) for a site
get_staging_site_audienceGet audience details
update_staging_site_audienceUpdate an audience
delete_staging_site_audienceDelete an audience (base audience cannot be deleted)

Section Audiences (4)

ToolDescription
create_staging_site_section_audienceCreate an audience override for a section
get_staging_site_section_audienceGet section audience details
update_staging_site_section_audienceUpdate a section audience override
delete_staging_site_section_audienceDelete a section audience override

Analytics (4)

ToolDescription
get_content_site_logsGet the last 15 activity logs
get_content_site_hitsGet daily hit analytics
get_content_site_accountsGet associated accounts
get_content_site_claimsGet current user claims

Resources

The server provides 2 resources for configuration and monitoring:

  • API Configuration (config://api) — Available endpoints and current settings
  • API Health Status (health://api) — Real-time connectivity and response time

Development

Build the server:

npm run build

Run in development mode:

npm run dev

Watch for changes:

npm run watch

Run the MCP inspector for debugging:

npm run inspector

Error Handling

The server includes structured error handling:

  • API authentication validation
  • Network connectivity checks
  • Structured logging via MCP logging capability (errors are sent to the client)
  • Graceful fallbacks for API timeouts

Security

  • API key authentication required for all operations
  • Secure environment variable handling
  • Input validation via Zod schemas on all tool inputs
  • Tool annotations signal destructive operations to clients

Related Servers