ScreenshotNeo

BlogAI agents

Understanding and Managing Data Risks in MCP Servers

A practical guide to MCP data risks: authority, tokens, tool poisoning, prompt injection, isolation, validation, and safer operations.

By the ScreenshotNeo team1 October 20267 min read

Direct answer: MCP server data risk is determined by the authority a server receives, the data its tools expose, and whether untrusted instructions or content can influence model-selected tool calls. Reduce exposure with least-privilege permissions, narrow credentials, reviewed tool definitions, isolated execution, validated inputs and outputs, secure token handling, logging, and explicit approval for sensitive actions. Local stdio is a trust boundary, not a sandbox.

What an MCP server can access

The Model Context Protocol connects model-driven applications to tools and data. A server may expose file access, database operations, network requests, or system commands. Those capabilities are not automatically vulnerabilities; the security question is whether the authority, configuration, and authorization match the documented purpose.

Capability Potential data exposure Control to apply
Filesystem Source code, credentials, personal files Mount only required directories; use read-only access where possible
Database Production records and secrets Dedicated account, restricted schema, read-only role, query limits
Network/API Internal services or third-party data Allowlist destinations and use a separate, scoped credential
System commands Host configuration, processes, or credentials Containerize, drop privileges, restrict binaries and network access

Document what each server can read, modify, delete, and transmit. This inventory lets reviewers distinguish intended function from an access-control failure. The MCP security policy says, “MCP’s security model places certain responsibilities on developers and operators.” Read the MCP Security Policy and Trust Model.

How data leaks happen in MCP deployments

Excessive authority and confused deputy behavior

A server may hold broader authority than the person or model requesting an operation. If it uses that authority without requester-specific checks, it becomes a confused deputy. Give every server its own narrow credentials and enforce authorization for each operation.

Token theft, leakage, and incorrect audience

Tokens can leak through environment dumps, caches, logs, error messages, or model context. For remote MCP, clients and servers must bind tokens to the intended resource and validate the token audience. An MCP server must never pass a client token through to an upstream API; issue and store a separate upstream credential. Use HTTPS, secure token storage, short-lived tokens where available, and PKCE with S256-capable clients. See the MCP project’s authorization security considerations.

Tool poisoning and schema manipulation

Tool names, descriptions, parameter schemas, and returned content are part of the attack surface. A changed description can steer a model toward an unsafe action; a malicious response can request that the model disclose data in a later call. Review definitions before approval, monitor changes, and treat metadata and outputs as untrusted input.

Prompt injection and exfiltration

Web pages, documents, tickets, and database fields can contain instructions intended to influence the model. Restrict the data available to the server, validate destinations and output formats, and gate consequential actions. A legitimate tool call can still exfiltrate sensitive data if hostile content controls its parameters.

Unsafe local execution

A stdio server runs as a local subprocess with the client’s environment-level privileges. The stdio transport does not sandbox it. Use a container or equivalent OS isolation with restricted filesystem, network, process, and secret access. The MCP security policy describes this trust boundary.

Supply-chain and shadow-server exposure

Unreviewed packages, altered dependencies, or an unapproved server can bypass governance. Keep an approved inventory, pin and review dependencies, verify provenance, and alert when a server binary, package, or tool schema changes.

A practical MCP security review

  1. Inventory. Record owner, purpose, transport, data sources, tools, credentials, and deployment location for every server.
  2. Map authority. For each tool, state exactly what it can read, write, delete, or transmit.
  3. Minimize access. Use per-server accounts, read-only roles, directory mounts, destination allowlists, and separate upstream tokens.
  4. Review tool contracts. Inspect names, descriptions, schemas, defaults, and response fields. Alert on unexpected changes.
  5. Isolate execution. Run local servers in containers or equivalent sandboxes with dropped privileges and restricted egress.
  6. Validate boundaries. Validate input types, URLs, paths, query scope, output size, and destination before invoking another tool.
  7. Gate sensitive actions. Require clear user confirmation for destructive, financial, permission-changing, or data-sharing operations; display the meaningful parameters.
  8. Audit safely. Log tool calls, actor, server version, permission changes, and outcomes while redacting tokens and sensitive payloads.
  9. Test recovery. Revoke credentials, roll back a changed server, and investigate suspicious calls as part of incident drills.

Remote authorization checklist

  • Use HTTPS for authorization and token endpoints.
  • Include the resource parameter in authorization and token requests.
  • Validate that every access token was issued for the receiving MCP server.
  • Use PKCE; use the S256 method when the client supports it.
  • Validate redirect URIs and authorization-server metadata.
  • Do not forward an MCP client token to an upstream API.
  • Use a separately issued, least-privilege upstream token.
  • Review session binding, mix-up, open-redirect, and confused-deputy behavior.

Local stdio hardening example

The following launcher illustrates the controls to add around a local server. Adjust paths and the executable for your environment; the MCP protocol itself does not provide these restrictions.

#!/usr/bin/env bash
set -euo pipefail

# Run the server as an unprivileged user inside a container.
docker run --rm --read-only \
  --cap-drop=ALL \
  --network=none \
  --pids-limit=128 \
  --tmpfs /tmp:rw,noexec,nosuid,size=16m \
  --mount type=bind,src="$PWD/project",dst=/work,readonly \
  --user 10001:10001 \
  my-approved-mcp-server:sha256:PINNED_DIGEST

