gpaasch commited on
Commit
80dbc19
·
1 Parent(s): d74007c

created a test script to verify the MCP endpoint

Browse files
Files changed (1) hide show
  1. tests/test_mcp.py +27 -0
tests/test_mcp.py ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import requests
2
+ import json
3
+
4
+ def test_mcp_endpoint():
5
+ # Test MCP info endpoint
6
+ response = requests.get("http://localhost:7860/mcp/info")
7
+ assert response.status_code == 200
8
+ info = response.json()
9
+ print("MCP Info:", json.dumps(info, indent=2))
10
+
11
+ # Test streaming speech endpoint
12
+ test_message = "I have a persistent cough and fever"
13
+ response = requests.post(
14
+ "http://localhost:7860/mcp/v1/chat/completions",
15
+ json={
16
+ "messages": [{"role": "user", "content": test_message}],
17
+ "stream": True
18
+ }
19
+ )
20
+ assert response.status_code == 200
21
+ print("\nStreaming Response:")
22
+ for line in response.iter_lines():
23
+ if line:
24
+ print(json.loads(line.decode('utf-8')))
25
+
26
+ if __name__ == "__main__":
27
+ test_mcp_endpoint()