Skip to content

Conversation

@Git-Hub-Chris
Copy link
Owner

Pull Request: Branch merger. Keeping code up-to-date.

Josina20 and others added 2 commits January 28, 2026 15:30
* Fix MCPStreamableHTTPTool auth headers not being passed correctly

* code review

* code review

* Add unit tests for httpx client configuration in MCP tool registration

Tests verify that:
- Authorization header is set on httpx.AsyncClient
- User-Agent header is set on httpx.AsyncClient
- MCP_HTTP_CLIENT_TIMEOUT_SECONDS constant (90s) is used
- MCPStreamableHTTPTool receives http_client param (not headers)
- httpx clients are tracked in _http_clients for cleanup
- cleanup() properly closes all httpx clients

These tests prevent regression to the bug where passing headers
directly to MCPStreamableHTTPTool was silently ignored.

* Add end-to-end httpx client lifecycle tests

New TestHttpxClientLifecycle class with 4 tests:
- test_full_client_lifecycle_single_server: verifies client created by
  add_tool_servers_to_agent() is properly closed by cleanup()
- test_full_client_lifecycle_multiple_servers: verifies all clients are
  tracked and cleaned up when multiple MCP servers are configured
- test_cleanup_idempotent_no_clients: verifies cleanup() is safe when
  no clients exist
- test_cleanup_called_twice_after_creating_clients: verifies calling
  cleanup() multiple times doesn't cause issues

These tests ensure connection/file-descriptor leaks are prevented by
verifying the full client lifecycle from creation to cleanup.

* Add httpx as runtime dependency for agentframework tooling extension

httpx is now used directly in mcp_tool_registration_service.py to create
AsyncClient instances with pre-configured headers. Without this explicit
dependency, consumers could hit ModuleNotFoundError if httpx isn't
available through transitive dependencies.

* Fix linting issues in MCP tool registration tests

- Remove unused httpx import
- Remove unused mock_mcp_tool variable assignments
- Sort imports properly
- Remove trailing whitespace from blank lines

* Apply ruff formatting to test file

---------

Co-authored-by: Josina Joy <josjoy@microsoft.com>
* add sk attribute enrichment

* organize code and fix test

* add tests

* address copilot review

* address the PR comment

---------

Co-authored-by: Nikhil Chitlur Navakiran (from Dev Box) <nikhilc@microsoft.com>
@Git-Hub-Chris Git-Hub-Chris self-assigned this Jan 29, 2026
@Git-Hub-Chris Git-Hub-Chris added the enhancement New feature or request label Jan 29, 2026
@Git-Hub-Chris Git-Hub-Chris merged commit 13f8ac1 into Git-Hub-Chris:main Jan 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants