Add project-bound OAuth MCP queries and controlled analysis with scoped evidence, limits, timeouts and a nearby-model spatial query using EPSG:4326 inputs. Default nearby searches to 200 meters and five results. Integrate investigation messaging/presentation, health/readiness and typed history; remove duplicate web search and fix online simulation and compressed baseline writes. Include project migrations 023-025; keep local credentials and demo seeding excluded. Validation: 319 focused pytest checks; real PostGIS temporary-table regression; read-only Jinqian bridge radius comparison; cross-language MCP discovery/calls.
16 lines
542 B
Python
16 lines
542 B
Python
"""Delegate MCP transport/metadata with the original request path intact."""
|
|
|
|
|
|
class McpDispatchMiddleware:
|
|
def __init__(self, app, runtime):
|
|
self.app, self.runtime = app, runtime
|
|
|
|
async def __call__(self, scope, receive, send):
|
|
path = scope.get("path", "")
|
|
if scope["type"] == "http" and (
|
|
path == "/mcp" or path.startswith("/.well-known/oauth-protected-resource")
|
|
):
|
|
await self.runtime.asgi(scope, receive, send)
|
|
else:
|
|
await self.app(scope, receive, send)
|