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 throughnpx; you do not install it separately.
- Claude Code
- .mcp.json (Cursor etc.)
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
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:
get_site_config→ sees thestoremodule is active.search_endpoints("store products")→ finds theGET /store/...endpoints.get_endpointandget_schema("StoreProduct")→ learns the field names.call_endpoint→ looks at real product data.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.localis in.gitignore.
