feat(mcp-servers): add DELETE endpoint to permanently remove a connector - #495
Open
kristopolous wants to merge 1 commit into
Open
feat(mcp-servers): add DELETE endpoint to permanently remove a connector#495kristopolous wants to merge 1 commit into
kristopolous wants to merge 1 commit into
Conversation
There was previously no way to permanently remove a configured MCP connector: header-auth connectors had no removal option at all, and DCR connectors' "Disconnect" only cleared the OAuth token, leaving the row (and an auth_required badge) in the Configured list forever. Add IMcpServerStore.deleteServer (Postgres + SQLite), the DELETE route, and its handler. OAuth tokens and pending authorizations cascade-delete via their existing oauth_server_id FK (ON DELETE CASCADE), so no manual cleanup is needed. Idempotent, matching the existing delete-agent route. Backend only: packages/trueforge-sdk is Fern-generated in CI and fork PRs cannot receive that regen commit (see .github/workflows/generate-sdk.yaml). The Connect UI's "Remove" button follows in a fast-follow PR once the SDK regenerates on main after this merges. Fixes truefoundry#494 Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01MxyEPwQ73B27NTr83U69Ba
kristopolous
requested review from
bhaveshpatel640,
chiragjn,
debajyoti-truefoundry,
heerambavi1998,
sr07asthana and
thesujai
as code owners
August 29, 2026 21:05
🦋 Changeset detectedLatest commit: b80860a The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
This was referenced Aug 29, 2026
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
Fixes #494.
There is currently no way to permanently remove a configured MCP connector:
dcr) connectors' "Disconnect" only clears the stored token (DELETE /{name}/authorize); the row stays in "Configured" with anauth_requiredbadge forever.This PR adds the missing backend piece:
DELETE /api/v1/settings/mcp-servers/{name}.IMcpServerStore.deleteServerimplemented for both Postgres and SQLite (DELETE FROM mcp_server WHERE tenant_id = ? AND name = ?).oauth_server_idforeign key (ON DELETE CASCADE, already in place from the DCR migrations) — no extra cleanup code needed.deleteAgentRoute/deleteAgentHandler: idempotent,200with{}on success.Scope: backend only
packages/trueforge-sdkis Fern-generated in CI (.github/workflows/generate-sdk.yaml), and that workflow explicitly cannot push its regen commit to a fork PR's branch — it only runs after merge tomain(or same-repo PRs). I actually ran the generator locally to check: it produced a 447-file, ~15k-line diff that's almost entirely unrelated generator-version churn (e.g.import type X→import X, modifier reordering) that has nothing to do with this endpoint — not something that belongs in this PR, andAGENTS.mdforbids hand-editingpackages/trueforge-sdkbesides.So this PR is the backend endpoint only, fully implemented and tested. The Connect UI's "Remove" button is a fast-follow PR once this merges and the SDK regenerates on
main(either automatically via the same workflow, or a maintainer runningpnpm sdk:generate).API docs: no manual doc changes needed — Mintlify's API reference (
docs/docs.json) reads directly fromdocs/openapi.json, which regenerates alongside the SDK and will pick up the new endpoint automatically.Test plan
mcpServerStoreContractSuite.ts(runs against both backends): delete removes the row and cascades the OAuth client; idempotent for an unknown server, other tenants untouched.pnpm test:store:sqlite— 133 passed (was 131), 1 skipped.tests/unit/apis/mcpServers.test.ts:DELETE /{name}removes the server and cascades a saved token; idempotent for an unknown server.pnpm test(trueforge unit suite) — 294/294 pass.pnpm run typecheck— clean.pnpm eslinton changed files — clean.@truefoundry/trueforgeminor — new endpoint).pnpm test:store:postgres) — implementation is a verbatim mirror of the SQLite one using the same Kysely pattern already used for every other method in that file; couldn't verify locally (this sandbox blocks raw TCP to a local Postgres container), but CI runs it with a realpostgres:17-alpineservice against this exact test file.🤖 Generated with Claude Code
https://claude.ai/code/session_01MxyEPwQ73B27NTr83U69Ba
Note
Medium Risk
Permanently deletes connector rows and cascades OAuth tokens/authorizations; impact is limited to the admin settings API with existing auth gates and tests.
Overview
Adds
DELETE /api/v1/settings/mcp-servers/{name}so admins can fully remove a configured MCP connector instead of only disconnecting OAuth (which left DCR servers in settings forever).The settings router calls new
IMcpServerStore.deleteServeron Postgres and SQLite (delete bytenant_id+name). Stored OAuth tokens and pending authorizations are dropped via existingON DELETE CASCADEonoauth_server_id—no extra cleanup in the handler. The endpoint is idempotent:200with{}whether or not the server existed, matching other admin delete routes.OpenAPI/Fern metadata and
DeleteMcpServerResponseSchemaare included; store contract and API unit tests cover cascade behavior and idempotency. Minor@truefoundry/trueforgechangeset; SDK/UI follow separately.Reviewed by Cursor Bugbot for commit b80860a. Bugbot is set up for automated code reviews on this repo. Configure here.