MCP Server & Toolsets
LiteCart has a built in MCP server, which allows AI agents to access the MCP toolsets offered by the platform. See the add-ons store for a variety of MCP tools and resources that can be installed.
The MCP server is available in both LiteCart 2.x and LiteCart 3.0, but the two differ in where it is served from and how you authenticate. LiteCart 2.x is the current stable release, so the 2.x behaviour is what most shops run today.
| LiteCart 2.x | LiteCart 3.0 (unreleased) | |
|---|---|---|
| Endpoint | https://www.litecart.tld/mcp |
https://www.litecart.tld/<backend-alias>/mcp |
| Authentication | HTTP Basic auth with an administrator account | OAuth 2.1 Bearer access token |
| Toolset files | public_html/includes/mcp/mcp_*.inc.php |
src/shared/mcp/mcp_*.inc.php |
| Protocol version | 2024-11-05 |
2026-07-28, legacy versions also accepted |
| Per-tool permissions | No | Yes, per access key |
Both versions require the client to say what it accepts. A request whose Accept header names neither application/json nor text/event-stream is refused with 406 Client must accept application/json or text/event-stream.
Supported methods
| Method | Description | 2.x | 3.0 |
|---|---|---|---|
initialize |
Handshake and protocol version negotiation | yes | yes |
ping |
Connectivity check | yes | — |
notifications/initialized |
Client notification, no response | yes | yes |
notifications/cancelled |
Client notification, no response | yes | — |
notifications/progress |
Client notification, no response | yes | — |
server/discover |
Server capabilities and version | — | yes |
tools/list |
List the available tools | yes | yes |
tools/call |
Call one of the tools | yes | yes |
resources/list |
List the resources | yes | yes |
resources/templates/list |
List the resource URI templates | yes | yes |
resources/subscribe |
Acknowledged, but the server is stateless so it is a no-op | yes | yes |
resources/unsubscribe |
Acknowledged, but the server is stateless so it is a no-op | yes | yes |
resources/read |
Read one resource | yes | yes |
In 3.0, tools/list and tools/call are limited to the tools the access key is allowed to use.
LiteCart 2.x
Authentication
The 2.x MCP server authenticates with HTTP Basic auth using an administrator account. The username is looked up in the admin users table. A request with no credentials is rejected with 401 You need to authenticate to use this API, and a request with credentials that do not match is rejected with 401 Wrong combination of username and password or the account does not exist. The same message is returned whether the account does not exist or the password is wrong, so the endpoint cannot be used to probe for valid usernames.
Authorization: Basic base64_of_username:password
Give MCP access to a dedicated administrator account with a strong password, and only enable it on an endpoint you trust. In 2.x there is no way to restrict an MCP client to a subset of tools: every installed toolset is exposed to the client, and the administrator account you connect with decides what an agent can reach.
Endpoint
The 2.x MCP server is served from the storefront:
https://www.litecart.tld/mcp
It is a normal storefront route, so it does not use your backend alias. The endpoint is excluded from the regular CSRF protection, since MCP clients cannot send a CSRF token.
Rate limiting: the server records failed authentication attempts in the rate_limiting table, scoped to the client IP address or to the username that was tried. When more than three attempts have failed inside a five minute window, further attempts are refused with 429 Too many failed attempts. Please try again later. A successful login deletes the recorded attempts for that IP address and username. If your store keeps accepting wrong passwords, it is not running this check.
Connection type
The 2.x server uses the Streamable HTTP transport: POST for a JSON-RPC request and GET for the SSE endpoint. The GET endpoint acknowledges the client with text/event-stream headers and closes the stream right away without pushing notifications. A DELETE request is answered with 200 OK and ends the request there — the server runs stateless, so there is nothing to terminate. Any other method is refused with 405 MCP server expects GET, POST or DELETE requests.
Toolsets
Toolsets are plain PHP files in public_html/includes/mcp/, each returning an array with a name, a description and a list of tools. See Create an MCP Toolset.
A released LiteCart ships the server with a single ping toolset. Further toolsets are in development: they are not part of any release yet, so they are not available to shops and their contents may still change.
Configuration example
.mcp.json:
{
"mcpServers": {
"litecart": {
"url": "https://www.litecart.tld/mcp",
"type": "http",
"headers": {
"Authorization": "Basic BASE64_OF_USERNAME_AND_PASSWORD"
}
}
}
}
LiteCart 3.0 (not yet released)
LiteCart 3.0 is still under development. The details below describe how it works today in the 3.0 code base and may still change before release. For the current stable release, use the LiteCart 2.x section above.
Authentication
The 3.0 MCP server is an OAuth 2.1 resource server. It only accepts a Bearer access token that is minted from an access key created in the admin panel. HTTP Basic Auth with an administrator account is not supported.
- Go to Admin -> Integrations -> Access Keys and create a new access key.
- The key is displayed only once, right after it is created. Copy it then. Only a hash of the key is stored, so it cannot be retrieved later.
- Select which MCP tools the key may use. A key with no tool restrictions may use all installed tools.
Send the key as the HTTP header like the following:
Authorization: Bearer YOUR_ACCESS_KEY
Connection Type
The 3.0 server speaks HTTP with POST only. A GET or DELETE request is refused with 405 MCP server expects HTTP POST JSON-RPC requests, so there is no SSE stream to open and no session to terminate — the server is stateless and every request is self describing.
A request body larger than 256 KB is refused with 413 Request body exceeds the maximum of 256 KB. The ceiling is sized so that a tool can still carry a base64 encoded file attachment.
Endpoint
The MCP server is served from the backend area of your store:
https://www.litecart.tld/<backend-alias>/mcp
The backend alias is defined by the BACKEND_ALIAS constant in src/storage/config.inc.php and is adminarea by default. If you have changed the alias, use your own.
The MCP endpoint is exempt from the regular admin login, because it authenticates with the access key instead.
Resources
The 3.0 server serves resources the same way 2.x does. Resource collections are files in src/shared/mcp/ and use the same format as 2.x, so a single file may carry tools, resources and resource templates together. See Create an MCP Resource for the format.
Configuration
General Example (ChatGPT, Claude, Copilot)
.mcp.json:
{
"mcpServers": {
"litecart": {
"url": "https://www.litecart.tld/adminarea/mcp",
"type": "http",
"headers": {
"Authorization": "Bearer YOUR_ACCESS_KEY"
}
}
}
}
OpenCode Example
C:\User\.config\opencode\opencode.jsonc:
{
"$schema": "https://opencode.ai/config.json",
"mcp": {
"litecart": {
"url": "https://litecart.tld/adminarea/mcp",
"type": "remote",
"oauth": false,
"headers": {
"Authorization": "Bearer YOUR_ACCESS_KEY"
}
}
}
}
CLI Example
The MCP server can also run over stdio, which is useful for coding assistants that spawn the server themselves. The access key is read from the ACCESS_KEY environment variable.
echo '{"jsonrpc":"2.0","method":"server/discover","id":1}' | ACCESS_KEY=YOUR_ACCESS_KEY php src/index.php mcp_server
Protocol Version
The current protocol version is 2026-07-28. The legacy versions 2025-11-25, 2025-06-18, 2025-03-26 and 2024-11-05 are still accepted.
Over HTTP the version is sent in the MCP-Protocol-Version header. Over stdio it is sent as _meta.io.modelcontextprotocol/protocolVersion in the request.