import requests import json def test_mcp_endpoint(): # Test MCP info endpoint response = requests.get("http://localhost:7860/mcp/info") assert response.status_code == 200 info = response.json() print("MCP Info:", json.dumps(info, indent=2)) # Test streaming speech endpoint test_message = "I have a persistent cough and fever" response = requests.post( "http://localhost:7860/mcp/v1/chat/completions", json={ "messages": [{"role": "user", "content": test_message}], "stream": True } ) assert response.status_code == 200 print("\nStreaming Response:") for line in response.iter_lines(): if line: print(json.loads(line.decode('utf-8'))) if __name__ == "__main__": test_mcp_endpoint()