refactor: migrate all servers to mamba-mcp-core#4
Merged
Conversation
Add SAP HANA MCP server to README.md and CLAUDE.md with complete package description, architecture details, and repository structure updates. Also document mamba-mcp-fs utility modules (content.py, errors.py).
- Created internal/docs/codebase-analysis.md with comprehensive analysis of all 4 packages, including architecture overview, critical files, patterns, challenges, and recommendations - Updated CLAUDE.md with Key Patterns to Follow (7 core patterns for server packages), Testing Conventions, and Known Inconsistencies to guide future development - Updated README.md with Architecture section explaining the shared FastMCP + layered tool pattern and tech stack
…mba_mcp_hana Resolve module name asymmetry where mamba-mcp-hana was the only package that didn't follow the 1:1 naming convention (it used mamba_mcp_sap_hana with an extra sap_ prefix). All other packages map directly: mamba-mcp-pg → mamba_mcp_pg, mamba-mcp-fs → mamba_mcp_fs. Changes: - Rename src/mamba_mcp_sap_hana/ → src/mamba_mcp_hana/ - Update pyproject.toml entry point and build config - Update all imports across source and test files - Update CLAUDE.md, README.md, and codebase-analysis.md BREAKING CHANGE: Module import path changed from mamba_mcp_sap_hana to mamba_mcp_hana
Create mamba-mcp-core to extract duplicated code from server packages: - cli.py: validate_env_file, resolve_default_env_file, setup_logging - config.py: module-level env file path state management - errors.py: flat ToolError model + create_tool_error factory with server-specific suggestions_map parameter - fuzzy.py: Levenshtein distance + find_similar_names with scaled threshold (max(2, min(len//2, 5))) — standardizes PG vs HANA approach - transport.py: normalize_transport accepting both "http" and "streamable-http" Includes 51 tests covering all modules. Addresses Challenges #3 (code duplication) and #6 (fuzzy matching inconsistency).
Replace duplicated code across all three server packages with shared imports from mamba-mcp-core. This eliminates ~500 lines of copy-pasted CLI utilities, config state management, error models, and fuzzy matching. Changes per server: - PG: core imports for CLI, config, errors, fuzzy; dict return preserved - FS: core imports for CLI, config, transport; exception hierarchy kept - HANA: core imports for CLI, config, errors, fuzzy, transport; removed redundant resolve_env_file(); ToolError return preserved; suggest_similar wrapper maps max_suggestions→max_results Transport pattern updated to accept both "http" and "streamable-http" in all servers, with normalize_transport() applied before mcp.run(). Test updates: - HANA: removed TestLevenshteinDistance (now in core), removed TestResolveEnvFile (now in core), removed _levenshtein_distance import - All existing tests pass (PG: 66, HANA: 778, Core: 51)
There was a problem hiding this comment.
Pull request overview
This PR successfully migrates PostgreSQL, Filesystem, and SAP HANA MCP servers to use a new shared mamba-mcp-core package, eliminating approximately 500 lines of duplicated code across CLI utilities, configuration management, error handling, and fuzzy matching logic.
Changes:
- Created
mamba-mcp-corepackage with 5 modules (cli, config, errors, fuzzy, transport) and 51 passing tests - Migrated PG, FS, and HANA servers to import shared utilities from core
- Standardized transport naming (accepts both "http" and "streamable-http", normalizes to "streamable-http")
- Updated 778 HANA test import paths from
mamba_mcp_sap_hanatomamba_mcp_hana
Reviewed changes
Copilot reviewed 61 out of 68 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| packages/mamba-mcp-core/* | New shared utility package with CLI helpers, config state, error models, fuzzy matching, and transport normalization |
| packages/mamba-mcp-pg/src/mamba_mcp_pg/main.py | Removed ~80 lines of duplicated CLI functions, now imports from core |
| packages/mamba-mcp-pg/src/mamba_mcp_pg/config.py | Removed config state management, imports from core |
| packages/mamba-mcp-pg/src/mamba_mcp_pg/errors.py | Removed Levenshtein implementation, wraps core functions preserving dict return type |
| packages/mamba-mcp-fs/src/mamba_mcp_fs/main.py | Removed ~80 lines of duplicated CLI functions, added transport normalization |
| packages/mamba-mcp-fs/src/mamba_mcp_fs/config.py | Removed config state management, updated transport pattern |
| packages/mamba-mcp-hana/src/mamba_mcp_hana/main.py | New file replacing old path, removed ~75 lines of duplicated functions |
| packages/mamba-mcp-hana/src/mamba_mcp_hana/config.py | Removed config state and resolve_env_file function, updated transport pattern |
| packages/mamba-mcp-hana/src/mamba_mcp_hana/errors.py | Removed Levenshtein implementation, added suggest_similar wrapper for backward compatibility |
| packages/mamba-mcp-hana/tests/* | Updated 778 test file imports from old package name to new name |
| uv.lock, pyproject.toml | Added mamba-mcp-core to workspace and server dependencies |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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.
Summary
mamba-mcp-corepackagehttpandstreamable-http)Changes per server
mamba-mcp-pg:
__main__.py: Core imports forvalidate_env_file,resolve_default_env_file,setup_logging,normalize_transportconfig.py: Core imports forget_env_file_path,set_env_file_path; transport pattern updatederrors.py: Core imports forcreate_tool_error,find_similar_names; dict return type preservedmamba-mcp-fs:
__main__.py: Core imports for CLI + transport utilitiesconfig.py: Core imports for config state; transport pattern updatederrors.py: Intentionally unchanged (keeps custom exception hierarchy for backend flow control)mamba-mcp-hana:
__main__.py: Core imports for CLI + transport; removed ~75 lines of local function definitionsconfig.py: Core imports for config state; removed redundantresolve_env_file(); transport pattern updatederrors.py: Core imports forToolError,create_tool_error,find_similar_names;suggest_similarwrapper preserves keyword compatTest plan