Skip to content

🪲 BUG: deduplicate and validate MCP server list input - #12

Merged
FernandoCelmer merged 3 commits into
dotflow-io:masterfrom
myukitty:fix/mcp-server-dedupe-validation
Aug 15, 2026
Merged

FernandoCelmer merged 3 commits into
dotflow-io:masterfrom
myukitty:fix/mcp-server-dedupe-validation

Conversation

@myukitty

@myukitty myukitty commented Aug 15, 2026

Copy link
Copy Markdown
Contributor

Description

  • src/features/settings/mcpServerList.ts — Updated addServer to trim whitespace from the input command, reject empty or whitespace-only strings, and detect duplicates by comparing trimmed forms. Now returns a trimmed copy of the new entry instead of the raw input.
  • test/mcpServerList.test.ts — Added 4 new unit tests covering whitespace trimming, empty/whitespace-only rejection, exact duplicate detection, and duplicate detection against existing entries with whitespace.

Motivation and Context

When managing custom MCP servers in the Settings webview, inputs could be appended without whitespace trimming or duplicate detection, allowing empty entries or whitespace-equivalent duplicates to accumulate in the stored list.

Closes #10.

Types of changes

  • Bug fix (change that fixes an issue)
  • New feature (change which adds functionality)
  • Documentation

Checklist

  • I have performed a self-review of my own code
  • I have added tests that prove my fix is effective or that my feature works
  • I have updated the CHANGELOG
  • I have updated the documentation accordingly

@FernandoCelmer FernandoCelmer left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔍 Code Review

Code issues found: 1

# Severity Comment
1 [Suggestion] Missing add→remove round-trip test

Comment thread test/mcpServerList.test.ts
@FernandoCelmer FernandoCelmer added the bug Something isn't working label Aug 15, 2026
FernandoCelmer

This comment was marked as duplicate.

…zation

addServer trims whitespace before storing, but removeServer compared
with strict equality — any legacy or existing whitespace-padded entry
(including the "  a  " case this PR's own tests explicitly leave in
storage) could never be removed through the UI. removeServer now
trims both the stored entries and the incoming name before comparing,
symmetric with addServer.
@FernandoCelmer
FernandoCelmer merged commit fdd2002 into dotflow-io:master Aug 15, 2026
2 checks passed
@FernandoCelmer

Copy link
Copy Markdown
Member

Thanks for this one, @myukitty! Good catch on the dedupe/validation gap, and the tests made it really easy to spot the trim asymmetry between addServer and removeServer — fixed that and added a couple more tests to lock it in. Appreciate the contribution!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

MCP server list allows duplicate entries with no validation

2 participants