Skip to content

Conversation

@zerob13
Copy link
Collaborator

@zerob13 zerob13 commented Nov 25, 2025

fixed #1114

Summary by CodeRabbit

  • New Features

    • MCP server arguments input redesigned to accept one argument per line with per-argument rows and add/remove controls.
    • "Add Argument" action added to simplify adding multiple parameters.
  • Documentation / Localization

    • Updated UI wording across languages: new placeholders and labels ("Add Argument", per-argument placeholder) to guide line-by-line argument entry.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 25, 2025

Walkthrough

The MCP server form was refactored to replace space-separated single-string argument handling with a line-by-line list model (argsRows with nanoid ids). Parsing, watches, UI, and submit normalization were updated; i18n strings across multiple locales were added/adjusted for the new per-line argument UI.

Changes

Cohort / File(s) Summary
MCP Server Form Component
src/renderer/src/components/mcp-config/mcpServerForm.vue
Replaced legacy single-string/tag argument input with a list-based argsRows (per-row nanoid ids). Updated parsing to populate argsRows or foldersList depending on type (buildInFileSystem vs. others), rewired watches/sync logic, adjusted handleSubmit to normalize args (newline-joined), added customHeaders parsing/masking, and replaced the UI with add/remove per-arg rows.
English Localization
src/renderer/src/i18n/en-US/mcp.json, src/renderer/src/i18n/en-US/settings.json
Changed argsPlaceholder to "Enter one argument per line" and added addArg ("Add Argument") and argPlaceholder ("Enter argument value").
Persian Localization
src/renderer/src/i18n/fa-IR/mcp.json, src/renderer/src/i18n/fa-IR/settings.json
Updated argsPlaceholder to Persian "هر خط یک آرگومان وارد کنید" / "هر ورودی را در یک خط وارد کنید" and added addArg ("افزودن آرگومان"/"افزودن ورودی") and argPlaceholder ("مقدار آرگومان را وارد کنید"/"مقدار ورودی را وارد کنید").
French Localization
src/renderer/src/i18n/fr-FR/mcp.json, src/renderer/src/i18n/fr-FR/settings.json
Changed argsPlaceholder to "Saisir un argument par ligne" and added addArg/"argPlaceholder".
Japanese Localization
src/renderer/src/i18n/ja-JP/mcp.json, src/renderer/src/i18n/ja-JP/settings.json
Changed argsPlaceholder to a one-per-line Japanese string and added addArg/argPlaceholder.
Korean Localization
src/renderer/src/i18n/ko-KR/mcp.json, src/renderer/src/i18n/ko-KR/settings.json
Changed argsPlaceholder to a one-per-line Korean string and added addArg/argPlaceholder.
Portuguese (pt-BR) Localization
src/renderer/src/i18n/pt-BR/mcp.json, src/renderer/src/i18n/pt-BR/settings.json
Changed argsPlaceholder to "Digite um argumento por linha" and added addArg/argPlaceholder.
Russian Localization
src/renderer/src/i18n/ru-RU/mcp.json, src/renderer/src/i18n/ru-RU/settings.json
Changed argsPlaceholder to "Введите по одному параметру в строке" and added addArg/argPlaceholder.
Simplified Chinese Localization
src/renderer/src/i18n/zh-CN/mcp.json, src/renderer/src/i18n/zh-CN/settings.json
Changed argsPlaceholder to "每行一个参数" and added addArg/argPlaceholder.
Hong Kong Chinese Localization
src/renderer/src/i18n/zh-HK/mcp.json, src/renderer/src/i18n/zh-HK/settings.json
Changed argsPlaceholder to "每行一個參數" and added addArg/argPlaceholder.
Traditional Chinese (TW) Localization
src/renderer/src/i18n/zh-TW/mcp.json, src/renderer/src/i18n/zh-TW/settings.json
Changed argsPlaceholder to "每行一個參數" and added addArg/argPlaceholder.

Sequence Diagram(s)

sequenceDiagram
    actor User
    participant Form as mcpServerForm.vue
    participant State as Component State
    participant Parser as Config Parser

    User->>Form: Open/Edit server form
    Form->>Parser: Parse initialConfig / defaultJsonConfig
    alt buildInFileSystem
        Parser->>State: Populate foldersList (from args)
    else imageServer / standard
        Parser->>State: Populate argsRows[] (each row with nanoid)
    end

    User->>Form: Add Arg
    Form->>State: create argsRow(id)
    User->>Form: Edit Arg row
    Form->>State: update argsRows[i].value
    User->>Form: Remove Arg
    Form->>State: remove argsRows[i]

    User->>Form: Submit
    Form->>Parser: handleSubmit()
    alt buildInFileSystem
        State->>Parser: join foldersList with newline -> normalized args
    else standard/imageServer
        State->>Parser: join argsRows.values with newline -> normalized args
    else remote (SSE/HTTP)
        State->>Parser: set args empty/default
    end
    Parser-->>Form: return normalized config
    Form->>User: save/close
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

  • Files/areas needing extra attention:
    • src/renderer/src/components/mcp-config/mcpServerForm.vue — correctness of parsing/init for imageServer and inmemory flows, watch/sync logic, and handleSubmit normalization.
    • Interactions between argsRows and foldersList when switching types.
    • Custom headers parsing/masking paths and remote (SSE/HTTP) arg behavior.
    • i18n files — consistent keys and placeholders across locales.

