Scope MCP server — install + query tools for AI coding agents (the Scope analytics connector)
Project description
Scope MCP server
The unified Scope MCP server (PRODUCT.md §16) — one server an AI coding agent (Claude Code, Cursor, ChatGPT, …) uses both to install Scope analytics in a project and to query it afterward. Scope is the AI analyst for AI products; this is its programmatic surface.
Tools
Install / setup (run once, at install time)
| Tool | What it does |
|---|---|
scope_detect_stack |
Scans the codebase (local, no key) and reports what Scope would auto-instrument for your stack — backend framework, LLM SDKs, frontend, deploy platform — plus honest non-coverage. |
scope_install_frontend |
The exact frontend-SDK install steps tailored to your stack (build-time injection or the one-line script tag), with your project's public key embedded. |
scope_install_backend |
The exact backend-SDK install steps for your stack — the zero-code scope-run path plus the code-based middleware (FastAPI/Flask/Django). Honest when a path isn't shipped yet (e.g. a Node backend). |
scope_coverage_report |
Honest, tenant-scoped data-flow census: which event types/sources are flowing, quarantine state, identity stitching, deploy metadata, and notes on gaps. |
scope_verify_installation |
Quick "are events flowing right now?" check, for right after install. |
The install tools propose code changes; your agent shows them to you and applies them on your confirmation (detect-and-confirm). The Scope MCP never silently writes your files, and your secret key is never echoed into a snippet — only a placeholder.
Query (ongoing analysis)
| Tool | What it does |
|---|---|
scope_ask |
Natural-language analytics question → the analyst's full reasoned answer (findings + recommendations). The catch-all; runs a real server-side agent loop (can take a minute). |
scope_get_stats |
Headline counts — total events, unique users, the per-type breakdown, and a day-by-day trend — over an optional date range / event type. Instant and deterministic; the quick "what are the numbers?" before deciding whether to dig in. |
scope_query_events |
The raw event feed (most recent first), optionally filtered by type/user. |
scope_get_session |
One session's (or user's) events stitched across frontend + backend + LLM, in time order, with a small census. |
scope_list_metrics |
The project's metric definitions — the analyst's recorded recipes ("how we computed it last time"). |
scope_get_metric |
One metric's full recipe + provenance. |
All query tools are read-only and tenant-scoped to your key's project. Use the deterministic
primitives for instant lookups you compose yourself; use scope_ask for open-ended "why/what/how".
Configure (auth = your project SECRET key in the MCP config)
env keys:
SCOPE_API_KEY— required. Your project's secret key (sk_...), from the Scope dashboard. (The install tools also read your public key from the API; you don't configure it.)SCOPE_API_BASE— backend base URL. Optional; defaults tohttps://api.scopeai.dev(the Scope production backend). Override only for self-hosted / staging deployments.SCOPE_API_TIMEOUT— request timeout seconds (default 90; the free-tier backend can cold-start, andscope_askruns a real agent loop, so its client floors the timeout at 180s).
Published as scope-analytics-mcp on PyPI — uvx fetches + runs it on demand (no manual
install). It's a standard stdio server, so it drops into any MCP-capable coding agent;
SCOPE_API_BASE is optional (defaults to https://api.scopeai.dev).
Claude Code (.mcp.json or claude mcp add)
{
"mcpServers": {
"scope": {
"command": "uvx",
"args": ["scope-analytics-mcp"],
"env": {
"SCOPE_API_KEY": "sk_...",
"SCOPE_API_BASE": "https://api.scopeai.dev"
}
}
}
}
Or from the CLI: claude mcp add scope --env SCOPE_API_KEY=sk_... -- uvx scope-analytics-mcp
Cursor (~/.cursor/mcp.json or .cursor/mcp.json)
Identical stdio schema — drop the same mcpServers block into ~/.cursor/mcp.json (global) or
.cursor/mcp.json (project). A one-click Add to Cursor deeplink is also available:
cursor://anysphere.cursor-deeplink/mcp/install?name=scope-analytics&config=<base64 of the inner server object — {command, args, env}, not the mcpServers wrapper>
Codex CLI (~/.codex/config.toml)
[mcp_servers.scope]
command = "uvx"
args = ["scope-analytics-mcp"]
startup_timeout_sec = 30 # cushion for the first-run uvx fetch
[mcp_servers.scope.env]
SCOPE_API_KEY = "sk_..."
Or from the CLI: codex mcp add scope --env SCOPE_API_KEY=sk_... -- uvx scope-analytics-mcp
Running from a local checkout (development): swap the command for your venv python and the import name —
"command": "/path/to/mcp-server/venv/bin/python", "args": ["-m", "scope_mcp"](the import package staysscope_mcp; the PyPI/uvxname isscope-analytics-mcp).
Then ask your agent things like:
- "Use Scope to install analytics in this project." (→ detect → install → verify)
- "What does Scope cover for my app?" (→ coverage report)
- "Ask Scope why signups dropped this week." (→ the analyst)
- "Show me what user
u_123did in their last session." (→ session)
Develop
python3.10 -m venv venv
venv/bin/pip install -e ".[dev]"
venv/bin/python -m pytest -q
Not yet shipped (Track C): the sharing tools (
scope_list_reports,scope_get_report, …) and the cross-origin CORS opt-in action. (A multi-projectproject_idarg is intentionally not planned — configure one MCP server per project so each is cleanly tenant-isolated by its own key.)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file scope_analytics_mcp-0.1.1.tar.gz.
File metadata
- Download URL: scope_analytics_mcp-0.1.1.tar.gz
- Upload date:
- Size: 59.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
08c4a9f59a345d521b381dede06f02c8b9e88291f254232c24f9ad3dca862595
|
|
| MD5 |
6238f10fe72315fb8cc997bdac22646c
|
|
| BLAKE2b-256 |
543d3f413d96c5314d2e30a7f458bc23ad181287650a3e9306d126aba240e949
|
Provenance
The following attestation bundles were made for scope_analytics_mcp-0.1.1.tar.gz:
Publisher:
mcp-publish.yml on wally827/scopeai
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
scope_analytics_mcp-0.1.1.tar.gz -
Subject digest:
08c4a9f59a345d521b381dede06f02c8b9e88291f254232c24f9ad3dca862595 - Sigstore transparency entry: 1787475778
- Sigstore integration time:
-
Permalink:
wally827/scopeai@785c71349074c1f9eadaed94b36c656b361bbe22 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/wally827
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
mcp-publish.yml@785c71349074c1f9eadaed94b36c656b361bbe22 -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file scope_analytics_mcp-0.1.1-py3-none-any.whl.
File metadata
- Download URL: scope_analytics_mcp-0.1.1-py3-none-any.whl
- Upload date:
- Size: 44.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d650320f191d482fc6bdcd29af9ef3f2e9861a817cc3bc5ff001642eceb7d01d
|
|
| MD5 |
204ee8016befeee0e06b2247b84a3b12
|
|
| BLAKE2b-256 |
8026038d51256bb17d06bbd7705bbd91a33b8501516e49529ed77c09fe4e6618
|
Provenance
The following attestation bundles were made for scope_analytics_mcp-0.1.1-py3-none-any.whl:
Publisher:
mcp-publish.yml on wally827/scopeai
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
scope_analytics_mcp-0.1.1-py3-none-any.whl -
Subject digest:
d650320f191d482fc6bdcd29af9ef3f2e9861a817cc3bc5ff001642eceb7d01d - Sigstore transparency entry: 1787475806
- Sigstore integration time:
-
Permalink:
wally827/scopeai@785c71349074c1f9eadaed94b36c656b361bbe22 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/wally827
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
mcp-publish.yml@785c71349074c1f9eadaed94b36c656b361bbe22 -
Trigger Event:
workflow_dispatch
-
Statement type: