You ask your AI assistant to review last week's Google Ads search terms and clean up obvious waste. Five seconds later, it misreads a campaign label and cuts the daily budget on your top-converting brand campaign in half. When an MCP server holds write access to live advertising or CRM accounts, a single misread prompt stops being an annoying chat error and becomes a real financial event.
Most security checklists treat an MCP server like a generic REST API. That framing misses what goes wrong in production. Deterministic code sends predictable requests, whereas a language model decides which tools to call at runtime based on prompts, tool descriptions, and external data it just read.
Applying MCP server security best practices means ordering your defenses by blast radius. First you cap what an agent can touch, then you verify every mutation, lock down credentials, record reversible history, and harden the supply chain and network layer underneath. Here are seven controls I rely on when running write-capable MCP servers against live ad accounts.
Table of Contents
- 1. Enforce Least-Privilege Scopes and Per-Tool Permissions
- 2. Require Human Approval for Destructive or Financial Actions
- 3. Defend Against Prompt Injection and Tool Output Poisoning
- 4. Use OAuth 2.1 and Secure Credential Management
- 5. Maintain Immutable Audit Logs and One-Click Reversibility
- 6. Verify Server Provenance, Pin Versions, and Protect Tool Descriptions
- 7. Secure Transport, Session Handling, and Network Exposure
- How the seven MCP server security controls compare
- Turning These Seven Controls Into a Working Security Plan
1. Enforce Least-Privilege Scopes and Per-Tool Permissions
Authentication tells your server who is calling, not how much damage that caller can cause. The official MCP security best practices guide warns that token misuse, confused-deputy behavior, local compromise, server-side request forgery (SSRF), and data exfiltration remain distinct threats even after login succeeds. An agent with a valid OAuth token can still wreck a live account if its scopes cover more tools or ad accounts than the task requires.
Before exposing any write path, lock down what each tool can reach inside your workspace.

Say a performance marketing agency runs diagnostics across twenty client accounts every Monday. Pairing a read-only GA4 reporting connector and read-level Google Ads scopes with a separate, gated write connector keeps exploratory analysis safe. Even if a model hallucinates a tool call during reporting, the read-only token can't pause an ad set or alter bids.
Strict account scoping matters just as much as tool separation. Multi-tenant teams need per-account authorization checks on every request so a session authorized for Client A can never query or mutate Client B's campaigns. The trade-off is extra onboarding friction when adding new accounts, but that friction pays for itself the first time an agent picks the wrong account ID from context.
Practical Scope Boundaries to Set First
- Default every new tool to read-only: Require an explicit configuration flag and code review before enabling any mutation capability on a server.
- Maintain a tool permissions matrix: Document the exact upstream API scopes and account boundaries each tool requires, and review that matrix whenever you ship a new tool.
- Split read and write OAuth clients: Where the ad platform allows it, issue separate service accounts or OAuth clients for diagnostic reads versus live writes.
- Prune stale grants on a schedule: Revoke unused scopes and disconnected ad accounts regularly so old experiments don't sit around with standing write access.
2. Require Human Approval for Destructive or Financial Actions
Say an ecommerce growth manager asks Claude to draft negative keywords for Google Ads and shift budget across ad sets using a Meta Ads MCP connection. Without an approval gate, the model executes those mutations directly. With a proper gate, the server returns a concrete preview showing every keyword, match type, target campaign, dollar amount, and percentage change, then halts until a human signs off.
Do not let the language model police this boundary. The OWASP AI Agent Security Cheat Sheet advises enforcing approvals in execution middleware outside the model context, verifying that the approval belongs to the authenticated user and exact tool call, and consuming it atomically right before execution. Trusting a model-supplied user_confirmed boolean fails the moment prompt injection or model drift flips that flag to true.
Human-in-the-loop middleware turns autonomous risk into a reviewable workflow.

Treat the language model as a drafting assistant, never as the final approver for a budget change.
Approval gates do slow down high-frequency tweaks, and some teams push back because they want "hands-free" optimization. In practice, I recommend keeping read and diagnosis completely frictionless while gating every write that touches spend, targeting, or customer-facing CRM fields. You get almost all the speed of chat-driven operations without betting your monthly budget on probabilistic output.
What Makes an Approval Gate Hard to Bypass
Your execution layer should issue single-use approval tokens that expire within minutes and bind directly to a cryptographic hash of the exact request payload. If the model retries with a different campaign ID or turns a modest budget shift into a much larger spend increase, the hash mismatch forces a brand-new confirmation. Pair that check with server-side hard ceilings, such as a maximum daily budget increase, and record the approving user's identity alongside the staged diff.
3. Defend Against Prompt Injection and Tool Output Poisoning
Advertising and CRM workflows constantly pull untrusted text into a model's context window. Search term reports, competitor ad copy, inbound CRM lead notes, and scraped landing pages all originate outside your trust boundary. An attacker doesn't need to hack your server if they can plant hidden text in a form submission or query string that steers an AI agent into calling a write tool.
This isn't a theoretical edge case. A 2025 MCP security benchmark evaluating client, protocol, server, and host layers reported a 100% attack-success rate for its tested tool-disambiguation vulnerability across three MCP hosts, alongside ecosystem-wide risks from indirect prompt injection, tool poisoning, and cross-server tool shadowing. Relying on system prompts to tell the model "ignore hostile instructions" breaks down reliably under adversarial input.
Server-side filtering and schema enforcement give you deterministic guardrails before anything reaches an upstream platform.

Imagine a search term report containing a crafted query string telling the assistant to pause active brand campaigns and export account data to an external URL. Even if the model takes the bait, strict server-side validation blocks arbitrary URLs, rejects unknown arguments, and triggers an approval gate that surfaces the bogus pause request to a human operator.
Separating Untrusted Reads From Write Execution
- Validate every argument against a strict schema: Enforce explicit types, enums, and string patterns on every tool call, and reject unexpected fields outright instead of ignoring them.
- Cap numeric parameters server-side: Hard-code safe bounds for bids, budgets, and bulk-edit counts so a poisoned instruction can't slip an extra zero into a spend update.
- Isolate untrusted readers from unguarded writers: Avoid giving a single agent session both external content-fetching tools and high-privilege write tools unless an independent approval gate sits between them.
- Alert on suspicious tool-call sequences: Log call order and flag anomalies, such as an immediate campaign mutation right after reading external web pages or raw CRM lead notes.
4. Use OAuth 2.1 and Secure Credential Management
Pasting raw Google Ads developer tokens, Meta system user tokens, or CRM API keys into local desktop configs or chat prompts is still the fastest way to suffer a quiet breach. Static keys rarely expire, carry broad scopes, and sit unencrypted on laptops or in chat logs where any compromised plugin can read them.
The MCP authorization specification published on June 18, 2025 addresses this by defining an MCP server as an OAuth 2.1 resource server and the MCP client as an OAuth 2.1 client acting for a resource owner. It requires MCP servers to validate access tokens on every request, publish protected-resource metadata, and enforce resource indicators so each token binds explicitly to its intended server. The specification also warns that attackers who pull tokens from client storage, server caches, or logs can access protected resources while looking completely legitimate.
For hosted servers, OAuth sign-in keeps upstream platform secrets out of the client entirely. A team reviewing a standard MCP authentication reference should look for PKCE (S256) on public clients, automatic authorization discovery via metadata, and runtime credential injection from a cloud secrets manager rather than credentials baked into container images.
Hardening Token Lifecycles and Upstream Secrets
Never forward a client's MCP access token straight to an upstream API. Token passthrough breaks audience validation and creates a confused-deputy opening if a downstream service trusts the wrong caller. Instead, validate that the incoming token's audience (aud) matches your canonical server URI, check expiry on every call, and fetch scoped upstream platform credentials from a dedicated secrets vault.
Trade-off to plan for: Short-lived tokens force more frequent refreshes, but they shrink the window an attacker gets if a debug log or local cache leaks.
Keep access tokens short-lived, rotate refresh tokens, scope every secret to one service and one environment, and run automated secret scanning in CI. Mask bearer tokens and API keys in tool responses and structured logs so a verbose error message never prints a live credential back into the LLM context window.
5. Maintain Immutable Audit Logs and One-Click Reversibility
Preventive controls fail eventually, whether from an over-eager approval click or a subtle bug in parameter mapping. When a live campaign pauses at 2 a.m. or daily spend jumps unexpectedly, you need two things within sixty seconds: proof of exactly what happened and a clean way to put it back.
OWASP's 2025 Top 10 for Large Language Model Applications classifies prompt injection as LLM01:2025 and flags insufficient monitoring and logging of LLM outputs as a core security gap. Standard HTTP access logs aren't enough here because they only show that a POST hit /mcp. You need structured, tamper-evident records for every tool invocation capturing the authenticated principal, tenant, client, tool name, arguments, authorization decision, target resource, timestamp, outcome, and human approval status.
Pairing forensic logs with pre-computed rollback steps turns incident recovery into a routine operation instead of a midnight scramble.

