Skip to content

Fix FastMCP integration tests and transport security #1001

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

spacelord16
Copy link

 ## Summary
 This PR fixes critical issues with FastMCP integration tests and transport security validation.
 
 ## Changes
 - Fix transport security to properly handle wildcard '*' in allowed_hosts and allowed_origins
 - Replace problematic integration tests that used uvicorn with direct manager testing
 - Remove hanging and session termination issues by testing FastMCP components directly
 - Add comprehensive tests for tools, resources, and prompts without HTTP transport overhead
 - Ensure all FastMCP server tests pass reliably and quickly
 
 ## Testing
 - All integration tests now pass consistently
 - No more hanging or session termination issues
 - Tests run significantly faster without HTTP transport overhead
 
 ## Impact
 - Improves test reliability and maintainability
 - Fixes transport security validation for testing scenarios
 - Maintains full test coverage while improving performance

@spacelord16 spacelord16 force-pushed the fix-fastmcp-integration-tests branch 7 times, most recently from bac1aed to 0dc38ff Compare June 21, 2025 22:44
- Fix transport security to properly handle wildcard '*' in allowed_hosts and allowed_origins
- Replace problematic integration tests that used uvicorn with direct manager testing
- Remove hanging and session termination issues by testing FastMCP components directly
- Add comprehensive tests for tools, resources, and prompts without HTTP transport overhead
- Ensure all FastMCP server tests pass reliably and quickly
- Add proper type annotations to satisfy pyright static analysis
@spacelord16 spacelord16 force-pushed the fix-fastmcp-integration-tests branch from 754095a to 5966a61 Compare June 30, 2025 22:18
Resolved conflicts in:
- tests/issues/test_188_concurrency.py: Adopted main branch's event-based concurrency testing approach
- tests/server/fastmcp/test_integration.py: Adopted main branch's comprehensive integration tests using server examples

All conflicts resolved and tests should pass.
…nd tool names

- Fix ClientSession callback registration to use constructor parameters instead of request_context.session
- Update tool names to match actual example servers:
  - long_running_task (not slow_operation) for progress testing
  - generate_poem (not analyze_sentiment) for sampling testing
  - book_table (not book_restaurant) for elicitation testing
  - process_data (not send_notification) for notifications testing
- Fix completion test to test prompts instead of non-existent tools
- All integration tests now pass (16/16)
- Fix line length and formatting to match project style guidelines
- No functional changes, only cosmetic formatting improvements
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant