Claude Code & Cursor MCP: Warehouse Security Checklist
Secure Claude Code and Cursor warehouse access with an MCP checklist for read-only roles, server-side SQL limits, export approval, and audit evidence.
Direct answer: Treat MCP access as a database permission problem, not a client setting. Read-only warehouse roles, dataset and tool allowlists, SQL syntax restrictions, query timeouts, export approval, and correlated audit logs do the protecting. Client allowlists only gate what the agent can load. If the warehouse will run any statement the agent sends, no prompt, plugin, or approved-server list will save you.
This is the hands-on companion to the broader guide on connecting AI coding agents to an enterprise data warehouse. That article covers the strategy and rollout sequence. This one is the configuration and acceptance pass: what to write down, what to test, and what evidence to hand a reviewer. If you are still deciding how to scope roles, the walkthrough on MCP lakehouse read-only SQL and least privilege goes deeper on the database side.
Two premises hold throughout. MCP authorization is optional in the specification, so never assume token handling exists. And the client's permission model is a convenience, while the warehouse's authorization is the boundary.
Prerequisites: What You Need Before You Start
Four things must exist before you touch a configuration file. Missing any of them turns a controlled rollout into an exception you cannot enforce.
A warehouse service account strategy. Decide now whether each agent, each team, or each workload gets its own identity. A dedicated account per agent or per team is what makes audit logs attributable and revocation surgical; a shared human account destroys both properties. Define the default role as read-only and reserve write credentials for a separate, explicitly scoped path.
An identity provider that can issue tokens. Remote MCP servers authenticate with OAuth, which means your IdP must be able to register the server as a client and issue tokens with an audience scoped to that server. Confirm this before choosing a transport, because a pattern that depends on OAuth cannot be retrofitted onto an IdP that only supports static API keys.
A managed settings channel. Without MDM, GPO, fleet management, or an equivalent administrative channel, you cannot push configuration to developer machines or prove it is applied. Claude Code's managed-mcp.json must be delivered to a system path such as /Library/Application Support/ClaudeCode/, /etc/claude-code/, or C:Program FilesClaudeCode\ by MDM, GPO, fleet management, or another administrator-privileged process, and it cannot be set through server-managed settings. Cursor's team-level control lives in its admin dashboard instead. Either way, the enforcement mechanism must exist before the server does.
A named owner for the integration. One person accountable for the service account, the allowlist, the cost caps, and the review cadence. Agent integrations drift when ownership is diffuse: nobody notices a new server, a widened role, or a cap that was never set.
A short scoping note is worth writing at this stage. Record which warehouse objects the agent may read, which it may never touch, and which business questions it is expected to answer. That note becomes the input to Step 3 and the baseline for Step 5.
Step 1: Choose Your Connection Pattern Before You Configure Anything
For enterprise warehouse access, prefer a centrally deployed remote MCP server that authenticates with OAuth, so credentials never live on developer laptops. The transport you pick determines where code executes, who can use it, and how far a compromised credential reaches.
Three patterns are realistic today.
Local stdio server on the developer machine. The agent launches a process locally and talks to it over standard input and output. Cursor's MCP documentation describes stdio as locally executed, managed by Cursor, single-user, invoked by shell command, and manually authenticated. It is the fastest way to prototype and the worst way to grant warehouse access at scale: the credential sits on the laptop, usage is invisible to the platform team, and every developer configures their own copy.
Remote HTTP or SSE server deployed centrally. The server runs in your environment, holds the warehouse credential, and authenticates users through OAuth. Cursor's documentation lists SSE and Streamable HTTP as remote-capable, multi-user, URL-addressed, and OAuth-authenticated. Claude Code's MCP documentation notes that HTTP supports OAuth and the claude mcp add --transport flag, while WebSocket supports neither, so use HTTP when the server only responds to requests and reserve WebSocket for servers that push events unprompted.
A vendor-provided CLI or MCP interface. Some platforms ship their own agent-facing interface with built-in safeguards. Treat it as a variant of the remote pattern and apply the same scrutiny: who holds the credential, what the interface can reach, and whether its permission model matches your warehouse roles.
Pattern | Transport | Execution environment | Auth model | Multi-user | Blast radius if compromised |
|---|---|---|---|---|---|
Local stdio | stdio | Developer machine | Manual | Single user | Laptop credential, one developer's reachable objects |
Remote HTTP/SSE | SSE, Streamable HTTP | Central server | OAuth | Multiple users | Server-side credential, bounded by its warehouse role |
Vendor CLI/MCP | Varies | Vendor or self-hosted | Varies | Depends | Depends on the credential the interface holds |
The recommendation follows from the blast-radius column. A central server keeps the warehouse credential off endpoints, gives you one place to rotate it, and produces one audit identity per team rather than one per laptop. If a team insists on stdio for exploration, scope that server to a read-only sandbox account and treat it as a temporary exception with an expiry date.
Step 2: Configure the Agent With Managed, Not Local, Settings
Configuration must be enforced by administrators, not agreed to by developers. Both Claude Code and Cursor support central control; the mechanisms differ, and you should know which one you are relying on.
Claude Code exposes several managed MCP surfaces, documented as deployment patterns. managed-mcp.json defines a fixed server set with exclusive control: every user gets the servers you list, and servers they configure themselves do not load. managedMcpServers provides remote servers to every user while letting them keep their own. allowedMcpServers plus allowManagedMcpServersOnly: true publishes an approved catalog that users can add from, blocking anything else; without the second key you get a soft allowlist that users can broaden in their own settings. deniedMcpServers blocks known-bad servers and allows everything else. For a warehouse rollout, the approved-catalog pattern is usually the right balance: developers keep flexibility, but only among servers you have reviewed.
Enforcement is visible in behavior. When an enterprise MCP config is present, a workstation exits at startup with You cannot dynamically configure MCP servers when an enterprise MCP config is present, and the --strict-mcp-config flag, which asks to replace the managed set, causes the same exit on a workstation and in a cloud session. That is the design working, not a defect to route around. Servers blocked by an allowlist or denylist are hidden from claude mcp list and claude mcp get rather than displayed with a blocked status, so absence from the list is itself a signal. Use literal URLs and commands in policy entries you rely on for enforcement, because a pattern that references an environment variable still depends on the launching shell's value.
Cursor centralizes through Team MCP servers. Per Cursor's documentation, team admins configure shared servers under Dashboard → Plugins & MCPs, and a Team MCP server's config is shared by the whole team: editing it from any surface, including an automation's MCP settings, changes the value for every teammate and automation that uses it. Only team admins can edit a Team MCP server or replace credentials a team plugin already has, and org admins have the same access on every team linked to their organization, even without a team admin role.
Checkpoint before moving on. Confirm the agent lists the server and identifies it as managed, then attempt to add a server locally and confirm it is rejected or hidden. If a developer can still add an unlisted server, your allowlist is soft or your delivery channel is not reaching the machine. Fix that before proceeding, because every later control assumes the server set is what you published.
Step 3: Enforce Least Privilege at the Warehouse, Not Just the Agent
The agent's permission prompts are a usability feature; the warehouse's authorization is the security boundary. "The agent asked nicely" is not a control, and the specification makes clear why you cannot treat the client side as sufficient: authorization is OPTIONAL for MCP implementations.
That optionality has concrete consequences. The MCP authorization specification warns that when an MCP server does not verify that tokens were specifically intended for it, for example through the audience claim described in RFC 9068, it may accept tokens originally issued for other services, which breaks a fundamental OAuth boundary and lets attackers reuse legitimate tokens across services. It also states that an MCP server making requests to upstream APIs must not pass through the token it received from the MCP client; the upstream token is a separate token issued by the upstream authorization server. Servers MUST validate access tokens before processing a request, ensuring the token was issued specifically for that server. Ask your server vendor or your own team which of these behaviors is implemented, and test it rather than reading the marketing page.
With that as the backstop, apply least privilege at the warehouse layer. These are the items your acceptance review should actually check, because each one lives in the database, not in the agent:
Read-only roles as the default. Grant
SELECTon named schemas, not the whole catalog. Revoke write, DDL, and grant privileges from the agent's role entirely.Dataset and tool allowlists, enforced server-side. The MCP server should expose only the tables and only the tools you approved, and the warehouse role should not reach anything else even if a request gets through.
Identity propagation. The agent's queries should run as the service account, or as the underlying human through token exchange, never as a shared superuser. Audit attribution depends on this.
SQL restrictions at the parser level. Reject DDL, DML, and multi-statement payloads before execution. Use an AST check rather than string matching, because comments, whitespace, and semicolons defeat regex filters.
Timeouts and row limits. Cap statement runtime and returned rows at the warehouse or the server, so a fan-out query dies instead of billing to completion.
Exfiltration and export approval. Block unapproved
COPY, unload, and external-stage writes. Route any bulk export through an approval step with a recorded ticket.Separate credentials for write paths. If the agent must write, give it a distinct account with a narrow grant and its own audit trail, and keep it out of the default configuration.
Example configuration — validate in your target environment
The block below is application-level pseudoconfiguration, not a vendor file format. It shows the decisions a policy must record, so your security reviewer can see them in one place. Official Claude Code and Cursor client configuration syntax is client and version specific. Read the Claude Code MCP documentation and the Cursor MCP documentation before writing a real file, and never publish secrets in any config, example, or ticket.
{
"mcp_server": {
"name": "warehouse-readonly",
"transport": "http",
"auth": {
"mode": "oauth",
"audience_validated": true
}
},
"warehouse": {
"account": "svc_agent_analytics",
"role": "RO_ANALYTICS_MART",
"connection_secret_ref": "<secret-manager-path>",
"read_only": true
},
"allowed_datasets": ["mart_sales", "mart_ops"],
"allowed_tools": ["run_select", "describe_table"],
"sql_policy": {
"parser": "ast",
"allow_statements": ["SELECT"],
"deny_statements": ["INSERT", "UPDATE", "DELETE", "MERGE", "DDL"],
"deny_multi_statement": true,
"deny_unapproved_export": true
},
"limits": {
"query_timeout_seconds": 120,
"max_rows_returned": 10000,
"max_bytes_scanned_per_session": "<set-from-budget>"
},
"audit": {
"log_identity": true,
"log_query_text": true,
"correlation_key": "session_id"
},
"export_requires_approval": true
}
Read it as a checklist of decisions, not as copy-paste code. Every placeholder needs a real value from your own platform, and every key needs a test that proves the rule is enforced rather than merely declared.
A useful test of whether this layer is real: revoke the agent's role in the warehouse and confirm the agent fails immediately, without any change to the agent's own configuration. If it keeps working, something upstream is caching or proxying with broader rights than you intended.
Client-side allowlists and prompts do not grant database permissions, and they cannot remove them either. A user prompt telling the agent "read only" is not a role. An approved-server list only controls which server loads. If that server holds a credential with INSERT or DROP, the agent has those rights regardless of what the allowlist says. So test the database, not just the client.
Step 4: Add Guardrails for the Failure Modes Agents Actually Have
Agents fail differently from analysts. They retry, they fan out, they run unattended, and they can consume budget faster than any dashboard reports it. Guardrails should target those behaviors specifically.
Retry amplification. A published e6data problem write-up describes the pattern: an agent does not run one query per question but runs describe, select * limit 100, a failed attempt, a rewrite, a retry on a stale timestamp filter, and then the real query, with each retry separately billable. The same write-up reports a scheduled agent loop that ran 46 times over 26 hours and a provider usage dashboard that still showed a fraction of the spend when checked manually, because it lagged by days. Treat these as reported scenarios from one vendor's problem statement rather than universal measurements, but the mechanism is general: exploratory and retried queries multiply cost, and invoice-time reconciliation discovers it too late.
Exploratory fan-out and unbounded sessions. An agent asked a broad question may enumerate tables, sample many of them, and keep a session open while it reasons. Controls that work:
Query timeouts at the warehouse, so a runaway scan is killed rather than billed to completion.
Per-session cost ceilings, enforced server-side, that terminate the session when exceeded.
Loop detection on repeated identical or near-identical queries within a window.
Real-time spend visibility during the session, not a dashboard that reconciles days later.
Output limits and row caps. A SELECT * on a wide table can flood the agent's context window and crowd out the reasoning it needs. Claude Code exposes MAX_MCP_OUTPUT_TOKENS to cap MCP output tokens for tools that do not declare their own limit, and lets a server annotate individual tools with _meta["anthropic/maxResultSizeChars"] to raise that tool's threshold up to a hard ceiling of 500,000 characters. Set the global cap conservatively and raise it only for tools that legitimately return large results. Pair the client cap with a warehouse row limit, so the trim happens before bytes move.
One more limit worth knowing if you run a WebSocket server: Claude Code closes the connection when a single message exceeds 16 MiB, and in-progress calls on that server fail. Return less data per message.
Exfiltration paths. Most agent-to-warehouse incidents that get discussed publicly are cost stories, not theft stories. The exposure risk is quieter: an export statement that writes a full table to object storage, a tool that dumps a result set to a URL, or a wide result pasted into a chat that then leaves the network. Block export verbs at the parser and require an approval record for any bulk movement of data.
Step 5: Verify the Connection Before You Hand It to the Team
Run this sequence on a pilot workstation and record the observed result for each check. A check passes only when the observable matches the expectation; "it seemed to work" is not a result you can attach to a security review. Checks 3 through 7 are the ones a client-side setup cannot satisfy on its own.
# | Check | Pass condition |
|---|---|---|
1 | List configured servers | The warehouse server appears and is identified as managed; a locally added test server is absent or rejected |
2 | Read an approved table | The expected row count and sample values return, matching a query you ran directly |
3 | Query an unapproved dataset | The server refuses the tool call or the warehouse rejects it, with no rows returned |
4 | Attempt a denied write |
|
5 | Obfuscate a write through the parser | A write hidden in comments, casing changes, or a multi-statement string is still rejected by the AST check |
6 | Request an unapproved export |
|
7 | Inspect the audit log | The entry records the service-account identity, the query text, the timestamp, and a session key you can correlate to the client |
8 | Submit an oversized or malformed query | The request is rejected or truncated per your row and timeout limits, and the agent reports the failure rather than looping |
Two checks deserve a second pass. For check 5, try several obfuscation styles in one sitting; a filter that passes once may still miss a variant. Run check 8 twice and confirm the agent does not enter a retry cycle, because a loop can exhaust a session budget before anyone reads the dashboard. Check 7 is the one auditors ask about, so export the log entry and attach it to the integration record.
If any check fails, stop. Eight tests with six passing is not a partially safe connection. It is a connection whose remaining risk you have not measured.
Common Mistakes and How to Catch Them
These are the failures that recur in agent-to-warehouse deployments, with the symptom that reveals each and the fix. Most of them share a root cause: someone treated a client-side setting as though it were a database control.
Credentials committed to a shared .mcp.json. Project-scoped server definitions live in .mcp.json at the project root and are shared with the team through version control. If someone embeds a token or connection string there, it is now in the repository history. Symptom: a secret scanner alert, or a token visible in a pull request. Fix: use environment variable references rather than literal secrets, rotate anything that was committed, and prefer OAuth so no long-lived secret exists to commit.
The same server name defined in multiple scopes with different endpoints. Claude Code warns about this conflict in claude mcp list output and in /mcp, and because it stores OAuth sign-ins per endpoint, a user who authenticates the definition that loads in one project still has to sign in separately in a project where a different definition loads. Symptom: repeated sign-in prompts, or a connection that behaves differently in two repositories. Fix: keep the endpoint you want and remove the others from the other scopes, then re-run the verification checks.
Assuming MCP authorization is on by default. The specification makes authorization optional, so a server can be deployed without it. Symptom: the server works with no token exchange, or accepts a token issued for another service. Fix: confirm audience validation and token handling with the server owner, and rely on warehouse-side authorization as the backstop.
Granting the agent a human's personal credentials. Symptom: audit logs show a named employee running queries at hours they were not working, or a departure requires rotating an account the agent depends on. Fix: dedicated service accounts per agent or team, with read-only defaults.
Treating an approved-server list as a data control. Symptom: the allowlist is enforced, yet the agent still reads tables outside the intended scope because the server's credential can see the whole catalog. Fix: scope the warehouse role, not just the server list, and re-run the unapproved-dataset check.
Assuming a managed connector is covered by managed-mcp.json. Claude Code's documentation distinguishes how connectors reach different session types: terminal, VS Code, JetBrains, and Agent SDK sessions fetch them from claude.ai and are governed by that section's settings and managed MCP configuration, while the desktop app's local and SSH sessions deliver them in-process, where organization-level blocked tool entries apply instead. Symptom: a connector is usable on a machine where your fixed server set should have excluded it. Fix: test the specific surface your developers use, and treat desktop-app connectors as a separate control path.
Trusting a server you have not reviewed. Servers that fetch external content can expose the agent to prompt injection. Symptom: the agent takes actions nobody requested after reading fetched content. Fix: review the server's source for critical integrations, and keep the approved catalog small.
Acceptance Checklist Before You Go Live
Hand this list to security review with the evidence for each item attached. Most items are database-side, because that is where enforcement has to live.
Managed client configuration is enforced across the fleet through MDM, GPO, fleet management, or the vendor admin dashboard, and verified on a sample of machines.
The client allowlist is locked to managed sources (
allowManagedMcpServersOnly: truein Claude Code, or the equivalent team-level control in Cursor), and a locally added server is confirmed rejected. Record that this gates loading only, not database rights.A dedicated service account exists per agent or per team, with read-only as the default role and write grants removed.
The MCP server exposes an approved tool list and an approved dataset list, and unapproved calls fail.
Identity propagation is confirmed: queries run as the service account or the exchanged human identity, not a shared admin.
SQL policy is enforced by an AST parser, with DDL, DML, multi-statement payloads, and unapproved exports rejected.
Adversarial denied-write tests pass, including obfuscated statements hidden in comments, casing, and multi-statement strings.
Query timeouts, row caps, and per-session byte or cost ceilings are set and enforced server-side.
Export and bulk download require an approval step with a recorded owner.
Audit logs record the service-account identity, query text, timestamp, and a session correlation key that maps back to the client session.
A named owner is recorded for the integration, along with the review cadence for the allowlist and service-account grants.
A documented rollback exists: revoke the service account and remove the server from the managed set, with the expected effect on active sessions written down.
Where a Governed Lakehouse Fits
Every checklist item above maps to a capability your warehouse either has or lacks. That makes a narrow question worth adding to your next platform review: does the warehouse give agents the same roles, SQL policy, and audit trail as the human team, or does automation need a separate and weaker path?
Singdata describes its agent interfaces on that basis. The vendor says CZ-CLI and MCP give Claude Code, Cursor, and Codex deterministic commands and governed context under the same permissions and semantics as the human team, with safeguards around write and high-risk actions, and it keeps data in open formats in the customer's own object storage. Treat that as a vendor description to verify, not a result. The useful move is to run the verification sequence above against it and compare the audit output with what your current warehouse produces.
To test that path, start with the CZ-CLI setup for the agent interface and the platform overview for the architecture and permission model.
FAQ
These are the four questions that come up most often when someone hands this article to a security reviewer.
Is MCP authorization required?
No. The MCP authorization specification marks authorization as optional for implementations, so a server can expose tools without any OAuth flow at all. That is why the warehouse's own authentication and authorization must be the backstop. The agent's permission prompt is a usability control, not a security boundary.
Can I use a local stdio server in production?
It works, but it is the weakest fit for team access. Cursor's MCP transport table describes stdio as local, single-user, and manually authenticated, while SSE and Streamable HTTP can run locally or remotely, are multi-user, and use OAuth. For shared warehouse access, deploy the server centrally and keep credentials off laptops.
How do I stop an agent from running up the bill?
Set query timeouts, per-session cost ceilings, and loop detection, and watch spend while queries run rather than reconciling invoices later. A published retry-loop write-up describes agents issuing describe, sample, failed-attempt, and retry queries that are each billed separately, and reports dashboards lagging behind actual consumption. Treat those figures as reported scenarios, not benchmarks.
What's the difference between Claude Code's managed MCP config and Cursor's Team MCP servers?
Both centralize control; the mechanisms differ. Claude Code uses managed-mcp.json, delivered through MDM, GPO, or fleet management, plus allowlists enforced through managed settings sources, and can lock the allowlist to managed sources only. Cursor configures shared servers under Dashboard → Plugins & MCPs, where per its MCP documentation only team admins can edit a Team MCP server or replace its credentials, and org admins hold the same access across linked teams.