mcp-context-forge
mcp-context-forge copied to clipboard
fix: escape % characters in DATABASE for Alembic config
๐ Bug-fix PR
Before opening this PR please:
make lint- passesruff,mypy,pylintmake test- all unit + integration tests greenmake coverage- โฅ 90 %make docker docker-run-sslormake podman podman-run-ssl- Update relevant documentation.
- Tested with sqlite and postgres + redis.
- Manual regression no longer fails. Ensure the UI and /version work correctly.
๐ Summary
Bootstrap script fails if DATABASE_URL contains % characters. #1533
๐ Reproduction Steps
- Set DATABASE_URL with a password containing
%. - Run the bootstrap script or start the application:
python3 -m mcpgateway.bootstrap_dborpython3 -m mcpgateway.
๐ Root Cause
Alembic's Config.set_main_option() uses Python's configparser, which interprets % as interpolation syntax and raises InterpolationSyntaxError for URL-encoded characters like %40.
๐ก Fix Description
Escape % to %% before passing the URL to configparser.
๐งช Verification
| Check | Command | Status |
|---|---|---|
| Lint suite | make lint |
|
| Unit tests | make test |
|
| Coverage โฅ 90 % | make coverage |
|
| Manual regression no longer fails | steps / screenshots |
๐ MCP Compliance (if relevant)
- [ ] Matches current MCP spec
- [ ] No breaking change to MCP clients
โ Checklist
- [x] Code formatted (
make black isort pre-commit) - [x] No secrets/credentials committed