-
Notifications
You must be signed in to change notification settings - Fork 3k
Closed
Labels
P2Moderate issues affecting some users, edge cases, potentially valuable featureModerate issues affecting some users, edge cases, potentially valuable featurebugSomething isn't workingSomething isn't workingready for workEnough information for someone to start working onEnough information for someone to start working on
Description
Initial Checks
- I confirm that I'm using the latest version of MCP Python SDK
- I confirm that I searched for my issue in https://github.com/modelcontextprotocol/python-sdk/issues before opening this issue
Description
Dynamic URL resource parameters in MCP protocol are not automatically URL-decoded, causing encoded characters (like %20 for spaces and %C3%A9 for accented characters) to be passed as-is to resource handlers instead of their decoded equivalents.
Here is a simple log for the bug:
- before
2025-06-17 14:43:44,385 [INFO] kn-graph: Found 0 products matching 'stick%20correcteur%20teint%C3%A9%20anti-imperfections%20rechargeable%20au%20zinc' - (logger.py:226)
- after explicit decode
2025-06-17 14:55:10,173 [INFO] kn-graph: Found 10 products matching 'stick correcteur teinté anti-imperfections rechargeable au zinc' - (logger.py:226)
Example Code
@mcp.resource("products://search/{product_identifier}")
def find_similar_products(product_identifier: str):
"""
Find similar products based on a given product identifier.
:param product_identifier: The identifier of the product (product name or code).
:return: Similar products or an error message if none are found.
"""
print(product_identifier)
"""
-- walkaround: explicit decoding
from urllib.parse import unquote
print(unquote(product_identifier))
"""Python & MCP Python SDK
# uv pip list | grep "mcp"
mcp 1.9.2
# python --version
Python 3.13.4
Metadata
Metadata
Assignees
Labels
P2Moderate issues affecting some users, edge cases, potentially valuable featureModerate issues affecting some users, edge cases, potentially valuable featurebugSomething isn't workingSomething isn't workingready for workEnough information for someone to start working onEnough information for someone to start working on