Ch 9 — Building an MCP Server

From zero to a working server in Python and TypeScript
High Level
-
Click play or press Space to begin...
Step- / 8
AThe Official SDKsTwo first-class SDKs for building MCP servers
1
code
Python SDKFastMCP class
decorator pattern
or
javascript
TypeScript SDKMcpServer class
method pattern
both
2
auto_fix_high
Auto SchemaTypes → JSON Schema
automatically
3
arrow_downward Step 1: Create a server and add tools
BDefine ToolsWrite functions, get tools — the SDK does the rest
edit_note
Write FunctionNormal function
with type hints
decorate
auto_awesome
@mcp.tool()SDK registers it
as an MCP tool
generates
schema
inputSchemaJSON Schema from
your type hints
4
arrow_downward Step 2: Add resources and prompts
CAdd Resources & PromptsSame pattern: decorate a function, get a primitive
description
@mcp.resource()URI-addressed
read-only data
+
chat
@mcp.prompt()Reusable message
templates
all
5
hub
One ServerTools + resources +
prompts together
6
arrow_downward Step 3: Choose a transport and run
DTransport & RunChoose stdio or HTTP, then start the server
terminal
stdiomcp.run(transport="stdio")
for local use
or
cloud
HTTPmcp.run(transport="sse")
for remote use
7
arrow_downward Step 4: Configure the host to use your server
EHost ConfigurationTell the host how to find and run your server
settings
mcp.jsonConfig file with
server definitions
defines
terminal
CommandHow to start
the server process
+
tune
Args & EnvArguments and
environment vars
8
arrow_downward Testing and debugging your server
FTesting & DebuggingTools for developing and testing MCP servers
bug_report
MCP InspectorInteractive testing
UI for servers
+
terminal
CLI Testingmcp dev for
quick iteration
+
science
Unit TestsTest tools in
isolation
1
Detail