fix: enforce mime_type='text/html' inside FastMCP resource decorators and release 0.2.8
This commit is contained in:
@@ -68,7 +68,7 @@ async def generate():
|
||||
|
||||
return decorator
|
||||
|
||||
def resource(self, path):
|
||||
def resource(self, path, **kwargs):
|
||||
def decorator(func):
|
||||
self.resources[path] = func
|
||||
return func
|
||||
@@ -164,7 +164,7 @@ async def generate():
|
||||
|
||||
return decorator
|
||||
|
||||
def resource(self, path):
|
||||
def resource(self, path, **kwargs):
|
||||
def decorator(func):
|
||||
self.resources[path] = func
|
||||
return func
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
"""Strava MCP Server"""
|
||||
|
||||
__version__ = "0.2.7"
|
||||
__version__ = "0.2.8"
|
||||
|
||||
@@ -901,7 +901,7 @@ def register(mcp: FastMCP, strava: StravaClient) -> None:
|
||||
isError=True,
|
||||
)
|
||||
|
||||
@mcp.resource("strava://activity/{activity_id}/map")
|
||||
@mcp.resource("strava://activity/{activity_id}/map", mime_type="text/html")
|
||||
async def get_activity_map_resource(activity_id: int) -> ReadResourceResult:
|
||||
"""HTML map resource for a specific Strava activity."""
|
||||
html_content = await _render_activity_map_html(activity_id)
|
||||
@@ -915,7 +915,7 @@ def register(mcp: FastMCP, strava: StravaClient) -> None:
|
||||
]
|
||||
)
|
||||
|
||||
@mcp.resource("strava://activity/last/map")
|
||||
@mcp.resource("strava://activity/last/map", mime_type="text/html")
|
||||
async def get_last_activity_map_resource() -> ReadResourceResult:
|
||||
"""HTML map resource for the most recent Strava activity."""
|
||||
try:
|
||||
|
||||
@@ -15,7 +15,7 @@ class MockMCP:
|
||||
|
||||
return decorator
|
||||
|
||||
def resource(self, path):
|
||||
def resource(self, path, **kwargs):
|
||||
if not hasattr(self, "resources"):
|
||||
self.resources = {}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user