Consider an operator who approves a batch of forty negative keywords and a $200 daily budget increase on a Search campaign, only to realize ten minutes later the wrong campaign was targeted. If your server snapshots the prior budget and records each added keyword with its campaign ID, match type, and approver before committing the write, a single undo call restores the original budget and removes only those specific keywords without touching unrelated edits.
Building Recovery Into Every Write Call
- Snapshot prior state before writing: Read and store the current upstream value immediately before executing a mutation so you don't rely on guesswork during rollback.
- Attach a correlation ID end to end: Link the drafted proposal, human approval record, upstream execution response, and any subsequent undo event under one traceable ID.
- Lock down log access and scrub secrets: Audit trails reveal account structures, budgets, and customer workflows, so enforce strict role-based read access and strip bearer tokens and unnecessary PII before storage.
- Drill your undo path regularly: Run scheduled rollback tests on a sandbox ad account; an untested recovery mechanism usually breaks on API quirks the moment you need it.
6. Verify Server Provenance, Pin Versions, and Protect Tool Descriptions
Traditional API clients call fixed endpoints that engineers reviewed during code deployment. MCP flips that model: clients query a server at session startup and inject its tool names and descriptions straight into the LLM context. If an upstream maintainer's account gets hijacked or a third-party server pushes a silent update, the new tool description can steer your agent without triggering a single traditional code scanner.
Supply-chain exposure in the MCP ecosystem is already measurable. A 2025 academic evaluation of 1,899 open-source MCP servers found that 7.2% contained at least one general security vulnerability. Separately, research on MCP registry and supply-chain risks warns that weak registry vetting allows adversarial or hijacked servers into circulation, where attacker-controlled tool metadata can manipulate model reasoning without requiring a conventional software exploit.
For production advertising and CRM access, avoid unverified community servers altogether. Running first-party hosted servers from verifiable publishers with published security policies reduces local credential sprawl, though it concentrates trust in the provider's deployment, tenant isolation, and update hygiene. Either way, test every new server or major upgrade against a sandbox ad account before pointing it at live spend.
Keeping Tool Metadata Under Change Control
Pin every MCP server and its dependencies to exact versions rather than pulling floating latest tags. When your team approves a server, compute a cryptographic hash of its tool schemas and descriptions, then re-verify those hashes on startup and during runtime discovery.
Operational rule: Treat a changed tool description like unreviewed production code, not a harmless text tweak.
Configure your gateway or client policy to quarantine unexpected schema drift and require explicit re-approval instead of accepting modified tool definitions without review. Namespace tools by verified server identity so a newly added connector can't shadow or impersonate a trusted write tool already in your workspace.
7. Secure Transport, Session Handling, and Network Exposure
Even airtight OAuth scopes and approval middleware fail if an attacker can hijack the network path or overwhelm the server. Teams often start by running a local MCP server during prototyping, bind it to 0.0.0.0 for quick testing across devices, and forget to lock it down when it moves toward daily use.
Say a media buyer runs a local MCP server on their workstation and visits a compromised ad-tech blog in another browser tab. If the server skips Origin header validation on its HTTP transport, malicious JavaScript in that tab can attempt a DNS rebinding attack against localhost to invoke exposed tools. On remote servers, a different failure happens just as often: a looping agent retries a failing campaign mutation hundreds of times in two minutes, blowing through platform API quotas or triggering platform-level account locks.
Transport and session hygiene are unglamorous, which is why they're frequently skipped until an incident forces a rewrite. Enforce TLS on every remote endpoint, bind local development servers strictly to localhost, and generate high-entropy session identifiers bound to the authenticated user rather than predictable counters.
Transport and Quota Defaults That Contain Abuse
- Validate
Originheaders on HTTP transports: Reject requests from unexpected origins on both local and remote HTTP servers to block cross-site browser requests and DNS rebinding. - Never bind local servers to
0.0.0.0: Keep local servers on loopback interfaces (localhost) on shared office or coffee-shop networks so neighboring machines can't probe your endpoints. - Set separate rate limits for reads and writes: Allow generous quotas for diagnostic reporting while placing tight per-user and per-account caps on write-capable tools to stop runaway agent loops.
- Expire sessions and throttle auth failures: Terminate sessions on inactivity, logout, or token revocation, and automatically throttle or block clients generating repeated authentication errors.
How the seven MCP server security controls compare
| Item | Primary Risk Addressed | Key Control | Main Trade-off |
|---|---|---|---|
| Enforce Least-Privilege Scopes and Per-Tool Permissions | Excessive access amplifying errors or compromise | Grant each tool only the minimum required permissions | More configuration and maintenance |
| Require Human Approval for Destructive or Financial Actions | Unapproved or erroneous changes to budgets and live campaigns | Preview each change and require specific human approval before execution | Slower workflows and approval fatigue |
| Defend Against Prompt Injection and Tool Output Poisoning | Malicious content triggering unintended tool actions | Treat tool outputs as untrusted and validate inputs server-side | Added complexity and latency; defenses are incomplete |
| Use OAuth 2.1 and Secure Credential Management | Credential theft, misuse, or exposure | Use scoped, short-lived OAuth tokens and a dedicated secrets manager | More complex implementation and credential management |
| Maintain Immutable Audit Logs and One-Click Reversibility | Untraceable changes and slow recovery | Keep tamper-evident logs and store prior states for rollback | Storage and access-control overhead; not all actions are reversible |
| Verify Server Provenance, Pin Versions, and Protect Tool Descriptions | Malicious or compromised MCP servers and tool definitions | Allowlist trusted servers, pin versions, and review changes | Updates take longer and verification requires expertise |
| Secure Transport, Session Handling, and Network Exposure | Network attacks, session hijacking, and runaway requests | Use TLS, validate origins, secure sessions, and apply rate limits | Added infrastructure complexity and possible limits on legitimate usage |
Turning These Seven Controls Into a Working Security Plan
You don't need to build all seven layers in a single sprint to cut your risk dramatically. Start with the two controls that immediately cap financial blast radius: least-privilege scopes that separate read diagnostics from mutations, and server-enforced human approval gates on every write path. Once no model error can alter a live budget, you've eliminated the most expensive failure mode.
Next, harden the runtime boundary by adding strict argument schema validation, OAuth 2.1 with short-lived audience-bound tokens, and structured audit logs paired with tested rollback steps. Finally, put provenance checks, tool-description hash monitoring, and transport or rate-limit audits on a recurring quarterly schedule. The same blast-radius discipline holds anywhere AI agents touch sensitive operational data, whether you're managing paid media budgets or routing phone and PSA data through MCP where customer records and service tickets sit one tool call away.
If your team would rather not build and maintain OAuth 2.1 plumbing, approval middleware, and rollback snapshots from scratch, hosted MCP platforms like NotFair bake several of these controls into the core layer. We run a hosted MCP server over Streamable HTTP using OAuth with the authorization code flow and PKCE (S256), stage exact write operations (account, item, and new value) for explicit human approval inside configurable bid and budget limits, and keep logged history with one-call undo. Even with a managed platform handling the infrastructure, your team still owns the operational habits that make MCP server security best practices stick: reviewing account scopes, questioning unexpected diffs before clicking approve, and testing your undo workflow before a bad edit hits a live campaign.
NotFair gives performance marketers, agencies, and growth teams hosted MCP servers for Google Ads, Meta Ads, GA4, Search Console, and CRM tools, with approval-gated diffs, configurable spend guardrails, and one-call undo built in. Connect your workspace from Claude, Codex, or Cursor without storing raw platform secrets on local machines. Explore the platform and setup guides at NotFair.



