Merged
Conversation
Fixes #10 - Add support for direct installation from GitHub using uvx. Key changes: - Relaxed Python version requirement to >=3.10 for broader compatibility - Updated README with uvx installation instructions and MCP configuration - Added Make targets `test-uvx` and `test-uvx-mcp` for testing uvx functionality - Updated MCP configuration examples in Makefile comments to use uvx from GitHub - Verified uvx installation works: `uvx --from git+https://github.com/ber-data/bertron-mcp.git bertron-mcp` Users can now install and run bertron-mcp directly from GitHub without cloning the repository or waiting for PyPI publication. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
- Update Python requirement to >=3.12.9 to match bertron-client dependency - Add missing build-system section with hatchling configuration - Add hatch.metadata.allow-direct-references for git dependencies - Fixes 'make all' pipeline and enables proper packaging
Updates package lock file with correct dependency resolution after fixing Python version requirement.
Successfully merged main branch improvements while preserving uvx functionality: - Combined comprehensive README from main with uvx installation options - Maintained working Python version requirement (>=3.12.19,<3.14) from main - Added uvx test targets alongside existing test infrastructure - Preserved both uv run (local dev) and uvx (GitHub) usage patterns - Removed autogenerated _version.py file (now properly gitignored) Both installation methods now available: - uvx --from git+https://github.com/ber-data/bertron-mcp.git bertron-mcp (GitHub) - uv run python src/bertron_mcp/main.py (local development)
Removed corrupted lock file with merge conflicts and regenerated from scratch. All tests passing, dependencies resolved correctly.
## Major Improvements ### 🎯 Enhanced MCP Tool Descriptions & Annotations - Upgraded all 8 MCP tools with FastMCP's structured annotation system - Added professional, user-friendly descriptions replacing raw technical docstrings - Implemented varied complexity levels (beginner vs advanced) for better UX - Added rich metadata: titles, tags, use_cases, examples, and complexity warnings - Enhanced tools: geosearch, health_check, bbox_search, entity_lookup, advanced_query, search_by_source, search_by_type, search_by_name ### 🛡️ Robust Constraint System & Safety Features - Added module-level constants: DEFAULT_LIMIT=100, MAX_LIMIT=1000, MAX_SKIP=50000 - Implemented server-side constraint enforcement across all search functions - Added automatic constraint reporting in response metadata when limits are applied - Enhanced advanced_query with safety filters to prevent accidental full database dumps - Documented all limits and constraints comprehensively in README ### 🧪 Comprehensive Test Coverage (85% code coverage, 69 tests passing) - **test_api.py**: 45+ integration tests covering all MCP tools, edge cases, constraint enforcement - **test_constants_and_version.py**: Module validation, imports, version handling, constant relationships - **test_mcp_protocol.py**: FastMCP integration, tool registration, direct function testing - **test_error_handling.py**: Edge cases, invalid inputs, graceful error recovery - **test_integration.py**: Real-world workflows, pagination, data quality validation - All tests use real API integration (no mocking) with network-resilient error handling ### 🔧 Enhanced Build & Testing Infrastructure - **Makefile improvements**: Added comprehensive JSON-RPC protocol testing targets - `test-mcp-tools`: Multiple tool execution via JSON-RPC - `test-mcp-constraints`: Constraint enforcement testing - `test-mcp-errors`: Error handling validation - `test-mcp-comprehensive`: Complete MCP protocol test suite - **GitHub Actions**: Production-ready CI/CD following compare-mcps patterns - Comprehensive testing across Python 3.12 & 3.13 - Real API integration testing with good network connectivity assumption - Artifact uploads, coverage reporting, multi-matrix builds - Disabled publish workflow for future use ### 📚 Documentation & User Experience - Updated README with comprehensive API Limits and Constraints section - Added detailed constraint reporting examples and usage patterns - Enhanced tool descriptions focus on user benefits rather than technical implementation - Improved error messaging and user guidance throughout ## Technical Implementation Details ### FastMCP Integration - Leveraged FastMCP's annotation system for rich tool metadata - Implemented proper tool registration with titles, descriptions, tags, and examples - Added complexity categorization and use case documentation ### Constraint Architecture - Server-side limit enforcement with transparent reporting - Automatic constraint metadata injection in API responses - Mathematical relationships between constants for optimal UX - Safety filters preventing dangerous operations ### Testing Strategy - Real-world integration testing without mocking/patching - Network-resilient test design with graceful API unavailability handling - Comprehensive edge case coverage including coordinate validation, regex patterns - Multi-layer testing: unit tests, JSON-RPC protocol, end-to-end workflows ## Quality Assurance - ✅ 85% code coverage with meaningful tests - ✅ All linting and type checking passing - ✅ Real API integration testing - ✅ JSON-RPC protocol compliance - ✅ Constraint enforcement validation - ✅ Error boundary testing - ✅ Production-ready CI/CD pipeline This enhancement transforms bertron-mcp from a basic MCP server into a professional, user-friendly, and robust genomic data access tool with comprehensive safety features and excellent developer experience. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This was
linked to
issues
Sep 17, 2025
There was a problem hiding this comment.
Pull Request Overview
This pull request expands the bertron-mcp MCP server by adding comprehensive test coverage and implementing additional API tools for biological/environmental data search. The PR adds 5 new MCP tools (bbox_search, entity_lookup, advanced_query, search_by_source, search_by_type, search_by_name) alongside extensive test suites covering unit tests, integration tests, and error handling scenarios.
Key changes:
- Added 6 new MCP tools with enhanced descriptions and metadata
- Implemented API response limits (100 default, 1000 max) with constraint reporting
- Added comprehensive test coverage including integration and error handling tests
- Updated CI/CD configuration with GitHub Actions workflows
Reviewed Changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| src/bertron_mcp/main.py | Added 6 new MCP tools with limit enforcement and enhanced tool registration metadata |
| tests/test_mcp_protocol.py | Completely rewritten with comprehensive MCP protocol and function testing |
| tests/test_integration.py | New integration test suite with real API workflow testing |
| tests/test_error_handling.py | New error handling test suite for edge cases and invalid inputs |
| tests/test_constants_and_version.py | New test suite for constants, version handling, and module functionality |
| tests/test_api.py | Expanded API test coverage with new tools and constraint enforcement tests |
| README.md | Updated documentation with new tools, API limits, and setup instructions |
| Makefile | Added new test targets and CI pipeline configurations |
| .github/workflows/ci.yml | New CI workflow for automated testing |
| .github/workflows/publish.yml.disabled | New PyPI publishing workflow (disabled) |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
- Removed Git merge conflict markers (<<<<<<< HEAD, =======, >>>>>>> main) - Kept the enhanced README content with comprehensive documentation - Maintained all API limits, constraints, and usage examples - Preserved MCP integration instructions and testing documentation 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
- Added back the Quick Start section that was accidentally removed during merge conflict resolution - Preserves important uvx installation instructions for direct GitHub usage - Maintains user-friendly installation documentation - Quick Start provides immediate value for users wanting to try bertron-mcp 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
- Removed defensive try/except patterns that were masking real issues - Made tests more assertive about expected return types and behaviors - Kept try/except only where legitimately needed (regex errors) - Differentiated between functions that should always work vs those that may return None - Improved test clarity by removing generic exception handling - Functions now expected to return proper types or fail clearly Key changes: - health_check() must return dict (not None) - search functions must return QueryResponse (not None) - entity_lookup() may return None for invalid IDs (documented behavior) - Invalid search parameters should return empty QueryResponse, not None - Constraint reporting tests now assertively verify metadata presence This makes tests more reliable for catching real bugs while maintaining appropriate handling of legitimate edge cases. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
Addresses API 400 errors discovered when removing defensive try/except blocks in tests. This change implements robust regex validation and eliminates None returns to provide consistent, predictable function behavior. ## Key Changes ### Enhanced search_by_name() Function (src/bertron_mcp/main.py) - **Regex Validation**: Added upfront regex pattern validation using re.compile() to catch invalid patterns before API calls, preventing 400 Bad Request errors - **Eliminated None Returns**: Changed return type from `QueryResponse | None` to `QueryResponse` - function now always returns a valid response object - **Improved Error Handling**: Invalid regex patterns return empty QueryResponse with descriptive constraint metadata instead of hitting API - **Unified Constraint Reporting**: Standardized constraint metadata structure to match other search functions with proper nested format - **API Error Recovery**: Network/API errors now return empty QueryResponse with error details instead of None ### Test Suite Improvements - **Removed Defensive Assertions**: Updated all search_by_name tests to expect QueryResponse objects instead of allowing None values - **Fixed Constraint Validation**: Updated limit enforcement tests to check proper nested constraint structure (constraints["limit"]["requested"]) - **Enhanced Error Coverage**: Tests now properly validate regex error handling without masking real API issues ### Files Modified - **src/bertron_mcp/main.py**: Core search_by_name() function improvements - **tests/test_api.py**: 4 test functions updated for consistent return types - **tests/test_integration.py**: Removed conditional None checks - **tests/test_error_handling.py**: Minor formatting improvements - **tests/test_mcp_protocol.py**: Formatting consistency ## Problem Solved Previously, invalid regex patterns like "[", "(?P<", "*", "(?" would cause: 1. BERtron API to return 400 Bad Request errors 2. search_by_name() to return None instead of meaningful responses 3. Tests to hide real API issues with defensive try/catch blocks Now invalid patterns are validated locally and return structured error responses, while all functions maintain consistent return types that align with the "honestly i don't even like the allowance for none" feedback. ## Testing All 69 tests pass, including the previously failing regex validation tests. The fix enables more assertive testing that catches real API issues while providing better user experience through consistent error reporting. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
valerie-autumn-skye
approved these changes
Sep 17, 2025
Member
valerie-autumn-skye
left a comment
There was a problem hiding this comment.
Fantastic! This looks great. Feel free to merge.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
see commit message here: