You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/migration.md
+32Lines changed: 32 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -121,6 +121,38 @@ result = await session.list_resources(params=PaginatedRequestParams(cursor="next
121
121
result =await session.list_tools(params=PaginatedRequestParams(cursor="next_page_token"))
122
122
```
123
123
124
+
### `McpError` renamed to `MCPError`
125
+
126
+
The `McpError` exception class has been renamed to `MCPError` for consistent naming with the MCP acronym style used throughout the SDK.
127
+
128
+
**Before (v1):**
129
+
130
+
```python
131
+
from mcp.shared.exceptions import McpError
132
+
133
+
try:
134
+
result =await session.call_tool("my_tool")
135
+
except McpError as e:
136
+
print(f"Error: {e.error.message}")
137
+
```
138
+
139
+
**After (v2):**
140
+
141
+
```python
142
+
from mcp.shared.exceptions import MCPError
143
+
144
+
try:
145
+
result =await session.call_tool("my_tool")
146
+
except MCPError as e:
147
+
print(f"Error: {e.message}")
148
+
```
149
+
150
+
`MCPError` is also exported from the top-level `mcp` package:
151
+
152
+
```python
153
+
from mcp import MCPError
154
+
```
155
+
124
156
### `FastMCP` renamed to `MCPServer`
125
157
126
158
The `FastMCP` class has been renamed to `MCPServer` to better reflect its role as the main server class in the SDK. This is a simple rename with no functional changes to the class itself.
0 commit comments