fix(mcp-server): address Copilot PR review comments
- SSL verification now defaults to enabled; set WEKNORA_VERIFY_SSL=false to opt out (with a logged warning). Fixes MITM risk from default-off TLS. - WEKNORA_CHAT_TIMEOUT parse is now guarded with try/except ValueError so a bad env value falls back to 300s instead of crashing at import. - SSE streaming response is now closed via context manager (with response:) to guarantee connection pool return even on early break. - Replace asyncio.get_event_loop() (deprecated) with asyncio.get_running_loop() in both chat and agent_chat handlers. - create_session now calls resolve_kb_id() so KB names are accepted in addition to UUIDs (consistent with chat / hybrid_search). - knowledge_base_ids description changed from REQUIRED to Strongly recommended to match actual schema optionality. - run_sse() handle_sse rewritten as raw ASGI callable (scope, receive, send) to avoid accessing Starlette private _send attribute. - Fix main.py comment: http transport is Streamable HTTP (MCP spec), not long-polling.
This commit is contained in:
+1
-1
@@ -138,7 +138,7 @@ async def main():
|
||||
# Select transport mode based on CLI argument or MCP_TRANSPORT env var
|
||||
# - stdio: Default, used by VS Code Copilot for local integration
|
||||
# - sse: Server-Sent Events over HTTP, suitable for cloud/remote deployments
|
||||
# - http: HTTP long-polling, compatible with various client architectures
|
||||
# - http: Streamable HTTP sessions (MCP 2025-03-26 spec), compatible with REST clients
|
||||
if args.transport == "stdio":
|
||||
# Stdio mode: communication via stdin/stdout pipes (typical for CLI integrations)
|
||||
await run_stdio()
|
||||
|
||||
Reference in New Issue
Block a user