1 min lesson
Share one analytics MCP
Share one analytics MCP, connect it with a read-only credential and allowlist only read_schema.
Step 1 of 2
Interactive diagram. Step through it with the Next and Previous controls below, or Tab to a region to read its detail.
diagram: flow
Keep the definition in Git, the database URL outside Git and automatic access on one exact tool.
Learn more
Full explanation
.cursor/mcp.json and .cursor/permissions.json
Share a read-only analytics MCP without its database URL
.cursor/mcp.json and .cursor/permissions.json
SayThe repository needs one analytics MCPModel Context Protocol. A standard that lets an AI agent pull in context from outside the repo, like Jira tickets or internal docs. Press Enter for the full definition. definition for local editor work. Each developer has a different read-only database URL. No credential belongs in Git.
DoUse .cursor/mcp.json because the server belongs to this project. Keep personal servers in ~/.cursor/mcp.json, and do not define analytics-db in both places.
Type
{
"mcpServers": {
"analytics-db": {
"type": "stdio",
"command": "node",
"args": ["${workspaceFolder}/tools/analytics-mcp.mjs"],
"env": { "DATABASE_URL": "${env:ANALYTICS_READONLY_URL}" }
}
}
}DoCommit the server definition and script path, not the database URL. Each developer provides ANALYTICS_READONLY_URL in the environment that launches Cursor.
SeeThe same project-relative command loads on each machine, while the credential value stays outside the repository.
DoOpen Customize and confirm that analytics-db comes from the project config, uses stdio and exposes read_schema, run_readonly_query and apply_migration. Resolve any startup or authentication error before testing a tool.
SeeThe server identity and transport match the file. The read-only credential limits the database account even if a tool is misused.
Type
{ "mcpAllowlist": ["analytics-db:read_schema"] }DoUse Allowlist mode and put only analytics-db:read_schema in .cursor/permissions.json. This file replaces the in-app MCPModel Context Protocol. A standard that lets an AI agent pull in context from outside the repo, like Jira tickets or internal docs. Press Enter for the full definition. allowlist, so inspect the effective list in Settings after saving it.
Seeread_schema can run without approval. run_readonly_query and apply_migration are outside the allowlist and still interrupt for review.
DoRun read_schema, then propose a query and a migration without approving them. Inspect the arguments and confirm that the two non-allowlisted tools stop for review. Check the staged config for secrets before committing.
SeeThe project shares one server definition, no credential value enters Git and automatic access stops at the exact read_schema tool.
Learn more
Optional practice
Test yourself on Share one analytics MCP
QWhich result proves the analytics MCPModel Context Protocol. A standard that lets an AI agent pull in context from outside the repo, like Jira tickets or internal docs. Press Enter for the full definition. has the intended config, credential and approval scope?