Skip to content

chore/remove mcp gateway code - #8156

Merged
pandemicsyn merged 1 commit into
mainfrom
chore/remove-mcp-gateway-code
Oct 19, 2026
Merged

pandemicsyn merged 1 commit into
mainfrom
chore/remove-mcp-gateway-code

Conversation

@pandemicsyn

@pandemicsyn pandemicsyn commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Removes the user-facing MCP Gateway feature end to end. This is the gateway that let users register external MCP servers and proxied/OAuth-authenticated them; it does not touch kilo-mcp / .kilo/skills/kilo-mcp.

Removed:

  • Cloudflare Worker services/mcp-gateway, its MCPGatewayInstance Durable Object, Hyperdrive binding, Analytics Engine binding, and cron cleanup.
  • Next.js control plane: MCP Gateway pages, components, tRPC routers, OAuth/authorization/token/JWKS/registration routes, .well-known metadata, and connect-token routes.
  • packages/mcp-gateway; the reusable public-IP policy helpers moved to packages/web-shared/src/lib/ai-gateway/providers/ip-address.ts for the AI gateway SSRF policy.
  • Spec and docs: .specs/mcp-gateway-auth.md, nav entries, admin audit action, KiloClaw integration guidance, and MCP catalog/skill entries.

Stack:

Temporary cleanup retained

This PR keeps apps/web/src/lib/mcp-gateway/blocking-service.ts and lifecycle-service.ts as small direct-DB helpers until #8157 drops the tables. This preserves account anonymization and block/refund grant revocation during the window between the two deploys. #8157 removes both helpers and their call sites.

Verification

Automated checks run:

  • scripts/typecheck-all.sh --changes-only
  • tsgo --noEmit -p apps/web/tsconfig.json
  • pnpm --filter @kilocode/storybook run typecheck
  • pnpm --filter web test -- src/lib/user/index.test.ts (166 tests)
  • pnpm --filter web test -- src/lib/admin/admin-action-audit.test.ts (31 tests)
  • pnpm --filter web test -- ../../packages/web-shared/src/lib/ai-gateway/providers/ip-address.test.ts (31 tests)
  • pnpm --filter kilo-mcp test (456 tests)
  • Targeted oxlint for web and kilo-mcp
  • pnpm format:changed and git diff --check
  • MCP catalog and skill regenerated with the repo scripts.

Visual Changes

The MCP Gateway sidebar entries are removed. No replacement UI.

N/A

Reviewer Notes

Manual Cloudflare cleanup

The worker is auto-deployed from its workspace directory, so deleting it from the repo removes it from the CI matrix. The following Cloudflare resources still need manual cleanup in account e115e769bcdd4c3d66af59d3332cb394:

  • Worker: mcp-gateway; also delete the mcp-gateway-dev dev worker if it exists.
  • Workers Custom Domain: mcp.kilosessions.ai on zone kilosessions.ai. Remove the custom domain and its DNS record if Cloudflare does not remove them with the worker.
  • Durable Object namespace: MCPGatewayInstance (binding MCP_GATEWAY_INSTANCE).
  • Hyperdrive config: 624ec80650dd414199349f4e217ddb10 (binding HYPERDRIVE).
  • Analytics Engine dataset: mcp_gateway_events (binding MCP_GATEWAY_ANALYTICS).
  • Cron trigger: 0 3 * * * (deleted with the worker).
  • Worker secrets: MCP_GATEWAY_JWT_PUBLIC_KEYSET_JSON, MCP_GATEWAY_CREDENTIAL_KEYSET_JSON, MCP_GATEWAY_RATE_LIMIT_SECRET.
  • Worker vars: ENVIRONMENT, APP_BASE_URL, MCP_GATEWAY_BASE_URL, SUPPORTED_SCOPES, GATEWAY_ACCESS_TOKEN_TTL_SECONDS, AUDIT_RETENTION_DAYS, UPSTREAM_REQUIRE_HTTPS, MCP_GATEWAY_JWT_ISSUER.

No KV, D1, R2, or Queue bindings are declared.

Vercel cleanup

Remove these app-side env vars from deployment environments:

  • MCP_GATEWAY_BASE_URL
  • MCP_GATEWAY_APP_BASE_URL
  • MCP_GATEWAY_JWT_PRIVATE_KEYSET_JSON
  • MCP_GATEWAY_CREDENTIAL_KEYSET_JSON
  • MCP_GATEWAY_RATE_LIMIT_SECRET
  • MCP_GATEWAY_ACCESS_TOKEN_TTL_SECONDS

These contain key material and should be deleted, not just unset.

Existing OAuth clients

Client registrations and grants are stored in the tables dropped by #8157. External MCP clients pointed at mcp.kilosessions.ai will stop working when the worker and custom domain are removed.

@kilo-code-bot

kilo-code-bot Bot commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

Code Review Summary

Status: No Issues Found | Recommendation: Merge

Executive Summary

