1616<!-- omit in toc -->
1717## Table of Contents
1818
19- - [ Overview] ( #overview )
20- - [ Installation] ( #installation )
21- - [ Quickstart] ( #quickstart )
22- - [ What is MCP?] ( #what-is-mcp )
23- - [ Core Concepts] ( #core-concepts )
24- - [ Server] ( #server )
25- - [ Resources] ( #resources )
26- - [ Tools] ( #tools )
27- - [ Prompts] ( #prompts )
28- - [ Images] ( #images )
29- - [ Context] ( #context )
30- - [ Running Your Server] ( #running-your-server )
31- - [ Development Mode] ( #development-mode )
32- - [ Claude Desktop Integration] ( #claude-desktop-integration )
33- - [ Direct Execution] ( #direct-execution )
34- - [ Mounting to an Existing ASGI Server] ( #mounting-to-an-existing-asgi-server )
35- - [ Examples] ( #examples )
36- - [ Echo Server] ( #echo-server )
37- - [ SQLite Explorer] ( #sqlite-explorer )
38- - [ Advanced Usage] ( #advanced-usage )
39- - [ Low-Level Server] ( #low-level-server )
40- - [ Writing MCP Clients] ( #writing-mcp-clients )
41- - [ MCP Primitives] ( #mcp-primitives )
42- - [ Server Capabilities] ( #server-capabilities )
43- - [ Documentation] ( #documentation )
44- - [ Contributing] ( #contributing )
45- - [ License] ( #license )
19+ - [ MCP Python SDK] ( #mcp-python-sdk )
20+ - [ Overview] ( #overview )
21+ - [ Installation] ( #installation )
22+ - [ Adding MCP to your python project] ( #adding-mcp-to-your-python-project )
23+ - [ Running the standalone MCP development tools] ( #running-the-standalone-mcp-development-tools )
24+ - [ Quickstart] ( #quickstart )
25+ - [ What is MCP?] ( #what-is-mcp )
26+ - [ Core Concepts] ( #core-concepts )
27+ - [ Server] ( #server )
28+ - [ Resources] ( #resources )
29+ - [ Tools] ( #tools )
30+ - [ Prompts] ( #prompts )
31+ - [ Images] ( #images )
32+ - [ Context] ( #context )
33+ - [ Running Your Server] ( #running-your-server )
34+ - [ Development Mode] ( #development-mode )
35+ - [ Claude Desktop Integration] ( #claude-desktop-integration )
36+ - [ Direct Execution] ( #direct-execution )
37+ - [ Mounting to an Existing ASGI Server] ( #mounting-to-an-existing-asgi-server )
38+ - [ Examples] ( #examples )
39+ - [ Echo Server] ( #echo-server )
40+ - [ SQLite Explorer] ( #sqlite-explorer )
41+ - [ Advanced Usage] ( #advanced-usage )
42+ - [ Low-Level Server] ( #low-level-server )
43+ - [ Writing MCP Clients] ( #writing-mcp-clients )
44+ - [ MCP Primitives] ( #mcp-primitives )
45+ - [ Server Capabilities] ( #server-capabilities )
46+ - [ Documentation] ( #documentation )
47+ - [ Contributing] ( #contributing )
48+ - [ License] ( #license )
4649
4750[ pypi-badge ] : https://img.shields.io/pypi/v/mcp.svg
4851[ pypi-url ] : https://pypi.org/project/mcp/
@@ -143,8 +146,8 @@ The FastMCP server is your core interface to the MCP protocol. It handles connec
143146``` python
144147# Add lifespan support for startup/shutdown with strong typing
145148from contextlib import asynccontextmanager
149+ from collections.abc import AsyncIterator
146150from dataclasses import dataclass
147- from typing import AsyncIterator
148151
149152from fake_database import Database # Replace with your actual DB type
150153
@@ -238,7 +241,8 @@ async def fetch_weather(city: str) -> str:
238241Prompts are reusable templates that help LLMs interact with your server effectively:
239242
240243``` python
241- from mcp.server.fastmcp import FastMCP, types
244+ from mcp.server.fastmcp import FastMCP
245+ from mcp.server.fastmcp.prompts import base
242246
243247mcp = FastMCP(" My App" )
244248
@@ -249,11 +253,11 @@ def review_code(code: str) -> str:
249253
250254
251255@mcp.prompt ()
252- def debug_error (error : str ) -> list[types .Message]:
256+ def debug_error (error : str ) -> list[base .Message]:
253257 return [
254- types .UserMessage(" I'm seeing this error:" ),
255- types .UserMessage(error),
256- types .AssistantMessage(" I'll help debug that. What have you tried so far?" ),
258+ base .UserMessage(" I'm seeing this error:" ),
259+ base .UserMessage(error),
260+ base .AssistantMessage(" I'll help debug that. What have you tried so far?" ),
257261 ]
258262```
259263
@@ -441,7 +445,7 @@ For more control, you can use the low-level server implementation directly. This
441445
442446``` python
443447from contextlib import asynccontextmanager
444- from typing import AsyncIterator
448+ from collections.abc import AsyncIterator
445449
446450from fake_database import Database # Replace with your actual DB type
447451
0 commit comments