Documentation / MCP Server
MCP Server
Connect AI assistants to your GhostlyX analytics data using the Model Context Protocol. Works with OpenCode, Claude Desktop, Cursor, and any MCP-compatible tool.
Overview
The GhostlyX MCP server lets AI assistants query your analytics data through a structured, authenticated interface. Instead of copying and pasting numbers from the dashboard, you can ask your AI assistant questions like "What are my top 10 pages this week?" or "Is my site up right now?" and it will pull the data directly from GhostlyX.
Generate an API token
Create a Sanctum API token from your account settings. The same tokens work for both the REST API and the MCP server.
Configure your AI assistant
Add GhostlyX as a remote MCP server in your AI tool's configuration file with the /mcp/v1 endpoint.
Start asking questions
Your AI assistant can now query site stats, traffic sources, uptime, goals, funnels, and more.
Generate an API token
Go to Settings → API Tokens in your GhostlyX dashboard and create a new token. Give it a descriptive name like "OpenCode MCP" so you can identify it later. Copy the token immediately because it will not be shown again.
Manage API tokensConfigure your AI assistant
Add GhostlyX as a remote MCP server in your AI tool's configuration. The endpoint is https://ghostlyx.com/mcp/v1 and authentication uses a Bearer token header. Below are configuration examples for popular tools.
Add this to your opencode.json file in your project root. Set the GHOSTLYX_API_TOKEN environment variable to your API token.
{
"mcp": {
"ghostlyx": {
"type": "remote",
"url": "https://ghostlyx.com/mcp/v1",
"enabled": true,
"headers": {
"Authorization": "Bearer {env:GHOSTLYX_API_TOKEN}"
}
}
}
}
Add this to your Claude Desktop configuration file. On macOS this is at ~/Library/Application Support/Claude/claude_desktop_config.json. On Windows it is at %APPDATA%\Claude\claude_desktop_config.json.
{
"mcpServers": {
"ghostlyx": {
"url": "https://ghostlyx.com/mcp/v1",
"headers": {
"Authorization": "Bearer YOUR_API_TOKEN"
}
}
}
}
Create or edit the .cursor/mcp.json file in your project root.
{
"mcpServers": {
"ghostlyx": {
"url": "https://ghostlyx.com/mcp/v1",
"headers": {
"Authorization": "Bearer YOUR_API_TOKEN"
}
}
}
}
Any MCP-compatible tool can connect using the endpoint and a Bearer token header. The exact configuration format varies by tool, but you always need these two values:
Endpoint
https://ghostlyx.com/mcp/v1
Auth header
Authorization: Bearer YOUR_API_TOKEN
Available tools
The MCP server exposes 10 tools. Most are read-only. Tools that can create or modify data are marked as read/write and enforce the same role-based permissions as the GhostlyX dashboard.
list_sites
Read
List all sites you own and sites you are a member of.
Parameters: None
get_site_stats
Read
Aggregate pageviews, visitors, bounce rate, and average visit duration.
Parameters: site_identifier (required), period (optional: 24h, 7d, 30d, 6mo, 12mo)
get_top_pages
Read
Ranked list of most visited pages with view and visitor counts.
Parameters: site_identifier (required), period (optional), limit (optional, max 50)
get_traffic_sources
Read
Top referrers driving traffic, excluding self-referrals.
Parameters: site_identifier (required), period (optional), limit (optional, max 50)
get_realtime_visitors
Read
Unique visitors active on the site in the last 5 minutes.
Parameters: site_identifier (required)
get_uptime_status
Read
Uptime monitor status, uptime percentage, and average response time.
Parameters: site_identifier (required)
list_goals
Read
All goals with conversion counts, unique converters, and conversion rates.
Parameters: site_identifier (required), period (optional)
get_funnel_stats
Read
Step-by-step conversion data for a specific funnel.
Parameters: site_identifier (required), funnel_identifier (required), period (optional)
manage_annotations
Read/Write
List or create annotations on a site.
Parameters: site_identifier (required), action (list or create), text and occurred_at (for create)
support_tickets
Read/Write
List, view, create, or reply to support tickets.
Parameters: action (list, show, create, reply), plus action-specific parameters
Permissions and security
The MCP server enforces the same access controls as the GhostlyX dashboard. Your API token determines which sites and actions are available.
Example prompts
Once connected, try asking your AI assistant questions like these. The assistant will call the appropriate MCP tools automatically.