Reviewed the full 124-file, 187-addition/18,735-deletion MCP Gateway removal against current HEAD b510efc9b; the retained direct-DB anonymization and block/refund revocation helpers preserve prior semantics (including cascade-backed cleanup), the relocated IP policy is an unchanged rename with new tests, catalog/skill counts match the regenerated catalog, and no dangling imports, routes, bindings, or configuration references remain.

Files Reviewed (124 files)
  • apps/web/src/lib/mcp-gateway/blocking-service.ts - no issues (revocation updates match the deleted oauth-grant-service semantics; schema still owns the tables until chore(db): drop MCP Gateway tables #8157)
  • apps/web/src/lib/mcp-gateway/lifecycle-service.ts - no issues (hard deletes are covered by onDelete: 'cascade'; call sites use db and tx correctly, tests still expect zero rows)
  • packages/web-shared/src/lib/ai-gateway/providers/ip-address.ts / .test.ts - no issues (pure rename of packages/mcp-gateway/src/ip.ts; focused public/private range tests added)
  • packages/web-shared/src/lib/ai-gateway/providers/upstream-url-policy.ts - no issues (relative import updated; only consumer of the moved helpers)
  • services/kilo-mcp/catalog.json, services/kilo-mcp/src/index.test.ts, .kilo/skills/kilo-mcp/SKILL.md, .kilo/skills/specs/SKILL.md - no issues (18 mcpGateway* rows removed; verified 838 procedures / 357 queries / 481 mutations / 49 prefixes and the admin-guard test points at the real debug.handledTrpcError adminProcedure)
  • apps/web/src/routers/root-router.ts, both sidebar components, storybook, admin access log, Slack keyset comment - no issues (removed entries only; Cable icon and enum usage still valid)
  • .specs/cloud-agent-session.md, .specs/mcp-gateway-auth.md, services/kiloclaw/INTEGRATIONS.md - no issues (references removed consistently)
  • apps/web/package.json, packages/web-shared/package.json, pnpm-lock.yaml - no issues (workspace dependency and importer entries removed consistently)
  • Deleted worker, package, control-plane pages/components, OAuth/.well-known routes, tRPC routers, tests, and config (remaining ~110 files) - no issues (repo-wide search found no surviving references to @kilocode/mcp-gateway, services/mcp-gateway, mcpGateway, MCP_GATEWAY_*, MCPGatewayInstance, or deleted components; all mcp_gateway_configs foreign keys are cascade/set null)
Previous Review Summary (commit 52d09ec)

Current summary above is authoritative. Previous snapshots are kept for context only.

Previous review (commit 52d09ec)

Status: No Issues Found | Recommendation: Merge

Executive Summary

Reviewed the 124-file MCP Gateway removal (18,735 deletions, 309 additions); the retained direct-DB anonymization/revocation helpers preserve prior behavior, the relocated IP policy is a 100% rename, and no dangling references to the removed package, worker, routes, or tRPC routers remain.

Files Reviewed (124 files)
  • apps/web/src/lib/mcp-gateway/blocking-service.ts - no issues (direct-DB rewrite matches prior grant-revocation semantics)
  • apps/web/src/lib/mcp-gateway/lifecycle-service.ts - no issues (cascade-backed hard deletes replace soft deletes; call sites ignore return values)
  • packages/web-shared/src/lib/ai-gateway/providers/ip-address.ts / .test.ts - no issues (pure rename of packages/mcp-gateway/src/ip.ts, new focused tests)
  • packages/web-shared/src/lib/ai-gateway/providers/upstream-url-policy.ts - no issues (import path updated only)
  • apps/web/src/routers/root-router.ts, sidebar components, storybook - no issues (removed entries only; Cable still used)
  • packages/web-shared/src/lib/admin/admin-access-log.ts, apps/web/src/lib/integrations/platforms/slack/credential-keyset.ts - no issues (removed enum member and stale comment)
  • apps/web/package.json, packages/web-shared/package.json, pnpm-lock.yaml - no issues (dependency removed consistently)
  • services/kilo-mcp/catalog.json, services/kilo-mcp/src/index.test.ts, .kilo/skills/* - no issues (catalog and doc counts regenerated; replacement admin path debug.handledTrpcError is admin: true)
  • .specs/*, services/kiloclaw/INTEGRATIONS.md - no issues (references removed consistently)
  • Deleted worker, package, routes, routers, pages, and tests (remaining ~114 files) - verified no surviving imports or route references to @kilocode/mcp-gateway, services/mcp-gateway, mcp-gateway-auth, mcpGateway, or MCP_GATEWAY_*

Fix these issues in Kilo Cloud


Reviewed by deepseek-v4.1-flash-1017 · Input: 78.9K · Output: 17.9K · Cached: 2.4M

Review guidance: REVIEW.md from base branch main

@pandemicsyn
pandemicsyn added this pull request to the merge queue Oct 19, 2026
@pandemicsyn
pandemicsyn removed this pull request from the merge queue due to a manual request Oct 19, 2026
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.

2 participants