github doobidoo/mcp-memory-service v8.42.1
v8.42.1: MCP Resource Handler Bug Fix

latest releases: v10.47.2, v10.47.1, v10.47.0...
5 months ago

🐛 Bug Fix Release

This release fixes a critical bug in the MCP resource handler that affected users calling fetch_mcp_resource with URI parameters.

Fixed

MCP Resource Handler AttributeError (Issue #254)

  • Fixed AttributeError: 'AnyUrl' object has no attribute 'startswith' in handle_read_resource function
  • Added automatic URI string conversion at function start to handle both plain strings and Pydantic AnyUrl objects
  • MCP SDK may pass AnyUrl objects instead of strings, causing AttributeError when using .startswith() method
  • Fix converts AnyUrl to string using str() before processing, maintaining backward compatibility

Technical Details

The MCP SDK sometimes passes Pydantic AnyUrl objects instead of plain strings when deserializing tool call arguments. This caused failures when the code tried to use string methods like .startswith() or perform equality comparisons.

Fix Implementation:

# Convert AnyUrl to string if necessary (fix for issue #254)
# MCP SDK may pass Pydantic AnyUrl objects instead of plain strings
if hasattr(uri, '__str__'):
    uri = str(uri)

This ensures compatibility with both input types while maintaining backward compatibility with existing code.

Impact

  • ✅ Users can now use fetch_mcp_resource without errors
  • ✅ Works with both string and AnyUrl URI parameters
  • ✅ No breaking changes - fully backward compatible
  • ✅ Fixes reported issue #254

Installation

# Update to v8.42.1
pip install --upgrade mcp-memory-service

# Or with uv
uv pip install --upgrade mcp-memory-service

# Verify version
python -c "import mcp_memory_service; print(mcp_memory_service.__version__)"

Related Links


🙏 Thanks to @bivex for reporting this issue with detailed reproduction steps and proposed solution.

Don't miss a new mcp-memory-service release

NewReleases is sending notifications on new releases.