fix: SSL verification fix asynchttpclient

This commit is contained in:
ishaansehgal99
2025-07-14 10:57:52 -07:00
parent 978aee3acd
commit baf501e6a4
3 changed files with 14 additions and 3 deletions

View File

@@ -1,10 +1,12 @@
"""Async client for interacting with the Omnara Agent Dashboard API."""
import asyncio
import ssl
from typing import Optional, Dict, Any
from urllib.parse import urljoin
import aiohttp
import certifi
from aiohttp import ClientTimeout
from .exceptions import AuthenticationError, TimeoutError, APIError
@@ -54,8 +56,14 @@ class AsyncOmnaraClient:
async def _ensure_session(self):
"""Ensure aiohttp session exists."""
if self.session is None or self.session.closed:
# Create SSL context using certifi's certificate bundle
# This fixes SSL verification issues with aiohttp on some systems
ssl_context = ssl.create_default_context(cafile=certifi.where())
self.session = aiohttp.ClientSession(
headers=self.headers, timeout=self.timeout
headers=self.headers,
timeout=self.timeout,
connector=aiohttp.TCPConnector(ssl=ssl_context)
)
async def close(self):

View File

@@ -24,6 +24,7 @@ dependencies = [
"requests>=2.25.0",
"urllib3>=1.26.0",
"aiohttp>=3.8.0",
"certifi>=2020.6.20",
"fastmcp==2.9.2",
"fastapi>=0.100.0",
"uvicorn>=0.20.0",

View File

@@ -37,8 +37,10 @@ def get_client() -> AsyncOmnaraClient:
return client
# Create FastMCP server
mcp = FastMCP("Omnara Agent Dashboard MCP Server")
# Create FastMCP server and metadata
mcp = FastMCP(
"Omnara Agent Dashboard MCP Server",
)
@mcp.tool(name="log_step", description=LOG_STEP_DESCRIPTION)