File size: 808 Bytes
80dbc19
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
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()