Keep secrets outside the mounted project, inject only the specific credential the server needs, and review the image digest and dependency lockfile before deployment.

Validating tools and outputs

// Simplified policy wrapper; enforce equivalent checks in your runtime.
function allowToolCall(call) {
  if (call.name === "delete_file") return false; // require an approval flow
  if (call.name === "fetch_url") {
    const u = new URL(call.args.url);
    const allowed = ["api.example.com", "docs.example.com"];
    if (!allowed.includes(u.hostname) || u.protocol !== "https:") return false;
  }
  if (JSON.stringify(call.args).length > 20_000) return false;
  return true;
}

function validateResult(result) {
  if (result.secret || /Bearer\\s+[A-Za-z0-9._-]+/i.test(result.text || "")) {
    throw new Error("Sensitive output blocked from model context");
  }
  return result;
}

Use structured schemas, reject unknown fields, cap result sizes, normalize paths, and strip secrets before results enter model context. Treat retrieved content as data, never as a policy instruction.

Monitoring and response

  • Alert on new servers, changed tool schemas, unexpected destinations, privilege changes, and unusual call volume.
  • Correlate model session, user identity, server version, tool name, and approval event.
  • Redact access tokens, cookies, authorization headers, and sensitive records in logs.
  • On suspected leakage, revoke affected credentials, disable the server, preserve audit records, identify accessed data, and rotate downstream secrets.

Performance, reliability, and cost considerations

Security controls add work at boundaries. Schema validation and allowlists are usually cheap; container startup, remote authorization, human approval, and deep output inspection add latency. Keep servers warm where safe, cache only non-sensitive data with a defined retention period, and set timeouts and result-size limits. Retries must be idempotent: repeating a read is different from repeating a write or payment.

Track authorization failures, denied calls, timeouts, queue depth, and downstream error rates. Design for partial failure: a model should receive a clear denial or timeout rather than silently falling back to a broader credential. Cost depends on your infrastructure and upstream services; the reviewed MCP and OWASP sources do not establish ecosystem-wide risk or mitigation benchmarks.

Common errors and fixes

Symptom Likely cause Fix
401 or invalid token audience Token was issued for another resource Request the correct resource and validate audience at the server
Upstream API rejects a token Client token was passed through Exchange for a separate upstream credential
Server reads unexpected files Broad host mount or inherited privileges Use a restricted mount, unprivileged user, and container
Model follows instructions in retrieved text Prompt injection in tool output Mark content untrusted, constrain tools, validate destinations, require approval
Tool behavior changed without deployment Schema poisoning, rug pull, or dependency change Pin versions, review diffs, verify provenance, and alert on metadata changes
Logs contain secrets Raw headers or results were recorded Redact before logging and restrict log access
stdio server compromises the host Assumed stdio was a sandbox Run it in a container or equivalent OS isolation

Or skip the browser setup

If an MCP workflow needs screenshots of pages for review or evidence, ScreenshotNeo provides a website screenshot API and MCP server. A single request returns PNG, JPEG, WebP, or PDF. The service accepts cookie and consent banners as a visitor and removes more than 60 known consent platforms, newsletter popups, and chat widgets before capture; each step can be disabled. Bot checks, blank pages, timeouts, failed loads, and cache hits are not billed, and responses identify the page verdict and billing status in X-Page-Verdict and X-Billed headers. Its MCP tools are take_screenshot, get_page_info, and capture_pdf.

cURL:

curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp

Python:

import requests
r = requests.get("https://api.screenshotneo.com/v1/shot", params={"access_key": "YOUR_API_KEY", "url": "https://stripe.com"}, timeout=90)
open("shot.webp", "wb").write(r.content)

Node.js:

const q = new URLSearchParams({ access_key: 'YOUR_API_KEY', url: 'https://stripe.com' });
const res = await fetch(`https://api.screenshotneo.com/v1/shot?${q}`);

See the ScreenshotNeo API documentation for options such as full-page or element capture, device and retina settings, custom CSS and JavaScript, waits, request blocking, headers and cookies, geolocation, caching, signed links, async webhooks, bulk capture, PDFs, and usage reporting. There is an MCP server for AI agents, 1,000 screenshots per month free with no card, and paid plans start at $5 for 3,000 shots. Create a free ScreenshotNeo account.

FAQ

Is every powerful MCP server vulnerable?

No. A filesystem, database, or command server may be performing its documented function. Risk depends on scope, authorization, configuration, isolation, and how model-selected actions are controlled.

Does authentication prove an MCP deployment is safe?

No. Authentication identifies a caller; authorization scope, token audience, tool behavior, content handling, and approval controls determine what that caller can cause.

Should all MCP servers be remote?

No. Choose transport based on the data and isolation you need. Local stdio can be appropriate when wrapped in an explicit OS or container boundary.

Can prompt filtering alone stop exfiltration?

No. Combine untrusted-content handling with least privilege, destination allowlists, output validation, and approval for sensitive actions.

How often should tool definitions be reviewed?

Review them before approval and whenever code, dependencies, schemas, descriptions, or deployment settings change. Alert on unexpected changes.

Primary references