# Upgrade to Latest FastMCP Versions π
## Summary
This Odoo MCP Unified server now uses **the latest stable versions** of FastMCP and MCP libraries, not the outdated 0.1.0 version.
## What Changed
### Before (Old Approach - Deprecated)
```python
# Old way with deprecated parameters
mcp = FastMCP(
"Server Name",
description="...", # β No longer supported
dependencies=["..."], # β Moved to config
lifespan=app_lifespan, # β Different approach now
)
@mcp.tool
def my_tool(ctx: Context, param: str):
odoo = ctx.request_context.lifespan_context.odoo # β Complex
```
### After (New Approach - Latest API)
```python
# Modern FastMCP API
mcp = FastMCP(
name="Server Name", # β
Simple name parameter
instructions="""...""" # β
Instructions instead of description
)
# Helper function for dependency management
def _get_odoo() -> OdooClient:
return get_odoo_client()
@mcp.tool
def my_tool(param: str): # β
No ctx needed for simple cases
odoo = _get_odoo() # β
Clean dependency injection
```
## Version Changes
### requirements.txt
```diff
# Before
- mcp>=0.1.1,<2.0.0
- fastmcp==0.1.0
# After
+ mcp>=1.0.0 # Latest stable
+ fastmcp>=0.7.0 # Latest stable
```
### Key Improvements
1. **No More `description` Parameter**
- Old: `FastMCP("name", description="...")`
- New: `FastMCP(name="name", instructions="...")`
2. **No More `dependencies` Parameter**
- Dependencies now managed via `pyproject.toml` or `fastmcp.json`
3. **No More `lifespan` in Constructor**
- Lifespan management is now automatic
- Use dependency injection patterns instead
4. **Simplified Context Usage**
- No need for `ctx.request_context.lifespan_context`
- Direct dependency access via helper functions
## Benefits of Latest Versions
### FastMCP >=0.7.0
- β
Cleaner, more Pythonic API
- β
Better performance
- β
Improved error messages
- β
Enhanced SSE transport support
- β
Better dependency management
- β
More stable and battle-tested
### MCP >=1.0.0
- β
Stable v1 API
- β
Better protocol compliance
- β
Enhanced features
- β
Long-term support
## Migration Steps
If you have an old Odoo MCP project:
### 1. Update requirements.txt
```bash
# Replace old versions
mcp>=1.0.0
fastmcp>=0.7.0
```
### 2. Update FastMCP initialization
```python
# Old
mcp = FastMCP("Name", description="...", dependencies=[...], lifespan=...)
# New
mcp = FastMCP(name="Name", instructions="...")
```
### 3. Remove lifespan context access
```python
# Old
odoo = ctx.request_context.lifespan_context.odoo
# New
odoo = _get_odoo() # Use helper function
```
### 4. Simplify tool signatures
```python
# Old - Complex
@mcp.tool
def my_tool(ctx: Context, param: str):
odoo = ctx.request_context.lifespan_context.odoo
...
# New - Simple
@mcp.tool
def my_tool(param: str):
odoo = _get_odoo()
...
```
### 5. Test thoroughly
```bash
cd your-project
pip install -r requirements.txt --upgrade
python run_server.py
```
## Compatibility
- β
Python 3.10+
- β
Claude Desktop (stdio transport)
- β
Zeabur/Railway (SSE transport)
- β
All existing tools and resources
- β
All business logic unchanged
## Why Not Lock to Old Versions?
### Problems with Old Approach (fastmcp==0.1.0)
- β Using deprecated API
- β Missing newer features
- β Potential security issues
- β No future updates
- β Community moving forward
### Benefits of Latest Stable
- β
Active development
- β
Bug fixes and improvements
- β
Security updates
- β
Community support
- β
Better documentation
## Testing
After upgrading, test these scenarios:
### 1. Basic Connection
```bash
# Set environment variables
export ODOO_URL=https://your-company.odoo.com
export ODOO_DB=your-database
export ODOO_USERNAME=your-username
export ODOO_PASSWORD=your-password
# Run server
python run_server.py
```
### 2. Test execute_method
```python
# Should work without ctx
execute_method(
model="res.partner",
method="search_read",
args=[],
kwargs={"limit": 5}
)
```
### 3. Test all resources
```
odoo://models
odoo://model/res.partner
odoo://record/res.partner/1
odoo://search/res.partner/[[]]
```
## Rollback (If Needed)
If you encounter issues:
```bash
# Temporarily roll back
pip install "mcp>=0.1.1,<2.0.0" "fastmcp==0.1.0"
# Then report the issue!
```
But note: The old API will eventually be completely deprecated.
## Support
- π [FastMCP Documentation](https://gofastmcp.com)
- π [MCP Protocol](https://modelcontextprotocol.io)
- π¬ [GitHub Issues](https://github.com/jlowin/fastmcp/issues)
## Conclusion
This upgrade ensures your Odoo MCP server uses **modern, stable, and actively maintained** versions of FastMCP and MCP libraries. The changes are minimal but important for long-term maintainability and compatibility.
---
**Updated**: 2025-10-15
**Version**: 2.0.0 (Latest Stable)