Commit Graph

396 Commits

Author SHA1 Message Date
ZyphrZero
3b6048b1e8 feat(config): migrate app_config_dir to Tauri Store for independent management (#109) 2025-10-15 09:15:53 +08:00
Sirhexs
3e4df2c96a feat: add provider usage query with JavaScript scripting support (#101)
* feat: add provider usage query functionality

- Updated `Cargo.toml` to include `regex` and `rquickjs` dependencies for usage script execution.
- Implemented `query_provider_usage` command in `commands.rs` to handle usage queries.
- Created `UsageScript` and `UsageData` structs in `provider.rs` for managing usage script configurations and results.
- Added `execute_usage_script` function in `usage_script.rs` to run user-defined scripts for querying usage.
- Enhanced `ProviderList` component to include a button for configuring usage scripts and a modal for editing scripts.
- Introduced `UsageFooter` component to display usage information and status.
- Added `UsageScriptModal` for editing and testing usage scripts with preset templates.
- Updated Tauri API to support querying provider usage.
- Modified types in `types.ts` to include structures for usage scripts and results.

* feat(usage): support multi-plan usage display for providers

- 【Feature】
  - Update `UsageResult` to support an array of `UsageData` for displaying multiple usage plans per provider.
  - Refactor `query_provider_usage` command to parse both single `UsageData` objects (for backward compatibility) and arrays of `UsageData`.
  - Enhance `usage_script` validation to accept either a single usage object or an array of usage objects.
- 【Frontend】
  - Redesign `UsageFooter` to iterate and display details for all available usage plans, introducing `UsagePlanItem` for individual plan rendering.
  - Improve usage display with color-coded remaining balance and clear plan information.
  - Update `UsageScriptModal` test notification to summarize all returned plans.
  - Remove redundant `isCurrent` prop from `UsageFooter` in `ProviderList`.
- 【Build】
  - Change frontend development server port from `3000` to `3005` in `tauri.conf.json` and `vite.config.mts`.

* feat(usage): enhance query flexibility and display
- 【`src/types.ts`, `src-tauri/src/provider.rs`】Make `UsageData` fields optional and introduce `extra` and `invalidMessage` for more flexible reporting.
  - `expiresAt` replaced by generic `extra` field.
  - `isValid`, `remaining`, `unit` are now optional.
  - Added `invalidMessage` to provide specific reasons for invalid status.
- 【`src-tauri/src/usage_script.rs`】Relax usage script result validation to accommodate optional fields in `UsageData`.
- 【`src/components/UsageFooter.tsx`】Update UI to display `extra` field and `invalidMessage`, and conditionally render `remaining` and `unit` based on availability.
- 【`src/components/UsageScriptModal.tsx`】
  - Add a new `NewAPI` preset template demonstrating advanced extractor logic for complex API responses.
  - Update script instructions to reflect optional fields and new variable syntax (`{{apiKey}}`).
  - Remove old "DeepSeek" and "OpenAI" templates.
  - Remove basic syntax check for `return` statement.
- 【`.vscode/settings.json`】Add `dish-ai-commit.base.language` setting.
- 【`src-tauri/src/commands.rs`】Adjust usage logging to handle optional `remaining` and `unit` fields.

* chore(config): remove VS Code settings from version control

- delete .vscode/settings.json to remove editor-specific configurations
- add /.vscode to .gitignore to prevent tracking of local VS Code settings
- ensure personalized editor preferences are not committed to the repository

* fix(provider): preserve usage script during provider update

- When updating a provider, the `usage_script` configuration within `ProviderMeta` was not explicitly merged.
- This could lead to the accidental loss of `usage_script` settings if the incoming `provider` object in the update request did not contain this field.
- Ensure `usage_script` is cloned from the existing provider's meta when merging `ProviderMeta` during an update.

* refactor(provider): enforce base_url for usage scripts and update dev ports
- 【Backend】
    - `src-tauri/src/commands.rs`: Made `ANTHROPIC_BASE_URL` a required field for Claude providers and `base_url` a required field in `config.toml` for Codex providers when extracting credentials for usage script execution. This improves error handling by explicitly failing if these critical URLs are missing or malformed.
- 【Frontend】
    - `src/App.tsx`, `src/components/ProviderList.tsx`: Passed `appType` prop to `ProviderList` component to ensure `updateProvider` calls within `handleSaveUsageScript` correctly identify the application type.
- 【Config】
    - `src-tauri/tauri.conf.json`, `vite.config.mts`: Updated development server ports from `3005` to `3000` to standardize local development environment.

* refactor(usage): improve usage data fetching logic

- Prevent redundant API calls by tracking last fetched parameters in `useEffect`.
- Avoid concurrent API requests by adding a guard in `fetchUsage`.
- Clear usage data and last fetch parameters when usage query is disabled.
- Add `queryProviderUsage` API declaration to `window.api` interface.

* fix(usage-script): ensure usage script updates and improve reactivity

- correctly update `usage_script` from new provider meta during updates
- replace full page reload with targeted provider data refresh after saving usage script settings
- trigger usage data fetch or clear when `usageEnabled` status changes in `UsageFooter`
- reduce logging verbosity for usage script execution in backend commands and script execution

* style(usage-footer): adjust usage plan item layout

- Decrease width of extra field column from 35% to 30%
- Increase width of usage information column from 40% to 45%
- Improve visual balance and readability of usage plan items
2025-10-15 09:15:25 +08:00
Jason
59644b29e6 chore: bump version to 3.5.1 v3.5.1 2025-10-14 10:39:11 +08:00
Jason
5427ae04e4 feat(mcp): add overwrite warning and improve sync option visibility
- Move sync checkbox to footer alongside save/cancel buttons for better visibility
- Add real-time conflict detection to check for duplicate MCP IDs on other side
- Display amber warning icon when sync would overwrite existing config
- Add i18n keys for overwrite warning (zh: "将覆盖 {{target}} 中的同名配置")
- Update UI layout to use justify-between for better spacing
2025-10-14 10:22:57 +08:00
Jason
a2aa5f8434 feat(mcp): add option to mirror MCP config to other app
- Add syncOtherSide parameter to upsert_mcp_server_in_config command
- Implement checkbox UI in McpFormModal for cross-app sync
- Automatically sync enabled MCP servers to both Claude and Codex when option is checked
- Add i18n support for sync option labels and hints
2025-10-14 00:22:15 +08:00
Jason
06010ff78e feat(mcp): pre-fill wizard with existing configuration
Allow MCP wizard to load and edit existing server configuration:
- Parse current config (JSON/TOML) and pass to wizard as initial data
- Auto-detect server type (stdio/http) and populate form fields
- Convert objects (env/headers) to multi-line text format for editing
- Improves UX by avoiding manual re-entry of existing settings
2025-10-13 23:37:33 +08:00
Jason
e77eab2116 feat(mcp): auto-sync enabled MCP servers to app config on upsert
When upserting an MCP server that is enabled, automatically sync it to the corresponding app's live configuration (Claude or Codex) without requiring manual action.
2025-10-13 23:22:21 +08:00
Jason
ed9dd7bbc3 docs: update main interface screenshot 2025-10-13 11:38:29 +08:00
Jason
3d20245a80 docs: update README for v3.5.0 release
- Add v3.5.0 feature highlights (MCP management, import/export, speed testing)
- Update feature list section to v3.5.0
- Fix macOS download filename to .tar.gz (standardized naming)
- Add refactoring notice in contribution section
2025-10-13 11:30:23 +08:00
Jason
f55c6d3d91 chore: standardize release artifact naming with version tags
- Update GitHub Actions to generate version-tagged filenames
- macOS: CC-Switch-v{version}-macOS.tar.gz / .zip
- Windows: CC-Switch-v{version}-Windows.msi / -Portable.zip
- Linux: CC-Switch-v{version}-Linux.AppImage / .deb
- Update README installation instructions with new filename format
- Add naming standardization note to CHANGELOG v3.5.0
v3.5.0
2025-10-12 23:17:05 +08:00
Jason
ec83e2ca44 docs: add Homebrew installation instructions 2025-10-12 22:38:47 +08:00
Jason
60e8351f60 chore: bump version to v3.5.0 and update roadmap
Version Changes:
- Update version to 3.5.0 in package.json, Cargo.toml, and tauri.conf.json

Changelog Updates:
- Add v3.5.0 release notes with comprehensive feature list
- Document MCP management system implementation
- Document configuration import/export functionality
- Document endpoint speed testing feature
- List all improvements, bug fixes, and technical enhancements

Roadmap Updates:
- Mark MCP manager as completed 
- Mark i18n (internationalization) as completed 
- Add new planned features: memory management, cloud sync
- Reorganize feature priorities
2025-10-12 22:27:02 +08:00
Jason
4a9eb64f76 feat: add Longcat provider and update GLM model version
- Add Longcat provider preset with Flash-Chat model configuration
- Update mainModelPlaceholder from GLM-4.5 to GLM-4.6 in i18n files
- Configure Longcat with max output tokens (6000) and disabled non-essential traffic
2025-10-12 21:31:38 +08:00
Jason
66bbf63300 feat(ui): add endpoint format hint for Codex providers
Add informational hint below Codex API endpoint input field to guide users
to fill in OpenAI Response compatible service endpoints, similar to the
existing hint for Claude providers.
2025-10-12 19:58:40 +08:00
Jason
6e2c80531d refactor: improve code quality and fix linting issues
- Derive Default trait instead of manual implementation for McpRoot and ProviderManager
- Remove redundant closures in codex_config.rs and config.rs
- Simplify match statements to if let patterns in migration.rs and lib.rs
- Remove unnecessary type conversions and borrows in lib.rs
- Fix i18n key inconsistency: sequentialThinking → sequential-thinking
- Format TypeScript files to match Prettier style

All clippy warnings resolved, code passes all quality checks.
2025-10-12 16:52:32 +08:00
Jason
2ec0a10a2c feat(i18n): complete internationalization for MCP preset descriptions
- Add i18n keys for all 5 MCP preset descriptions (fetch, time, memory, sequential-thinking, context7)
- Refactor mcpPresets.ts to use i18n keys instead of hardcoded Chinese descriptions
- Add getMcpPresetWithDescription() helper function for dynamic translation
- Update McpFormModal to use translated descriptions when applying presets
- Fix inconsistent key naming: sequentialThinking -> sequential-thinking

This ensures MCP preset descriptions automatically switch language based on user's locale setting.
2025-10-12 16:34:32 +08:00
Jason
e92d99b758 feat(mcp): add automatic key normalization for server entries
- Add normalize_server_keys() to ensure MCP server map keys match internal id fields
- Auto-normalize on all read/write operations (get, upsert, delete, import, sync)
- Handle edge cases: empty/whitespace ids, key renaming, conflict resolution
- Auto-save config when normalization detects changes
- Apply cargo fmt for code formatting consistency

This enhancement improves data integrity by automatically fixing inconsistencies
between server entry keys and their id fields, especially after manual config edits.
2025-10-12 16:21:32 +08:00
Jason
036d41b774 fix(ui): vertically center action buttons in provider list
Change the flex alignment from items-start to items-center in the provider card layout to ensure the action buttons (Enable, Edit, Delete) are vertically centered relative to the provider information.
2025-10-12 13:17:38 +08:00
Jason
3bd70b9508 feat(mcp): add enabled count to panel info section
- Add enabledCount calculation using useMemo for performance
- Display format: "X MCP server(s) configured · Y enabled"
- Add i18n keys: mcp.enabledCount for zh and en
- Real-time updates when toggling server enabled status
2025-10-12 12:16:15 +08:00
Jason
664efc7456 chore(mcp): update presets for time and context7 servers
Updates MCP preset configurations with accurate information:

- time preset: Remove "completely no config needed" claim for clarity
- context7 preset: Update package name from @context7/mcp-server to @upstash/context7-mcp
- context7 preset: Update description to mention API key provides higher quota
- context7 preset: Update docs URL to new GitHub repository location

These changes reflect the latest upstream changes and package migrations.
2025-10-12 11:31:36 +08:00
Jason
1415ef4d78 feat(mcp): add collapsible additional info section in form modal
Improves UX by collapsing optional metadata fields (description, tags, homepage, docs) behind an expandable "Additional Info" section.

Changes:
- Add collapsible section with ChevronUp/ChevronDown icons
- Smart default state: collapsed for new entries, expanded for existing entries with metadata
- Add i18n keys: mcp.form.additionalInfo (zh: "附加信息", en: "Additional Info")
- Keep core fields (ID, name, config) always visible for better focus

Benefits:
- Cleaner, less cluttered form interface
- Users can focus on essential configuration first
- Optional metadata easily accessible when needed
2025-10-12 11:01:49 +08:00
Jason
fb137c4a78 refactor(mcp): improve data structure with metadata/spec separation
- Separate MCP server metadata from connection spec for cleaner architecture
- Add comprehensive server entry fields: name, description, tags, homepage, docs
- Remove legacy format compatibility logic from extract_server_spec
- Implement data validation and filtering in get_servers_snapshot_for
- Add strict id consistency check in upsert_in_config_for
- Enhance import logic with defensive programming for corrupted data
- Simplify frontend by removing normalization logic (moved to backend)
- Improve error messages with contextual information
- Add comprehensive i18n support for new metadata fields
2025-10-12 00:08:37 +08:00
Jason
668ab710c6 fix: preserve codex mcp metadata 2025-10-11 16:35:51 +08:00
Jason
ea7080a42e fix(mcp): improve error message internationalization
- Add translateMcpBackendError utility to map backend errors to i18n keys
- Update error handling in McpPanel, McpFormModal, and McpWizardModal
- Internationalize stdio/http type selectors in Wizard
- Implement three-tier fallback strategy: translation → raw error → default message
- No backend changes required, fully frontend-based i18n implementation
2025-10-11 16:20:12 +08:00
Jason
c2b27a4949 fix(app): eliminate startup white screen by replacing @iarna/toml with browser-friendly smol-toml
- chore(deps): switch TOML dependency from @iarna/toml to smol-toml and update lockfile
- feat(mcp): add TOML editing/validation for Codex while keeping JSON for Claude; support auto ID extraction from TOML and JSON->TOML conversion for wizard output; add pre-submit required checks (stdio.command / http.url)
- refactor(mcp): unify JSON/TOML validation errors via i18n; add formatTomlError for consistent, localized messages; consolidate state into formConfig/configError
- feat(i18n): add TOML labels/placeholders and error keys (tomlConfig, tomlPlaceholder, tomlInvalid)
- feat(utils): introduce tomlUtils with parse/stringify/validate/convert helpers using smol-toml; provide tomlToMcpServer, mcpServerToToml, extractIdFromToml, validateToml
- build: confirm Vite no longer externalizes Node builtins during build; renderer builds without 'Module 'stream' has been externalized' warning
2025-10-11 15:34:58 +08:00
Jason
a6ee3ba35f feat(mcp): enhance wizard with title field and optimize placeholders
- Add MCP title field to wizard (required)
- Remove working directory (cwd) field and related logic
- Update wizard callback to return both title and JSON
- Optimize placeholder text for better user guidance:
  - Command: "npx or uvx"
  - Args: "arg1\narg2"
  - Env: "KEY1=value1\nKEY2=value2"
  - Headers: "Authorization: Bearer your_token_here\n..."
- Simplify args label by removing "(one per line)" hint
- Update parent component to handle title from wizard
2025-10-11 11:43:32 +08:00
Jason
2a60d20841 fix: align Tauri arg names and improve export UX
- Match frontend camelCase keys to backend snake_case params
- Show error toast when save dialog is cancelled
2025-10-11 11:10:03 +08:00
Jason
42329d4dce fix(mcp): prevent wizard height jump when switching types
- Add min-h-[400px] to form fields container
- Ensures consistent height between stdio and http modes
- Eliminates visual jump when toggling between types
2025-10-11 10:15:40 +08:00
Jason
5013d3b4c9 feat(mcp): show wizard button only in custom mode
- Hide 'Use Configuration Wizard' button when preset MCP is selected
- Show wizard button only in custom mode or edit mode
- Prevents user confusion by avoiding wizard access when preset configs are loaded
2025-10-11 09:55:54 +08:00
Jason
9ba9cddf18 feat(mcp): unify preset button styles with emerald theme
- Update MCP preset selector to match provider form layout
- Change button size from xs to sm (px-4 py-2) for consistency
- Use emerald-500/600 for selected state (MCP brand color)
- Add preset description text below buttons
- Fix cancel button hover effect in footer (gray-200/gray-700)
- Fix missing space in zh i18n: "应用到 Claude Code 插件"
2025-10-11 09:22:33 +08:00
Jason
81356cacee feat(mcp): unify modal styles and add footer with done button
- Unify McpFormModal width to max-w-3xl (consistent with provider form)
- Add scrollable container with max-h-[90vh] to McpFormModal
- Add footer section to both McpFormModal and McpPanel
- Add "Done" button with emerald theme and check icon to McpPanel footer
- Add i18n keys for "common.done" (zh: "完成", en: "Done")
- Apply consistent footer styling across all modals
2025-10-10 23:57:38 +08:00
Jason
3b142155c3 fix(mcp): eliminate panel flicker on toggle with optimistic updates
- Add fixed height (h-16) to MCP list items for visual consistency
- Implement optimistic UI updates in handleToggle to prevent flicker
- Remove reload() call that caused loading state transitions
- Add automatic rollback on API failure with error notifications
2025-10-10 23:23:40 +08:00
Jason
4543664ba2 refactor(mcp): remove installed preset badge and env-related preset logic
- Move MCP presets into Add modal, no auto-seeding into list
- Replace env-required presets with context7 (no env needed)
- Remove requiresEnv checks/prompts from list and form
- Keep Docs button; maintain clean list UI
2025-10-10 22:34:38 +08:00
Jason
e88562be98 - feat(mcp): unify notifications via onNotify in form and wizard
- refactor(mcp): remove HTML5 required to avoid native popups

- refactor(ui): propagate onNotify from App → McpPanel → McpFormModal → McpWizardModal

- feat(settings): use onNotify for export and file-selection feedback

- fix(ui): notify link-open failures via onNotify; remove unused appType prop from ProviderList

- chore: format codebase and ensure typecheck passes
2025-10-10 20:52:16 +08:00
Jason
bfdf7d4ad5 fix: preserve meta.custom_endpoints on update and persist preset candidates on create
- Preserve and merge meta.custom_endpoints in update_provider to avoid losing custom endpoints added via Tauri commands during edit/save. Merge old and incoming meta; keep existing entries and timestamps, add new URLs only.
- Persist endpoint candidates when creating a provider: union of user-added custom endpoints, selected base URL (Claude/Codex), and preset.endpointCandidates; normalize and de-duplicate. Ensures PackyCode keeps all 5 nodes after saving.

Files:
- src-tauri/src/commands.rs
- src/components/ProviderForm.tsx

Validation:
- cargo check passes
- Manual: create from PackyCode preset -> save -> reopen edit -> Manage & Test lists all preset nodes; edit existing provider -> add endpoint -> save -> reopen -> endpoint persists.
2025-10-10 20:20:08 +08:00
Jason
c350e64687 feat(settings): add 'Apply to Claude Code extension' toggle
- Apply immediately on save (write or remove primaryApiKey)
- Honor setting on provider switch (enabled: write for non-official, remove for official; disabled: no auto writes)
- Remove per-provider Claude plugin buttons from ProviderList
- Upsert primaryApiKey=any preserving other fields; respect override dir
- Add zh/en i18n for the new setting
2025-10-10 16:35:21 +08:00
Jason
70d8d2cc43 feat(codex): add requires_openai_auth flag to provider config template
Add requires_openai_auth = true to the generated config.toml template
for custom Codex providers to ensure proper authentication handling.
2025-10-10 16:00:12 +08:00
Jason
56b2681a6f feat(provider): use live config for edit and backfill SSOT after switch
- Edit modal (Claude+Codex): when editing the current provider, initialize form from live files (Claude: ~/.claude/settings.json; Codex: ~/.codex/auth.json + ~/.codex/config.toml) instead of SSOT.
- Switch (Claude): after writing live settings.json for the target provider, read it back and update the provider’s SSOT to match live.
- Switch (Codex): keep MCP sync to config.toml, then read back TOML and update the target provider’s SSOT (preserves mcp.servers/mcp_servers schema).
- Add Tauri command read_live_provider_settings for both apps, register handler, and expose window.api.getLiveProviderSettings.
- Types updated accordingly; cargo check and pnpm typecheck pass.
2025-10-10 15:47:57 +08:00
Jason
6cf7dacd0e feat(mcp): import Codex MCP from ~/.codex/config.toml
- Support both TOML schemas: [mcp.servers.<id>] and [mcp_servers.<id>]
- Non-destructive merge of imported servers (enabled=true only)
- Preserve existing TOML schema when syncing (prefer mcp_servers)
- Remove both mcp and mcp_servers when no enabled items

feat(ui): auto-import Codex MCP on panel init (app=codex)

chore(tauri): add import_mcp_from_codex command and register

chore(types): expose window.api.importMcpFromCodex and typings

fix(ui): remove unused variable for typecheck
2025-10-10 14:59:02 +08:00
Jason
428369cae0 feat(mcp): app-aware MCP panel and Codex MCP sync to config.toml
- Make MCP panel app-aware; pass appType from App and call APIs with current app
- Show active app in title: “MCP Management · Claude Code/Codex”
- Add sync_enabled_to_codex: project enabled servers from SSOT to ~/.codex/config.toml as [mcp.servers.*]
- Sync on enable/disable, delete, and provider switch (post live write)
- Add Tauri command sync_enabled_mcp_to_codex and expose window.api.syncEnabledMcpToCodex()
- Fix Rust borrow scopes in switch_provider to avoid E0502
- Add TS declarations for new Codex sync API
2025-10-10 12:35:02 +08:00
Jason
7f1131dfae refactor(mcp): improve UI consistency and i18n
- Add MCP-specific green button style (buttonStyles.mcp)
- Unify MCP panel and form buttons with emerald theme
- Adjust MCP entry button width to match AppSwitcher (px-3)
- Reduce JSON editor height from h-64 to h-48
- Update translations: "Add/Edit Server" → "Add/Edit MCP"
- Change form label to "MCP Title (Unique)" for clarity
- Move config wizard button to right side of JSON label
- Fix McpListItem enabled state check (explicit true check)
2025-10-10 11:58:40 +08:00
Jason
7493f3f9dd feat(mcp): show inline duplicate ID error and block submit in add mode
- Display red hint next to title when ID exists

- Disable Add/Save button and prevent submit on duplicate

- Accept existing IDs via prop for real-time validation

- Remove overwrite confirmation dialog on add

- i18n: add duplicate-ID error strings and remove unused overwrite prompt

- files:

  - src/components/mcp/McpFormModal.tsx

  - src/components/mcp/McpPanel.tsx

  - src/i18n/locales/en.json

  - src/i18n/locales/zh.json
2025-10-10 11:17:40 +08:00
Jason
eb8d9352c8 fix(mcp): properly save and display description field
- Initialize formDescription from initialData.description when editing
- Save formDescription to server object before submitting
- Display only description in list items, hide technical details
- Show empty space when description is not available
2025-10-09 23:13:33 +08:00
Jason
29b8d5edde refactor(mcp): optimize panel UI dimensions and simplify state
- Reduce max width from 4xl (896px) to 3xl (768px)
- Adjust max height from 90vh to 85vh with min-height 600px
- Remove config path display, keep only server count
- Remove McpStatus state, calculate count directly from servers
- Simplify reload function by removing redundant status updates
2025-10-09 22:56:03 +08:00
Jason
97d81c13b7 chore(mcp): clear built-in MCP presets; keep logic intact
- Remove sample presets from  while preserving seeding/display logic
- Add inline notes for future preset/hidden strategy and per-client (claude/codex) split
- Make preset seeding a no-op with empty list; no behavior change elsewhere
- Verified
> cc-switch@3.4.0 typecheck /Users/jasonyoung/Code/cc-switch
> tsc --noEmit passes; UI reads/writes continue to work
2025-10-09 22:20:15 +08:00
Jason
511980e3ea fix(mcp): remove SSE support; keep stdio default when type is omitted
- Backend: reject "sse" in validators; accept missing type as stdio; require url only for http (mcp.rs, claude_mcp.rs)
- Frontend: McpServer.type narrowed to "stdio" | "http" (optional) (src/types.ts)
- UI: avoid undefined in list item details (McpListItem)
- Claude-only sync after delete to update ~/.claude.json (commands.rs)

Notes:
- Ran typecheck and cargo check: both pass
- Clippy shows advisory warnings unrelated to this change
- Prettier check warns on a few files; limited scope changes kept minimal
2025-10-09 22:02:56 +08:00
Jason
f6bf8611cd feat(mcp): use project config as SSOT and sync enabled servers to ~/.claude.json
- Add McpConfig to MultiAppConfig and persist MCP servers in ~/.cc-switch/config.json
- Add Tauri commands: get_mcp_config, upsert_mcp_server_in_config, delete_mcp_server_in_config, set_mcp_enabled, sync_enabled_mcp_to_claude, import_mcp_from_claude
- Only write enabled MCPs to ~/.claude.json (mcpServers) and strip UI-only fields (enabled/source)
- Frontend: update API wrappers and MCP panel to read/write via config.json; seed presets on first open; import from ~/.claude.json
- Fix warnings (remove unused mut, dead code)
- Verified with cargo check and pnpm typecheck
2025-10-09 21:08:42 +08:00
Jason
0be596afb5 feat(mcp): inline presets in panel with one-click enable
- Show not-installed MCP presets directly in the list, consistent with existing UI (no modal)
- Toggle now supports enabling presets by writing to ~/.claude.json (mcpServers) and refreshing list
- Keep installed MCP entries unchanged (edit/delete/toggle)

fix(mcp): robust error handling and pre-submit validation

- Use extractErrorMessage in MCP panel and form to surface backend details
- Prevent pasting full config (with mcpServers) into single-server JSON field
- Add required-field checks: stdio requires non-empty command; http requires non-empty url

i18n: add messages for single-server validation and preset labels

chore: add data-only MCP presets file (no new dependencies)
2025-10-09 17:21:03 +08:00
Jason
2bb847cb3d fix(mcp): improve error handling and notification visibility
- Increase notification z-index to z-[80] to prevent overlay issues
- Make MCP save operation async with proper error propagation
- Display specific backend error messages in form validation
- Ensure errors are visible in both form and panel layers
2025-10-09 16:44:28 +08:00
Jason
9471cb0d19 fix(mcp): update MCP wizard to support http type and improve args input
- Replace deprecated 'sse' type with 'http' (as per Claude Code official docs)
- Add HTTP-specific fields: url (required) and headers (optional)
- Implement dynamic UI: show different fields based on selected type
- Improve args input: support multi-line input (one argument per line)
- Add headers parsing supporting both 'KEY: VALUE' and 'KEY=VALUE' formats
- Update backend validation to enforce type-specific required fields
- Update i18n translations (zh/en) with new HTTP-related labels
2025-10-09 12:04:37 +08:00