Possibly related PRs

Poem

🐇 I hop through rows, one arg per line,
Nanoids planted, each tiny sign.
Add, edit, remove — a tidy parade,
Languages singing the change we've made.
A rabbit cheers: clean inputs, well-designed! 🎉

Pre-merge checks and finishing touches

✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The PR title 'fix: mcp args with space #1114' is directly related to the main objective of fixing MCP parameter input handling for quoted strings containing spaces, addressing issue #1114.
Linked Issues check ✅ Passed The PR refactors argument handling from space-delimited strings to newline-delimited rows, fixing the core issue where quoted strings with spaces were incorrectly split during import and UI editing, fully addressing the requirements in issue #1114.
Out of Scope Changes check ✅ Passed All changes are directly in scope: the mcpServerForm component refactoring implements the fix for argument parsing, and i18n updates reflect the new per-line argument input UI across all supported languages.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch bugfix/mcp-args-input

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 28907aa and a872b15.

📒 Files selected for processing (2)
  • src/renderer/src/i18n/fa-IR/mcp.json (1 hunks)
  • src/renderer/src/i18n/fa-IR/settings.json (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/renderer/src/i18n/fa-IR/settings.json
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: build-check (x64)
🔇 Additional comments (1)
src/renderer/src/i18n/fa-IR/mcp.json (1)

84-86: Critical issue from past review has been resolved.

The three Persian translation strings have been successfully added:

  • argsPlaceholder → "هر خط یک آرگومان وارد کنید"
  • addArg → "افزودن آرگومان"
  • argPlaceholder → "مقدار آرگومان را وارد کنید"

These follow the Persian UI naming conventions used consistently throughout the file and align with the per-line argument input feature introduced in this PR.

Please verify with a native Persian speaker that these translations are idiomatic and appropriate for the MCP settings UI context, particularly the argPlaceholder string to ensure it conveys the intended meaning clearly to Persian-speaking users.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 3

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between a6b6268 and 28907aa.

📒 Files selected for processing (21)
  • src/renderer/src/components/mcp-config/mcpServerForm.vue (11 hunks)
  • src/renderer/src/i18n/en-US/mcp.json (1 hunks)
  • src/renderer/src/i18n/en-US/settings.json (1 hunks)
  • src/renderer/src/i18n/fa-IR/mcp.json (1 hunks)
  • src/renderer/src/i18n/fa-IR/settings.json (1 hunks)
  • src/renderer/src/i18n/fr-FR/mcp.json (1 hunks)
  • src/renderer/src/i18n/fr-FR/settings.json (1 hunks)
  • src/renderer/src/i18n/ja-JP/mcp.json (1 hunks)
  • src/renderer/src/i18n/ja-JP/settings.json (1 hunks)
  • src/renderer/src/i18n/ko-KR/mcp.json (1 hunks)
  • src/renderer/src/i18n/ko-KR/settings.json (1 hunks)
  • src/renderer/src/i18n/pt-BR/mcp.json (1 hunks)
  • src/renderer/src/i18n/pt-BR/settings.json (1 hunks)
  • src/renderer/src/i18n/ru-RU/mcp.json (1 hunks)
  • src/renderer/src/i18n/ru-RU/settings.json (1 hunks)
  • src/renderer/src/i18n/zh-CN/mcp.json (1 hunks)
  • src/renderer/src/i18n/zh-CN/settings.json (1 hunks)
  • src/renderer/src/i18n/zh-HK/mcp.json (1 hunks)
  • src/renderer/src/i18n/zh-HK/settings.json (1 hunks)
  • src/renderer/src/i18n/zh-TW/mcp.json (1 hunks)
  • src/renderer/src/i18n/zh-TW/settings.json (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: build-check (x64)
🔇 Additional comments (27)
src/renderer/src/i18n/ko-KR/mcp.json (1)

40-43: ✓ Localization update for per-line argument input

The Korean translations align with the PR's shift from space-separated to line-based argument input. Keys and values are consistent with the broader localization pattern across other locales.

src/renderer/src/i18n/zh-TW/settings.json (1)

623-625: ✓ Localization update for per-line argument input

The Traditional Chinese translations correctly reflect the new per-line argument input pattern. New keys (addArg, argPlaceholder) and updated argsPlaceholder text are consistent with the UI refactor.

src/renderer/src/i18n/zh-HK/settings.json (1)

624-626: ✓ Localization update for per-line argument input

The Cantonese (Hong Kong) translations correctly reflect the new per-line argument input pattern. New keys and updated placeholder text align with the UI refactor across locales.

src/renderer/src/i18n/ko-KR/settings.json (1)

624-626: ✓ Localization update for per-line argument input

The Korean translations in settings.json align with the per-line argument input pattern. Keys and values are consistent across both mcp.json and settings.json files.

src/renderer/src/i18n/zh-HK/mcp.json (1)

84-86: ✓ Localization update for per-line argument input

The Cantonese (Hong Kong) translations correctly reflect the new per-line argument input pattern. Keys and values are consistent with the UI refactor.

src/renderer/src/i18n/zh-TW/mcp.json (1)

65-67: ✓ Localization update for per-line argument input

The Traditional Chinese translations correctly reflect the new per-line argument input pattern. Keys and values align with the UI refactor across locales.

src/renderer/src/i18n/ru-RU/mcp.json (1)

84-86: ✓ Localization update for per-line argument input

The Russian translations correctly reflect the new per-line argument input pattern. Keys and values are consistent with the UI refactor across locales.

src/renderer/src/i18n/ru-RU/settings.json (1)

624-626: RU i18n: args UI keys added and phrasing looks correct.

src/renderer/src/i18n/zh-CN/settings.json (1)

632-635: ZH-CN i18n: keys present; wording concise and correct.

src/renderer/src/i18n/zh-CN/mcp.json (1)

65-68: ZH-CN i18n: per-line args + addArg/argPlaceholder aligned; looks good.

src/renderer/src/i18n/ja-JP/mcp.json (1)

84-87: JA i18n: keys added; phrasing natural (1行に1つ...).

src/renderer/src/i18n/fr-FR/settings.json (1)

624-627: FR settings i18n: mirrors MCP file; OK.

src/renderer/src/i18n/ja-JP/settings.json (1)

623-626: JA settings i18n: per-line args + addArg/argPlaceholder OK.

src/renderer/src/i18n/pt-BR/settings.json (1)

633-635: LGTM!

The Portuguese translations for the new per-argument input UI are consistent with the English source and align with the UI changes in the Vue component.

src/renderer/src/i18n/en-US/settings.json (1)

633-635: LGTM!

The new i18n keys clearly communicate the per-line argument input paradigm, which properly addresses the issue with arguments containing spaces.

src/renderer/src/i18n/en-US/mcp.json (1)

84-86: LGTM!

The MCP-specific locale keys are consistent with the settings.json translations and properly support the new argument input UI.

src/renderer/src/i18n/pt-BR/mcp.json (1)

84-86: LGTM!

Portuguese translations are consistent with the settings.json counterpart and properly localized.

src/renderer/src/components/mcp-config/mcpServerForm.vue (10)

31-31: LGTM!

Good choice using nanoid for generating unique IDs for argument rows. This ensures stable keys for Vue's list rendering.


52-52: LGTM!

Correctly initializes args with newline-separated values to match the new per-line input format.


98-104: LGTM!

Clean integration with the new setArgsRowsFromArray helper for setting image model arguments.


192-205: LGTM!

Good defensive handling with Array.isArray check and proper branching for buildInFileSystem vs standard argument parsing.


320-346: Well-structured argument row management.

The syncArgsRowsFromString function includes a smart optimization to skip updates when values haven't changed, preventing unnecessary re-renders. The ID-based approach with nanoid ensures stable Vue list rendering.


378-415: Good mutual synchronization with loop prevention.

The watchers correctly synchronize between args, argsRows, and foldersList with guards to prevent infinite loops. The check at line 401 (args.value !== joinedArgs) and the early return in syncArgsRowsFromString (lines 330-335) work together to break potential cycles.


493-499: LGTM!

Proper normalization that filters out empty arguments before submission, ensuring clean server configuration.


612-632: LGTM!

The watch correctly extracts provider and model ID from the new argsRows structure, with proper filtering of empty values before parsing.


644-656: LGTM!

Consistent handling with the JSON parsing logic, properly initializing argsRows or foldersList based on server type.


947-968: Clean UI implementation for per-argument input.

The implementation provides good UX with:

  • Scrollable container (max-h-48 overflow-y-auto) to handle many arguments
  • Clear add/remove actions per row
  • Hidden input preserving the args v-model for existing logic

The design properly addresses the original issue of arguments containing spaces.

@zerob13 zerob13 merged commit 23a3e14 into dev Nov 25, 2025
2 checks passed
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.

[BUG] 关于MCP参数输入框的一个bug

2 participants