Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 19 additions & 11 deletions mcp/mcp_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,17 +57,25 @@ async def create_thread() -> str:

def _make_request(thread_id: str, user_input: str, config: dict) -> str:
"""Make synchronous request to graph service"""
response = requests.post(
f"{GRAPH_SERVICE_URL}/invoke",
json={
"message": user_input,
"thread_id": thread_id,
"is_first_message": not active_threads[thread_id],
"config": config
}
)
response.raise_for_status()
return response.json()
try:
response = requests.post(
f"{GRAPH_SERVICE_URL}/invoke",
json={
"message": user_input,
"thread_id": thread_id,
"is_first_message": not active_threads[thread_id],
"config": config
},
timeout=300 # 5 minute timeout for long-running operations
)
response.raise_for_status()
return response.json()
except requests.exceptions.Timeout:
write_to_log(f"Request timed out for thread {thread_id}")
raise TimeoutError("Request to graph service timed out. The operation took longer than expected.")
except requests.exceptions.RequestException as e:
write_to_log(f"Request failed for thread {thread_id}: {str(e)}")
raise


@mcp.tool()
Expand Down