Skip to content

Commit 46a6de9

Browse files
committed
chore: minor code review fixes
1 parent 931b523 commit 46a6de9

5 files changed

Lines changed: 8 additions & 8 deletions

File tree

packages/mcp/src/keycardai/mcp/client/auth/coordinators/endpoint_managers.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ async def shutdown(self) -> None:
181181
def _find_free_port(self) -> int:
182182
"""Find an available port on localhost."""
183183
with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s:
184-
s.bind(('', 0))
184+
s.bind((self._host, 0))
185185
s.listen(1)
186186
return s.getsockname()[1]
187187

@@ -255,7 +255,7 @@ async def _handle_completion_request(self, request: web.Request) -> web.Response
255255
self._pending_flows.pop(state, None)
256256

257257
return web.Response(
258-
text=f"❌ Error: {str(e)}",
258+
text=f"❌ Authentication callback failed. Please try again.",
259259
status=400
260260
)
261261

packages/mcp/src/keycardai/mcp/client/auth/oauth/discovery.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ async def discover_auth_server(
135135

136136
if "registration_endpoint" not in data:
137137
# Don't expose full metadata - may contain internal configuration
138-
raise ValueError(f"No registration endpoint in authorization server metadata")
138+
raise ValueError("No registration endpoint in authorization server metadata")
139139

140140
await self.storage.save_auth_server_metadata(data)
141141
logger.info(f"Discovered and cached authorization server: {auth_server_url}")

packages/mcp/src/keycardai/mcp/client/integrations/__init__.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,15 @@
1919

2020
# Try to import LangChain integration
2121
try:
22-
from . import langchain_agents
22+
from . import langchain_agents # noqa: F401
2323
__all__.extend(["langchain_agents"])
2424
except ImportError:
2525
pass
2626

2727
# Try to import OpenAI Agents integration
2828
try:
29-
from . import openai_agents
30-
from .openai_agents import OpenAIMCPServer
29+
from . import openai_agents # noqa: F401
30+
from .openai_agents import OpenAIMCPServer # noqa: F401
3131
__all__.extend(["openai_agents", "OpenAIMCPServer"])
3232
except ImportError:
3333
pass

packages/mcp/src/keycardai/mcp/client/integrations/langchain_agents.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ async def __aenter__(self) -> "LangChainClient":
8787
try:
8888
tool_infos = await self._mcp_client.list_tools()
8989
# Group tools by server to determine which servers are authenticated
90-
servers_with_tools = set(info.server for info in tool_infos)
90+
servers_with_tools = {info.server for info in tool_infos}
9191
self._authenticated_servers = list(servers_with_tools)
9292
except (AttributeError, Exception) as e:
9393
# Session not fully connected (likely pending auth)

packages/mcp/src/keycardai/mcp/client/integrations/openai_agents.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -298,7 +298,7 @@ async def __aenter__(self) -> "OpenAIAgentsClient":
298298
try:
299299
tool_infos = await self._mcp_client.list_tools()
300300
# Group tools by server to determine which servers are authenticated
301-
servers_with_tools = set(info.server for info in tool_infos)
301+
servers_with_tools = {info.server for info in tool_infos}
302302
self._authenticated_servers = list(servers_with_tools)
303303
except (AttributeError, Exception) as e:
304304
# Session not fully connected (likely pending auth)

0 commit comments

Comments
 (0)