Skip to main content

What is MCP?

The Model Context Protocol (MCP) is an open standard that lets AI assistants (Claude Code, Cursor, Windsurf and others) use external tools and data. @leaderos/headless-mcp is an MCP server that introduces your site’s Headless API to your assistant. Without MCP the assistant guesses the API and may invent endpoints or field names. With MCP it:
  • searches endpoints and reads their real parameter/response schemas,
  • looks at your site’s actual configuration (which modules are on, which captcha pages exist),
  • takes sample responses from your live site and builds the UI around them.

Installation

Requirement: Node.js 18.18+. The package runs through npx; you do not install it separately.
The template’s .mcp.json reads ${LEADEROS_URL} and ${LEADEROS_PUBLIC_KEY} from environment variables. The values are also in .env.local; you can write the values directly if needed.

Environment variables

Enable LEADEROS_ALLOW_WRITE=1 only on a test site. The AI could create real orders, credit transfers or forum posts.

Tools

It also exposes a resource: leaderos://llms-full.txt (the full API reference).

Example

You can ask your assistant:
“Build a page that lists store products by category. First check which modules are on.”
The assistant will typically:
  1. get_site_config → sees the store module is active.
  2. search_endpoints("store products") → finds the GET /store/... endpoints.
  3. get_endpoint and get_schema("StoreProduct") → learns the field names.
  4. call_endpoint → looks at real product data.
  5. scaffold_page → takes the skeleton and adapts it to your design.

Security

  • The default mode is read-only.
  • The MCP server runs only on your machine; your site key is not sent to third parties.
  • The public key is not sensitive, but still do not commit it; .env.local is in .gitignore.

Troubleshooting