DemandSphere MCP Server
OfficialClick on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@DemandSphere MCP Server show me SERP analytics for 'MCP server' in the US"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
DemandSphere MCP Server
An MCP (Model Context Protocol) server that connects AI assistants to the DemandSphere search intelligence platform. Supports both traditional SERP analytics (v5.0) and GenAI visibility tracking (v5.1).
What It Does
This server exposes 20 tools across five domains:
Domain | Tools | API Version |
Site Discovery |
| v5.0 |
SERP Analytics |
| v5.0 |
GenAI Visibility |
| v5.1 |
Brand Management |
| v5.1 |
ChatGPT Deep Research |
| compat |
Related MCP server: sightvane-mcp
Quick Start
1. Install
With uv (recommended):
git clone https://github.com/DemandSphereDev/demandsphere-mcp.git
cd demandsphere-mcp
uv syncWith pip:
git clone https://github.com/DemandSphereDev/demandsphere-mcp.git
cd demandsphere-mcp
python -m venv .venv
source .venv/bin/activate # Windows: .venv\Scripts\activate
pip install -e .2. Configure API Key
Choose one method:
# Option A: Environment variable
export DEMANDSPHERE_API_KEY="your-api-key"
# Option B: Config file
mkdir -p ~/.config/demandsphere
echo '{"api_key": "your-api-key"}' > ~/.config/demandsphere/config.json
# Option C: .env file in project root
echo 'DEMANDSPHERE_API_KEY=your-api-key' > .env3. Run
With uv:
# stdio (default — for Claude Code, Claude Desktop, Cursor)
uv run demandsphere-mcp
# HTTP (for hosted/remote deployment)
DEMANDSPHERE_TRANSPORT=streamable-http uv run demandsphere-mcpWith pip (after install):
# stdio
demandsphere-mcp
# HTTP
DEMANDSPHERE_TRANSPORT=streamable-http demandsphere-mcp4. Connect to Your MCP Client
Claude Desktop / Cursor — add to your MCP config:
With uv:
{
"mcpServers": {
"demandsphere": {
"command": "uv",
"args": ["run", "--directory", "/path/to/demandsphere-mcp", "demandsphere-mcp"],
"env": {
"DEMANDSPHERE_API_KEY": "your-api-key"
}
}
}
}With pip (after pip install -e .):
{
"mcpServers": {
"demandsphere": {
"command": "demandsphere-mcp",
"env": {
"DEMANDSPHERE_API_KEY": "your-api-key"
}
}
}
}Claude Code:
claude mcp add demandsphere \
-e DEMANDSPHERE_API_KEY=your-api-key \
-- uv run --directory /path/to/demandsphere-mcp demandsphere-mcpSecurity Model
Transport Modes
Transport | Use Case | Security Boundary |
stdio | Local (Claude Code, Cursor) | OS process isolation; no network exposure |
Streamable HTTP | Self-hosted / remote | HTTPS via reverse proxy |
API Key Handling
The DemandSphere API uses query-parameter auth. The MCP server holds the key and injects it into every outbound request. The AI model never sees the key.
Important: Because the API key is in the URL query string, it may appear in reverse proxy access logs, CDN logs, or network monitoring tools. If deploying behind a reverse proxy, configure it to strip or redact query strings from access logs.
Method | Best For |
Environment variable | Local dev, CI/CD |
Config file ( | Personal machines |
| Local dev |
Self-Hosting
You can deploy the MCP server yourself on any platform that supports Docker or Python:
Docker:
docker build -t demandsphere-mcp .
docker run -p 127.0.0.1:8765:8765 \
-e DEMANDSPHERE_API_KEY=your-api-key \
demandsphere-mcpThe server is available at http://localhost:8765/mcp. Works with Cloudflare Workers, Railway, Fly.io, Northflank, Render, Google Cloud Run, AWS Fargate, or any container platform. A docker-compose.yml is included with production hardening (cap_drop, read_only, non-root).
Without Docker:
DEMANDSPHERE_TRANSPORT=streamable-http \
DEMANDSPHERE_HOST=0.0.0.0 \
DEMANDSPHERE_API_KEY=your-api-key \
demandsphere-mcpPut an HTTPS reverse proxy (Caddy, nginx, Cloudflare Tunnel) in front for production use.
Rate Limiting
Client-side token-bucket rate limiter (default: 60 req/min). Response shaping caps result sets at 100 rows per tool call to keep LLM token costs manageable. Both are configurable via environment variables.
Configuration Reference
All settings via environment variables (prefix DEMANDSPHERE_):
Variable | Default | Description |
| (required for stdio) | DemandSphere API key |
|
| API base URL |
|
|
|
|
| HTTP server bind address |
|
| HTTP server port |
|
| HTTP timeout (seconds) |
|
| Rate limit cap |
|
| Max rows per response |
Project Structure
demandsphere-mcp/
├── pyproject.toml # Package config + deps
├── Dockerfile # Container deployment
├── docker-compose.yml # Production hardening example
├── CHANGELOG.md # Version history
├── CONTRIBUTING.md # Contribution guidelines
├── config.example.json # API key config example
├── examples/
│ ├── mcp-config-uv.json # MCP client config (uv)
│ └── mcp-config-pip.json # MCP client config (pip)
├── tests/
│ ├── test_core.py # Unit tests (validators, shaping, errors)
│ ├── test_hints.py # Hint builder tests
│ ├── test_brands.py # Brand dry_run tests
│ ├── test_consolidated.py # serp_analytics + llm_analytics tests
│ ├── test_prompts.py # MCP Prompt tests
│ └── test_resources.py # MCP Resource tests
└── src/demandsphere_mcp/
├── __init__.py
├── py.typed # PEP 561 type marker
├── server.py # MCP server entry point
├── config.py # Settings (env vars + config file)
├── client.py # Async HTTP client + rate limiter
└── tools/
├── __init__.py
├── utils.py # Error handling, validation, hints
├── sites.py # Site discovery (v5.0)
├── keywords_v50.py # SERP analytics (v5.0)
├── genai_v51.py # GenAI visibility (v5.1)
├── brands_v51.py # Brand management (v5.1)
├── chatgpt_compat.py # ChatGPT Deep Research (search/fetch)
├── prompts.py # MCP Prompts (workflow templates)
└── resources.py # MCP Resources (parameter discovery)Development
# With uv
uv sync --extra dev
uv run pytest
uv run ruff check src/
uv run mcp dev src/demandsphere_mcp/server.py
# With pip
pip install -e ".[dev]"
pytest
ruff check src/Upgrades
This project uses semantic versioning. To stay up to date:
Watch releases on GitHub to be notified of new versions
Pull latest and re-install:
git pull uv sync # or: pip install -e .See CHANGELOG.md for what changed in each release
License
MIT
Documentation
Additional documentation including API guides, use case examples, and integration walkthroughs is available at the DemandSphere Help Center (login required).
Available Tools
20 toolscreate_brandC
Create a new brand for GenAI visibility tracking.
Inputs: brand_name (required), global_key (required), dry_run, brand_description.
delete_brandsC
Delete one or more brands by ID.
Inputs: brand_ids (required), global_key (required), dry_run.
fetchA
Fetch a record by ID from a previous search() call.
Inputs: record_id (required).
get_bulk_citationsB
Citation URLs for multiple keywords in one call (max 50). Returns keyword→URLs mapping.
Inputs: target_date (required), keyword_names (required), search_engine (required), site_global_key (required).
get_keyword_citationsC
Citation URLs for a single keyword on an AI platform.
Inputs: target_date (required), keyword_name (required), search_engine (required), site_global_key (required).
get_keyword_groupsB
Keyword group/tag performance with ranking bucket distribution (bucket0-bucket8), volume, traffic, CTR.
Inputs: site_id (required), to_date (required), from_date (required), search_engine (required), +5 more.
get_landing_matchesC
Check if ranking pages match preferred landing pages. Returns match/mismatch/none status.
Inputs: site_id (required), to_date (required), from_date (required), search_engine (required), +5 more.
get_landings_historyB
Landing page history for a specific keyword. Shows which page ranked on each date.
Inputs: site_id (required), to_date (required), from_date (required), keyword_id (required), +1 more.
get_llm_filtersC
Available filter values for LLM analytics: channels, LLM names, metrics.
Inputs: site_global_key (required).
get_local_rankingsD
Local search rankings with per-location rank history.
Inputs: site_id (required), to_date (required), from_date (required), search_engine (required), +4 more.
get_mentionsC
Brand mentions and citations in AI responses. Returns per-keyword mention counts, context sentences, cited URLs, client vs competitor breakdown.
Inputs: target_date (required), search_engine (required), site_global_key (required), keyword_tags, +1 more.
get_people_also_askC
PAA questions from SERPs. Optionally includes search intent and AdWords data (volume, CPC, competition).
Inputs: search_engine (required), site_global_key (required), to_date, from_date, +5 more.
get_site_citationsB
Paginated citations for all keywords on a site. Returns keyword→URLs mapping.
Inputs: target_date (required), search_engine (required), site_global_key (required), page_limit, +2 more.
list_brandsC
List brands configured for a site (used for GenAI mention/citation tracking).
Inputs: global_key (required).
list_sitesA
List all sites with org/account hierarchy. Returns site IDs needed by other tools.
Inputs: no named parameters.
list_sites_flatA
List all sites as a flat array. Returns id, name, url, keyword count.
Inputs: no named parameters.
llm_analyticsB
LLM traffic analytics with multiple views. view='stats': aggregated traffic stats. view='performance': side-by-side LLM comparison. view='channels': per-channel comparison. view='cross_channel': cross-channel overview. view='cross_llms': cross-platform comparison. Use metric param for non-stats views. Filter with llms_list/channels_list (comma-separated) for stats/performance views.
Inputs: view (required), site_global_key (required), metric, to_date, +3 more.
searchB
Search DemandSphere data. Returns record IDs for use with fetch(). Covers keywords, AI mentions, citations, LLM traffic, PAA.
Inputs: query (required).
serp_analyticsB
SERP analytics with multiple views. view='performance': per-keyword rank, traffic, CTR (requires global_key). view='trends': rank history over time (requires site_id). view='engine_comparison': compare rankings across engines (requires site_id). view='engine_summary': aggregate rank/visits/revenue (requires site_id).
Inputs: view (required), to_date (required), from_date (required), search_engine (required), +8 more.
update_brandB
Update an existing brand's name or description.
Inputs: brand_id (required), global_key (required), dry_run, brand_name, +1 more.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 20 tools
Several tools have overlapping purposes, particularly the citation tools (get_keyword_citations, get_bulk_citations, get_site_citations) and site listings (list_sites vs list_sites_flat). However, descriptions clarify the differences in scope and format, so the ambiguity is manageable but not negligible.
The naming follows a mostly verb_noun pattern (list_sites, get_keyword_groups, create_brand), but there are deviations like serp_analytics, llm_analytics, and get_people_also_ask, plus plural inconsistencies (delete_brands vs create_brand). This mixed style reduces predictability.
With 20 tools, the server is slightly over the ideal range but still scoped to a complex domain covering sites, keywords, brands, citations, and LLM analytics. Some tools could be consolidated, but the count is defensible for the feature set.
The tool surface covers core analytics and brand management well, including search/fetch for data exploration. Minor gaps exist, such as no direct keyword list tool or site management operations, but these are likely outside the intended scope.
Maintenance
Related MCP Connectors
Connect AI agents to your AI visibility and SEO data: competitors, citations, GSC, GA4, Bing.
Real SEO data for AI assistants: page audits, Keyword Planner volumes, Search Console history.
SEO, GEO & AI Visibility Intelligence directly inside AI assistants. Chat with SEO in plain language: research keywords, analyze SERPs, track competitors, and monitor AI visibility. SeoPerseo's integrated intelligence reveals site issues and how to fix them, create client reports and generate content for your website. Fully integrated with Google Search Console and Google Analytics.
SEO data your AI can cite: Search Console, GA4, keywords, backlinks, SERPs and AI visibility.
Related MCP Servers
- AlicenseAqualityDmaintenanceEnables AI assistants to access SurfRank's AI visibility analytics platform through 24 tools. It allows agents to run AI-visibility reports, research keywords, track competitors, and manage projects directly from chat interfaces.248 npmMIT
- -licenseNot gradedqualityCmaintenanceEnables AI assistants to perform comprehensive SEO and GEO measurements, including site audits, keyword research, ranking tracking, and brand visibility analysis across search engines and generative AI platforms.-
- AlicenseAqualityBmaintenanceFind out how AI assistants and search engines talk about your brand. Ask how often ChatGPT, Perplexity and Google's AI answers mention you, where you rank, how positive those mentions are, which sites they cite, and how you compare with competitors. Your assistant can also set up and adjust the monitoring for you, showing a preview and asking before anything that deletes data or uses up your plan.6888 npmMIT
- AlicenseNot gradedqualityBmaintenanceConnects AI agents to live SEO data and hosted tools for site audits, keyword research, competitor analysis, local SEO, and link prospecting, with guided workflows for structured search optimization.2MIT