feat(mcp): added the ability to refresh servers to grab new tools#2335
Merged
waleedlatif1 merged 2 commits intostagingfrom Dec 12, 2025
Merged
feat(mcp): added the ability to refresh servers to grab new tools#2335waleedlatif1 merged 2 commits intostagingfrom
waleedlatif1 merged 2 commits intostagingfrom
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
Contributor
Greptile OverviewGreptile SummaryThis PR adds deterministic server ID generation based on workspace + URL hash, preventing "server not found" errors when workflows reference servers after delete/re-add cycles. The changes include:
The upsert logic automatically restores soft-deleted servers when re-adding the same URL, which maintains workflow references but could be unexpected behavior. Confidence Score: 4/5
Important Files ChangedFile Analysis
Sequence DiagramsequenceDiagram
participant User
participant UI as MCP Settings UI
participant Hook as useRefreshMcpServer
participant API as /api/mcp/servers/[id]/refresh
participant DB as Database
participant MCP as mcpService
User->>UI: Click "Refresh Tools" button
UI->>UI: Set refreshStatus='refreshing'
UI->>Hook: mutateAsync({workspaceId, serverId})
Hook->>API: POST /api/mcp/servers/{serverId}/refresh
API->>DB: Query server by ID + workspaceId
alt Server not found
API-->>Hook: 404 Error
Hook-->>UI: Error thrown
UI->>UI: Set refreshStatus='idle'
else Server found
API->>MCP: discoverServerTools(userId, serverId, workspaceId)
alt Connection successful
MCP-->>API: Return tools array
API->>DB: Update server (status='connected', toolCount, lastToolsRefresh)
else Connection failed
MCP-->>API: Throw error
API->>DB: Update server (status='error', lastError)
end
DB-->>API: Return updated server
API-->>Hook: Return {status, toolCount, lastConnected, error}
Hook->>Hook: Invalidate servers & tools queries
Hook-->>UI: Success response
UI->>UI: Set refreshStatus='refreshed'
UI->>UI: After 2s, set refreshStatus='idle'
end
|
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
Type of Change
Testing
Tested manually
Checklist