IntermediateEnglish16 lectures · 42m

Claude Code in Production: MCP, Headless, Agent SDK

Connect tools with MCP, build your own server, run Claude Code headless in scripts and CI, and program it with the Agent SDK

Watch 3 lectures free

01

What changes after this course

  • ●Instead of pasting data from internal tools into the chat, you connect Claude Code to them through MCP
  • ●Instead of reviewing agent output by eye, you put an agent review into CI that fails on an exit code
  • ●Instead of driving an agent only from a terminal, you build one into your own product with the Agent SDK

02

Why it matters now

In an interactive session an agent helps one person. Connected to your tools, running in CI and called from your own code, it becomes part of your software, with its own permission problems: this course shows why a name-based deny list leaks.

03

What you leave with

  • ✓Every server, script and SDK program from the course, with pinned versions
  • ✓A release-notes agent built twice: as a headless script and as an SDK program
  • ✓A GitHub Actions workflow with an agent quality gate

04

Skills you'll build

  • →Add MCP servers with the right scope and permission rules
  • →Build your own MCP server in Python, over stdio and HTTP
  • →Run Claude Code headless with schema-constrained JSON, as a CI gate, and program it with the Agent SDK

Inside the course

Screens from the lectures: recorded Claude Code sessions in the course's demo todo-api repo, which a setup script puts in each lecture's state. Claude Code is Anthropic's tool; this course is independent and not made by Anthropic.

Claude Code lists the notes served over MCP and summarises a 3-step release checklist

Terminal: Claude Code with the notes MCP server (setup/S1_L02.sh, course2/notes/)

An MCP server answers, and the gaps show up

Through the notes MCP server, Claude Code reads the release checklist: 3 steps, all manual. It also points out that the CHANGELOG.md step refers to a file the repo does not have.

▶ Lecture 1.2 · Add your first MCP server
A denied cat command; Claude Code still shows the file's contents from the notes server

Terminal: Claude Code in todo-api (setup/S1_L04.sh)

Blocking cat did not keep the file private

The cat command is denied, and Claude Code answers with the file contents anyway, read a moment earlier through the MCP server. Blocking one tool did not block the same data through another.

Lecture 1.4 · Permissions for MCP tools, and why deny lists leak

Triage answer: do item 3 first, a race in duplicate_todo that can return a 500

Terminal: Claude Code in todo-api (setup/S2_L02.sh)

Triage that cites the line numbers

Asked which open item to do first, Claude Code picks #3, a MAX(id) + 1 race in duplicate_todo, cites app/main.py:89-96 and store.py:26, and explains why it surfaces as a 500.

Lecture 2.2 · Resources and prompts, the two capabilities people skip

review.sh run on a diff that changes status codes; verdict REQUEST CHANGES citing three failing tests

course2/review.sh

A one-line reviewer in a shell script

review.sh pipes git diff into claude -p and gets one line back. On a diff that flips POST from 201 to 200, the verdict is REQUEST CHANGES, naming three tests that assert 201, and it also flags an unrelated deletion of the settings file.

Lecture 3.1 · Headless mode - Claude Code as a command

gate.sh returns JSON with verdict request_changes and risk low, and the script exits with code 1

course2/gate.sh

A gate that fails the build with exit code 1

gate.sh asks for output that matches a JSON schema, then exits non-zero unless the verdict is approve. Here the reason cites 2 failed and 15 passed tests, and the exit code is 1.

Lecture 3.2 · Permissions and structured output for unattended runs

Agent SDK run where the main agent flags that the planner subagent never saw the two open todos

course2/sdk_tools.py

The agent questions its own subagent

sdk_tools.py runs an agent with a custom tool and a planner subagent. Before acting, the main agent flags two caveats: the planner never saw the two open todos, and the bug it reported was not checked.

Lecture 4.2 · Custom tools, MCP and subagents from code

What you'll learn

  • ✓Explain MCP tools, resources and prompts and add servers with the right scope
  • ✓Apply permission rules to MCP tools, and know why name-based deny lists leak
  • ✓Build an MCP server in Python with tools, resources and prompts, over stdio and HTTP
  • ✓Run Claude Code non-interactively with a fixed tool list and schema-constrained JSON output
  • ✓Turn an agent review into a CI gate that passes or fails on an exit code
  • ✓Program Claude Code from Python with the Agent SDK: custom tools, MCP and subagents

About this course

Interactive sessions are where you learn Claude Code. Production is where it connects to your tools, runs without a human at the keyboard, and becomes a component in your own software. This course covers those three moves.

Section 1 is MCP, the Model Context Protocol: what tools, resources and prompts are, how to add a server in one command, how scopes and the shared .mcp.json work, how project servers are approved, and how permission rules apply to MCP tools, including why a name-based deny list leaks. Section 2 builds your own MCP server in Python with the MCP SDK: tools whose contract comes from type hints and docstrings, resources and prompts (a server prompt appears as a slash command), and the same server moved onto HTTP so a team can share it. Section 3 is headless mode: claude -p, piping a diff in, restricting tools for unattended runs, schema-constrained JSON output, a quality gate that fails with an exit code, and a GitHub Actions workflow. Section 4 is the Agent SDK for Python: the query loop and options, in-process custom tools, MCP servers and subagents from code. The capstone builds a release-notes agent twice, first as a headless script around your own MCP server, then as an SDK program with a fact-checking subagent.

Every terminal lecture is a real recorded session, the Agent SDK lectures included. Resources contains every server and script from the course with pinned package versions.

**Prerequisite.** *Claude Code Hands-On* or equivalent daily use of Claude Code.

Curriculum7 sections · 16 lectures · 42m

Section 0. Welcome

Free preview

Section 1. MCP

Free preview

Section 2. Your Own MCP Server

  • 🔒Build your own MCP server with the Python SDK3:36
  • 🔒Resources and prompts, the two capabilities people skip2:30
  • 🔒HTTP transport - one server, many clients2:36

Section 3. Headless Mode

  • 🔒Headless mode - Claude Code as a command2:36
  • 🔒Permissions and structured output for unattended runs2:48
  • 🔒Putting the agent in continuous integration3:00

Section 4. The Agent SDK

  • 🔒The Agent SDK - Claude Code as a library2:24
  • 🔒Custom tools, MCP and subagents from code2:18

Section 5. Capstone

  • 🔒Capstone - a release-notes agent2:48
  • 🔒Capstone - the same agent as a program2:30

Section 6. Recap

  • 🔒Recap - what you built, and what to do next2:00

Requirements

  • · Claude Code installed and working (see Claude Code Hands-On)
  • · Python 3.10+, Node.js 18+ (for npx) and jq
  • · A Claude subscription for following along; an Anthropic API key for anything you deploy for other people

Who this is for

  • · Developers who use Claude Code daily and want it to reach their databases, trackers and internal tools
  • · Platform and DevOps engineers wiring an agent into scripts, CI and scheduled jobs
  • · Teams evaluating the Agent SDK for their own products

Read alongside the course

    The voice-over in this course is synthesized with a text-to-speech model from scripts written and reviewed by the instructor, and the on-screen material (notebooks, code, slides) is the instructor's own work.

    Claude Code in Production: MCP, Headless, Agent SDK | SOTAAZ Blog