Introduction

Heads up... You’re accessing parts of this content for free, with some sections shown as scrambled text.

Heads up... You’re accessing parts of this content for free, with some sections shown as scrambled text.

Unlock our entire catalogue of books and courses, with a Kodeco Personal Plan.

Unlock now

You have built servers that provide tools, resources, and prompts. You have connected them to clients and even integrated them with LLMs via API. But so far, your servers have been relatively passive—they wait for a command, execute it, and return a result.

Real-world applications require more sophistication.

What if a tool needs to ask the user for permission before deleting a database? What if you need to restrict an AI agent to a specific folder on your hard drive? What if your server needs to summarize a log file but doesn’t have its own API key?

In this lesson, you will unlock the Advanced Features of MCP that solve these specific architectural challenges:

  1. Elicitation: You will implement “Human-in-the-loop” workflows, allowing your server to pause execution and ask the user for clarification or confirmation before proceeding with dangerous actions.
  2. Roots: You will enforce security boundaries, ensuring that your AI agents operate strictly within a “sandbox” directory and cannot access sensitive files outside of it.
  3. Sampling: You will implement a “Brain and Brawn” architecture, where your lightweight server “borrows” the client’s LLM connection to perform intelligent tasks without needing its own API credentials.

By the end of this lesson, you will be able to:

  • Design interactive tools that request user input during execution using Elicitation.
  • Secure your servers by validating filesystem paths against client-provided Roots.
  • Optimize costs and architecture by using Sampling to offload AI processing to the client.

Let’s start by adding a safety layer to your tools with Elicitation.

See forum comments
Download course materials from Github
Previous: Conclusion Next: Understanding Elicitation