alembic-migrations
Skill4.9k starsChanged 16 days agoApache-2.0View on GitHub
Create or review an Alembic migration in `mcpgateway/alembic`. Use when you add a column or table, change `mcpgateway/db.py` models, fix "Multiple heads", or write a `downgrade()` that reads `settings`.
Adopted by
Steady: 0 new projects took it in the last 4 weeks, none the 4 weeks before.thin data
Who's talking about IBM/mcp-context-forge
- A Hacker News story“MCP Gateway and Registry”Hacker News · Aug 25, 2025 · 73 points
- coder/coder“feat(oidc): support Microsoft Entra ID email verification claim (xms_edov)”GitHub · Jun 15, 2026 · 4 reactions
- @github-trending.bsky.social“📦 IBM / mcp-context-forge ⭐ 1,113 (+46) 🗒 Python A Model Context Protocol (MCP) Gateway & Registry. …”Bluesky · Aug 16, 2025 · 3 likes
- kubernetes-sigs/mcp-lifecycle-operator“MCP gateway(s) integration(s)”GitHub · Apr 27, 2026 · 2 reactions
- @matsuu.bsky.social“REST APIをMCPサーバ化するためのゲートウェイ実装かな。org:IBMだ。”Bluesky · Aug 30, 2025 · 2 likes
The biggest 5 of 59 mentions linking to the repository that our crawl found. Each line is their own headline.
See all 59
Talked about on GitHub, Bluesky and Hacker News (59 times).
On GitHub · 50
- Jun 15, 2026feat(oidc): support Microsoft Entra ID email verification claim (xms_edov) — coder/coder4 reactions · 1 comment
- Apr 27, 2026MCP gateway(s) integration(s) — kubernetes-sigs/mcp-lifecycle-operator2 reactions · 5 comments
- Nov 12, 2026feat: Add export functionality — contextforge-org/contextforge-web-ui1 reaction · 2 comments
- Aug 19, 2026feat: add a preview experience to the resource details panel — contextforge-org/contextforge-web-ui1 reaction
- Jun 11, 2026[REMOTE] AADSTS9010010 invalid_target on token acquisition in VS Code stable (resource + scope conflict) — still repros June 2026 — microsoft/azure-devops-mcp1 reaction · 4 comments
45 more on GitHub
- Apr 28, 20264500 mcp server state — dima-zakharov/mcp-context-forge1 reaction · 4 comments
- Apr 19, 2026add wf — sco3/mcp-context-forge1 reaction · 4 comments
- Mar 9, 2026Act — sco3/mcp-context-forge1 reaction · 4 comments
- Nov 28, 2026📝 [docs] https://github.com/IBM/mcp-context-forge tool-study — adszzz11/study0 reactions
- Nov 28, 2026[Source check] 28 Nov 2026 daily review: 9 stale version/date claims (Tech Radar + Workflows/factories) — eitri-edd/AI-PDLC0 reactions
- Nov 24, 2026feat(gateways): connect and select agents in the virtual server builder — contextforge-org/contextforge-web-ui0 reactions
- Nov 20, 2026feat: Add helper message to the disable button — contextforge-org/contextforge-web-ui0 reactions
- Nov 17, 2026fix(oauth): resolve the popup flow when the provider severs window.opener — contextforge-org/contextforge-web-ui0 reactions
- Nov 15, 2026feat(lp): comparisons with Docker MCP Gateway, Obot, MCPHub, ContextForge and agentgateway — runelay/runelay0 reactions
- Nov 13, 2026feat: Add import dry-run step — contextforge-org/contextforge-web-ui0 reactions
- Nov 12, 2026Develop — saal-core/dataprism360-mcp-gateway0 reactions
- Nov 9, 2026feat: Add import config functionality — contextforge-org/contextforge-web-ui0 reactions
- Nov 9, 2026feat(agents): add the Connect agent form with manual entry — contextforge-org/contextforge-web-ui0 reactions
- Nov 6, 2026Create pr-review-test.md — NidhiS1211/mcp-context-forge0 reactions
- Nov 3, 2026feat: Remove `/admin/preview` endpoint from the BFF — contextforge-org/contextforge-web-ui0 reactions
- Nov 2, 2026Add useImportConfig hook — contextforge-org/contextforge-web-ui0 reactions
- Nov 2, 2026feat: Add useExportConfig hook — contextforge-org/contextforge-web-ui0 reactions
- Nov 2, 2026feat: Export download helper lib — contextforge-org/contextforge-web-ui0 reactions
- Nov 2, 2026Add import/export libs — contextforge-org/contextforge-web-ui0 reactions
- Nov 2, 2026Add import routes with configured req size limit — contextforge-org/contextforge-web-ui0 reactions
- Nov 2, 2026Add Import/Export config — contextforge-org/contextforge-web-ui0 reactions
- Oct 30, 2026test(e2e): un-skip real Keycloak SSO e2e, bump gateway to v1.1.0 — contextforge-org/contextforge-web-ui0 reactions
- Oct 29, 2026[Epic] MCP Gateway Integration — cuga-project/cuga-agent0 reactions
- Oct 27, 2026[Feature]: Add support EntraID OIDC, sign-in is currently blocked by email_verified requirement. — X4Applegate/caddyui0 reactions · 4 comments
- Oct 21, 2026oauth2: refresh token request does not send `scope`, Microsoft Entra ID rejects it with AADSTS90009 — envoyproxy/envoy0 reactions · 2 comments
- Oct 20, 2026chore: refresh openapi.json to API v1.1.0+42a06c — contextforge-org/contextforge-web-ui0 reactions
- Oct 13, 2026[BUG]: cpex-rate-limiter 0.1.11 rejects ordinary prompts when by_user_per_server is enabled — IBM/cpex-plugins0 reactions
- Oct 2, 2026tests: SSO flow Playwright tests — contextforge-org/contextforge-web-ui0 reactions
- Sep 24, 2026feat: SSO callback route and session wiring — contextforge-org/contextforge-web-ui0 reactions · 3 comments
- Sep 16, 2026PEP 541 Request: mcpgateway — pypi/support0 reactions · 2 comments
- Sep 16, 2026PEP 541 Request: mcp-context-forge — pypi/support0 reactions · 1 comment
- Aug 24, 2026[CHORE]: Move url_to_markdown_server to mcp-servers/python/url_to_markdown_server — IBM/contextforge-examples0 reactions
- Aug 24, 2026[CHORE]: Move output_schema_test_server to mcp-servers/python/output_schema_test_server — IBM/contextforge-examples0 reactions
- Aug 24, 2026[CHORE]: Move mcp_eval_server to mcp-servers/python/mcp_eval_server — IBM/contextforge-examples0 reactions
- Aug 24, 2026[CHORE]: Move data_analysis_server to mcp-servers/python/data_analysis_server — IBM/contextforge-examples0 reactions
- Aug 24, 2026[CHORE]: Move Python server template to mcp-servers/templates/python — IBM/contextforge-examples0 reactions
- Aug 24, 2026[CHORE]: Move mcp-rss-search to mcp-servers/python/mcp-rss-search — IBM/contextforge-examples0 reactions
- Aug 24, 2026[CHORE]: Move graphviz_server to mcp-servers/python/graphviz_server — IBM/contextforge-examples0 reactions
- Aug 24, 2026[CHORE]: Move llmguardplugin to plugins/external/llmguard — IBM/contextforge-examples0 reactions
- Aug 24, 2026[CHORE]: Move cedarpolicyplugin to plugins/external/cedar — IBM/contextforge-examples0 reactions
- Aug 23, 2026[corpus] Add MCP Context Forge — mcdigman/liveness_primer0 reactions
- Aug 14, 2026build(deps): bump mcp-contextforge-gateway from 0.3.1 to 1.0.3 in /packages/server/tests/agents — bancolombia/ibmi-mcp-server0 reactions
- Aug 13, 2026ContextForge Hosted Project Application — aaif/project-proposals0 reactions · 1 comment
- Aug 10, 2026build(deps): Bump mcp-contextforge-gateway from 1.0.0rc1 to 1.0.7 — contextforge-org/contextforge-cli0 reactions
- Jun 22, 2026[Design] Connect CUGA registry to MCP Context Forge gateway — cuga-project/cuga-agent0 reactions
On Bluesky · 8
- Aug 16, 2025📦 IBM / mcp-context-forge ⭐ 1,113 (+46) 🗒 Python A Model Context Protocol (MCP) Gateway & Registry. Serves as a central management… — @github-trending.bsky.social3 likes and reposts
- Aug 30, 2025REST APIをMCPサーバ化するためのゲートウェイ実装かな。org:IBMだ。 — @matsuu.bsky.social2 likes and reposts
- Jun 9, 2025🔌 FastAPI #MCP #Gateway: unify tools, wrap any #RESTAPI as virtual MCP tool 🛡️ #Auth, UI, #websockets, #JSON-RPC, #SSE 👉 Discuss in… — @qdrddr.bsky.social2 likes and reposts
- Mar 20, 2026https://github.com/IBM/mcp-context-forge — @tom-doerr.bsky.social1 likes and repost
- Sep 22, 2025IBM just dropped mcp-context-forge 🚀 An open-source MCP Gateway & Registry for managing tools, prompts, and resources. Converts REST APIs… — @mcp-community.bsky.social1 likes and repost
3 more on Bluesky
- Aug 26, 2025🔥 Hot Repo! 🔥 (100+ new stars) 📦 IBM / mcp-context-forge ⭐ 1,726 (+121) 🗒 Python A Model Context Protocol (MCP) Gateway & Registry.… — @github-trending.bsky.social1 likes and repost
- Aug 25, 2025MCP Gateway and Registry https://github.com/IBM/mcp-context-forge (https://news.ycombinator.com/item?id=45010524) — @betterhn20.e-work.xyz1 likes and repost
- Aug 25, 2025MCP Gateway and Registry #HackerNews https://github.com/IBM/mcp-context-forge — @hackernewstop5.bsky.social1 likes and repost
On Hacker News · 1
- Aug 25, 2025MCP Gateway and Registry73 points · 53 comments
In this repository12 other files it gives its agents.
- AGENTS.mdAGENTS.md
- charts/AGENTS.mdAGENTS.md
- docs/AGENTS.mdAGENTS.md
- plugins/AGENTS.mdAGENTS.md
- tests/AGENTS.mdAGENTS.md
- asd-ste100Skill
- contextforge-web-uiSkill
- github-issuesSkill
- mcp-helpersSkill
- observability-audit-sessionsSkill
- pr-reviewSkill
- secret-detectionSkill
The file
We split this skill into the rules it gives an agent
6 rules. About 0 are common, 2 are distinctive, and 4 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈2
Distinctive · estimate
This author's own choices. Worth a look.
4
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 8
Every change to a model in mcpgateway/db.py needs a matching Alembic migration.
- Distinctive: line 45
Write idempotent migrations.
- Very specific: line 65
Run these commands from mcpgateway/.
- Distinctive: line 100
Run the test suite to confirm the migrations work:
- Very specific: line 111
"Target database is not up to date": Run alembic upgrade head first.
- Very specific: line 163
Rule: If a migration imports settings and uses it in downgrade(), follow this pattern.
≈ “Common” is an estimate: at least 1 in 5 of the 408,460 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Alembic Database Migrations
Every change to a model in mcpgateway/db.py needs a matching Alembic migration. This includes every new column and table.
Migration Chain Rules
- Work on one migration at a time. Merge or finish one migration before you start the next.
- The
revision->down_revisionlinks form one linked list. The chain never branches. - Each migration has exactly one parent.
alembic headsshows exactly one head. - A new migration sets
down_revisionto the current head.
Create a Migration
# CRITICAL: Always check the current head FIRST
cd mcpgateway && alembic heads
# Generate a new migration (auto-generates from model changes)
alembic revision --autogenerate -m "add_column_to_table"
# Or create an empty migration for manual edits
alembic revision -m "add_column_to_table"Migration File Requirements
The down_revision MUST point to the current head. Read the head from alembic heads. Never copy the value from an older migration.
# CORRECT: points to the actual current head (verified with `alembic heads`)
revision: str = "<new_revision_id>"
down_revision: Union[str, Sequence[str], None] = "<current_head_id>"
# WRONG: creates multiple heads (breaks all tests)
down_revision: Union[str, Sequence[str], None] = "<some_older_revision_id>"Idempotent Migrations Pattern
Write idempotent migrations. Check state before you change it:
def upgrade() -> None:
inspector = sa.inspect(op.get_bind())
# Skip if table doesn't exist (fresh DB uses db.py models directly)
if "my_table" not in inspector.get_table_names():
return
# Skip if column already exists
columns = [col["name"] for col in inspector.get_columns("my_table")]
if "new_column" in columns:
return
op.add_column("my_table", sa.Column("new_column", sa.String(), nullable=True))Verification
Run these commands from mcpgateway/.
Inspect the chain
alembic heads # must show exactly ONE head
alembic current # revision the DB is at
alembic history --verbose # full chain
alembic branches # find branch pointsUpgrade
alembic upgrade head # apply all
alembic upgrade +1 # apply the next one
alembic upgrade <revision_id> # apply up to a specific revision
alembic upgrade <rev>:head --sql # print the SQL only (offline mode, no DB change)Downgrade
alembic downgrade -1 # revert the latest migration
alembic downgrade <revision_id> # revert to a specific revision
alembic downgrade base # revert everything
alembic downgrade head:-1 --sql # print the SQL only (offline mode, no DB change)Round-trip test of a new migration
alembic upgrade head && alembic downgrade -1 && alembic upgrade headRun the test suite to confirm the migrations work:
make testDone when alembic heads prints one head, the round-trip test passes, and make test passes.
Common Errors
- "Multiple heads are present":
down_revisionpoints to the wrong parent. Set it to the actual current head. - "Target database is not up to date": Run
alembic upgrade headfirst.
Hermetic Downgrade: Config Snapshot Pattern
A downgrade() that reads runtime configuration (mcpgateway.config.settings) must snapshot those values into migration_metadata during upgrade(). downgrade() reads the snapshot back. The migration is then hermetic: database state determines its behavior, not the current environment.
from mcpgateway.config import settings
from sqlalchemy import inspect, text
REVISION = "<your_revision_id>"
def upgrade() -> None:
bind = op.get_bind()
# ... schema changes ...
# Snapshot any settings values used in downgrade
if "migration_metadata" in inspect(bind).get_table_names():
bind.execute(
text(
"INSERT INTO migration_metadata (revision, key, value, created_at) "
"VALUES (:rev, :key, :val, CURRENT_TIMESTAMP) "
"ON CONFLICT (revision, key) DO UPDATE SET value = excluded.value"
),
{"rev": REVISION, "key": "some_setting", "val": settings.some_setting},
)
def downgrade() -> None:
bind = op.get_bind()
# Read from snapshot; fall back to live settings only if table is absent
# (pre-existing DB that was upgraded before this pattern was introduced)
cfg = {}
if "migration_metadata" in inspect(bind).get_table_names():
rows = bind.execute(
text("SELECT key, value FROM migration_metadata WHERE revision = :rev"),
{"rev": REVISION},
).all()
cfg = {r[0]: r[1] for r in rows}
some_setting = cfg.get("some_setting") or settings.some_setting
# ... use some_setting for downgrade logic ...
# Clean up snapshot rows
if "migration_metadata" in inspect(bind).get_table_names():
bind.execute(
text("DELETE FROM migration_metadata WHERE revision = :rev"),
{"rev": REVISION},
)Rule: If a migration imports settings and uses it in downgrade(), follow this pattern. A migration that uses settings only in upgrade() (for example, to seed initial data) is exempt.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

