Coders In Hoods
  • Courses
  • Roles
  • Blog
  • Setup

Coders In Hoods AI Academy

Every course is free. Sign in to start, and your progress, quiz scores and bookmarks follow you.

AI Academy

  • Courses
  • Paths
  • Setup guides
  • How we teach

Role roadmaps

  • AI Engineer
  • Forward Deployed Engineer
  • Machine Learning Engineer
  • All roles

Coders In Hoods

  • The agency
  • Coaching for teams
  • Blog
  • LinkedIn
  • X (Twitter)

Contact

codersinhoods@gmail.com

© Coders In Hoods · since 2019

Course overview

Building MCP Servers

Free · sign in to start and track progress

1 · The protocol and its mental model

  • 1MCP and REST: two mental models
  • 2The protocol on the wire

2 · Designing servers agents use well

  • 3Designing tools, not endpoints
  • 4Testing and evaluating servers
  • 5Resources, prompts and asking for input

3 · Running servers in production

  • 6Remote servers and authorization
  • 7Securing MCP servers

    Exercise answers

    • Answer: Harden the server and replay an injected agent
    • Answer: Red-team the server with canaries and claude -p
  • 8Shipping and evolving servers
CapstoneShip an MCP server for an existing REST APIReference implementation

Module 3 · Running servers in production · Lesson 7

Securing MCP servers

Defend an MCP server as a target (inputs, authorization, tokens, handles, local exposure) and as a channel that carries untrusted text into a model, then measure the defences on your own server with harmless canaries.

95 min 1 video 3 exercises 8-question quiz Answers
Setup for the exercises:Install Claude CodeNode.js, pnpm and TypeScriptMCP servers in Claude CodeThe Larchmere Desk mock API

By the end of this lesson you can

  • Separate attacks on a server (the server as a target) from attacks that travel through it (the server as a channel), and name a control for each
  • Explain token passthrough and the confused deputy problem for proxy servers, and why a server accepts only tokens issued for it
  • Explain how indirect prompt injection, tool poisoning and rug pulls reach a model, and why tool annotations can't stop them
  • Build server-side controls that hold whatever the model decides, and say which defences are only probabilistic
  • Red-team your own server with harmless canaries and report compliance and unwanted writes with honest uncertainty

On this page

  • Two threat models: target and channel
  • The server as a target
  • Validate every input, twice
  • Authorize every call, not every connection
  • Tokens: audience and passthrough
  • The confused deputy, for proxy servers
  • State handles
  • SSRF and local exposure
  • The server as a channel
  • Prompt injection through tool results
  • Tool poisoning, shadowing and rug pulls
  • The lethal trifecta
  • Annotations are not enforcement
  • Defences that hold, and defences that help
  • Worked example: replaying an injected agent
  • Red-teaming your own server with canaries
  • Misconceptions and limits
  • Connections
  • Summary
  • Exercises
  • Sources & further reading
  • Quiz

In this lesson

  1. 01Two threat models: target and channel
  2. 02The server as a target
  3. 03The server as a channel
  4. 04Defences that hold, and defences that help
  5. 05Worked example: replaying an injected agent
  6. 06Red-teaming your own server with canaries
  7. 07Misconceptions and limits
  8. 08Connections
  9. 09Summary
  10. 10Exercises

Sources & further reading

  • Not what you've signed up for: Compromising Real-World LLM-Integrated Applications with Indirect Prompt InjectionPaper · Kai Greshake, Sahar Abdelnabi, Shailesh Mishra, Christoph Endres, Thorsten Holz, Mario Fritz · 2023The seminal paper on indirect prompt injection: instructions planted in data an application retrieves. Every tool result your server returns is that kind of data. Read the abstract and the taxonomy of impacts.
  • MCPTox: A Benchmark for Tool Poisoning Attack on Real-World MCP ServersPaper · Zhiqiang Wang, Yichao Gao, Yanting Wang et al. · 2025Tool poisoning measured on 45 live servers and 353 real tools: instructions hidden in tool metadata reached a 72.8% attack success rate on o1-mini, and no model refused more than 3% of attacks. Read the attack templates and the refusal analysis.
  • Model Context Protocol (MCP) at First Glance: Studying the Security and Maintainability of MCP ServersPaper · Mohammed Mehedi Hasan, Hao Li, Emad Fallahzadeh, Gopi Krishnan Rajbahadur, Bram Adams, Ahmed E. Hassan · 2025An audit of 1,899 open-source servers: 7.2% had general vulnerabilities, 5.5% showed MCP-specific tool poisoning, and only three of eight vulnerability types overlap with traditional software. Read the vulnerability taxonomy.
  • MCP Safety Audit: LLMs with the Model Context Protocol Allow Major Security ExploitsPaper · Brandon Radosevich, John Halloran · 2025An early demonstration that models can be coerced through ordinary MCP tools into code execution, remote access and credential theft, and an agentic scanner that audits a server. Read the attack walkthroughs.
  • Security Best PracticesDocs · Model Context Protocol · 2026The protocol threat model for the 2026-07-28 revision. Read Token Passthrough, Confused Deputy (its two sequence diagrams show the attack better than any summary), State Handle Hijacking and Local MCP Server Compromise.
  • Local Server SecurityDocs · Model Context Protocol · 2026Your own machine as the threat model: poisoned tool catalogs, rug pulls, isolation, credentials and egress. Read the five threats and the checklist.
  • Tool Annotations as Risk Vocabulary: What Hints Can and Can't DoArticle · Ola Hungerford, Sam Morrow, Luca Chang · Model Context Protocol · 2026The maintainers on why annotations are hints rather than enforcement, and the lethal trifecta. Read "What Annotations Can't Do" and "The Lethal Trifecta".
Free · sign in to start

Sign in to keep reading.

Free, no card. We use your account to save progress, quiz scores, bookmarks and occasionally send updates from our team.

  • 10 more sections
  • 3 hands-on exercises
  • A 8-question quiz
  • Progress, quiz scores and bookmarks