Limited-period launch offer: 80% OFF · MCP Builder’s Handbook at ₹98 instead of the regular ₹499 · See details
Roori eBooks
Security

MCP security checklist: prompt injection, SSRF, least privilege and more

Published 2026-10-20 · Roori eBooks

MCP makes it easy to hand an AI app some powerful tools. It also makes it easy to hand over too much. Run through this list before you put any MCP server in front of real users.

This is our own guidance. The protocol facts come from the MCP 2026-07-28 spec. No checklist makes a system "secure". You still need to review your own setup.

The threats, in one table

Threat How it happens What to do about it
Prompt injection A tool returns text (web page, ticket, document) with instructions the model follows Treat tool output as untrusted data. Limit what tools can do. Ask for approval on risky actions
Over-privileged tools One credential can read or change everything Least privilege, per-user scopes, read-only by default
Raw command, SQL or URL tools A tool accepts a free-form shell string, SQL or URL Don't build them. Use fixed, parameterised operations
SSRF A fetch tool gets steered to internal addresses Allow-list hosts, block private ranges, no redirects across hosts
Credential leaks Secrets in the app, logs or responses Use a secret manager. Never put keys in client code. Redact logs
Confused deputy The server uses its own broad credential for a low-privilege user Check permissions per user, per call
Resource exhaustion Huge inputs, loops, unbounded output Size limits, timeouts, rate limits, capped pagination
Supply chain A buggy or malicious dependency Pin versions, use lockfiles, read release notes, scan dependencies

Read-only first, approval for anything with consequences

Think of two kinds of tool. Read tools change nothing. Write tools are switched off by default, tightly scoped, and the host must show the user the exact parameters and get a clear yes before the call goes through.

Authentication and authorisation

Prompt injection: five habits

  1. Keep data and instructions apart in the host.
  2. Shrink the blast radius. A model reading an untrusted document shouldn't also hold a tool that can send data out or change records, not in the same step.
  3. Show a human the parameters before any consequential action.
  4. Cap the size. Trim, truncate, paginate.
  5. Test it. Put an injection string in your test data and check that nothing changes.

SSRF and databases

Never take a raw URL from the model. Take an identifier and map it to a fixed, allow-listed endpoint. For databases, don't offer "run any SQL". Offer a fixed catalogue of parameterised queries that run under a read-only account on specific views, with a row cap and a statement timeout.

Day-to-day operations

Privacy

This list does not cover Indian data-protection law. Before you handle personal data of people in India, read the Digital Personal Data Protection Act, 2023 and its rules, and talk to a qualified lawyer.

Related reading

What is MCP? · Build a Python MCP server · The MCP Builder's Handbook has a full security chapter and a production checklist.

Frequently asked questions

Does MCP include authentication?

Authorization is optional in the MCP spec. For HTTP transports, implementations should follow the MCP authorization spec, which builds on OAuth 2.1 (draft) and related RFCs. For stdio they should read credentials from the environment. A remote MCP endpoint must never be anonymous.

What is prompt injection in MCP?

It's when text returned by a tool (a web page, a ticket, an email, a document) contains instructions that the model then follows. Treat anything that came from outside your control as untrusted data.

Should an MCP tool run raw SQL or shell commands?

No. Unrestricted shell, arbitrary SQL and arbitrary URL fetching are not safe defaults. Use fixed, parameterised operations instead.

₹98 ₹499 80% OFF
Buy the MCP e-book