AI Hints
Home›MCP Tutorial›Performance and Versioning
MCP · Lesson 89 of 120

Versioning Your Server

Changing tools safely.

⏱ 2 min read▶ Video at 1:19:08🎓 Free
Watch this lesson in the MCP courseWatch on YouTube ↗Full MCP course

Once people use your server, changing it can break them. Hosts, prompts, and agents all depend on your tool names and arguments. So change things carefully.

Versioning Your Server
From the video: Versioning Your Server
  • People depend on it
  • Changes can break
  • Change carefully

A safe change

We give the server a version number, which clients can see. The new region argument is optional, with a default, so old calls still work. Run it. An old call and a new call both succeed.

versioning.pypython
from mcp.server.mcpserver import MCPServer
from tester import call

mcp = MCPServer("northwind", version="1.1.0")

@mcp.tool()
def delivery_cost(order_total: float, region: str = "UK") -> str:
    """Delivery cost for an order total in pounds. Region is UK or EU."""
    if region == "EU":
        return "£12.99"
    return "free" if order_total >= 50 else "£4.99"

print("old call:", call(mcp, "delivery_cost", {"order_total": 30}).content[0].text)
print("new call:", call(mcp, "delivery_cost", {"order_total": 30, "region": "EU"}).content[0].text)
Output
old call: £4.99
new call: £12.99
Also uses tester.py
import asyncio
from mcp import Client

def call(server, tool, args=None, **options):
    async def go():
        async with Client(server, **options) as client:
            return await client.call_tool(tool, args or {})
    return asyncio.run(go())

def tools(server):
    async def go():
        async with Client(server) as client:
            return (await client.list_tools()).tools
    return asyncio.run(go())

Safe and breaking changes

Adding a tool, or an optional argument, is safe. Renaming a tool, removing one, or adding a required argument breaks users. For breaking changes, add a new tool, and retire the old one later.

ChangeSafe?
Add a toolsafe
Add an optional argumentsafe
Rename or remove a toolbreaks users
Add a required argumentbreaks users

Summary

Add, don't break. Use optional arguments, and new tools for big changes. Next, the advanced quiz.

Key takeaways
  • version=
  • Optional args
  • Add, don't rename
Next up: Advanced Quiz — test yourself