Skip to content

feat(migration): add McpServerMigrator for v2 data migration#13303

Open
DeJeune wants to merge 4 commits intov2from
DeJeune/migrate-mcp-sqlite
Open

feat(migration): add McpServerMigrator for v2 data migration#13303
DeJeune wants to merge 4 commits intov2from
DeJeune/migrate-mcp-sqlite

Conversation

@DeJeune
Copy link
Collaborator

@DeJeune DeJeune commented Mar 8, 2026

What this PR does

Before this PR:

MCP server configurations (user-installed and builtin servers) are stored only in Redux (localStorage), with no SQLite migration path for the v2 architecture.

After this PR:

MCP server data is migrated from Redux state.mcp.servers into a new mcp_server SQLite table as part of the v2 migration pipeline. Runtime flags (isUvInstalled, isBunInstalled) are intentionally skipped as they are re-detected at startup.

image

Why we need it and why it was done in this way

This is part of the v2 data layer refactoring that replaces Redux with SQLite. The MCP server configuration is user data that must be preserved across the migration.

The following tradeoffs were made:

  • All 28 MCPServer fields are mapped 1:1 to SQLite columns (no renames) to keep the migration simple and reversible.
  • JSON columns (text({ mode: 'json' })) are used for complex fields (args, env, headers, tags, etc.) rather than normalized tables, matching the existing data shape.
  • Runtime detection flags (isUvInstalled, isBunInstalled) are excluded since they belong in CacheService.

The following alternatives were considered:

  • Normalizing array/object fields into separate tables — rejected as over-engineering for this data volume.

Breaking changes

None. This is a migration-only change with no impact on existing functionality.

Special notes for your reviewer

  • The ReduxExporter.SLICES_TO_EXPORT was missing 'mcp', which caused the MCP slice to never be exported to Main process. This was a gap in the existing migration infrastructure that this PR fixes.
  • The v2-migrator skill has been updated to include the ReduxExporter registration step in its checklist.
  • 17 new tests cover transform functions (6) and migrator phases (11).

Checklist

Release note

NONE

DeJeune and others added 3 commits March 8, 2026 11:02
…derer)

Add three skills to guide the v2 data layer migration lifecycle:
- v2-migrator: Redux/Dexie/ElectronStore → SQLite migration with TDD
- v2-data-api: Main-process Handler→Service→Repository architecture
- v2-renderer: Renderer hooks (useQuery, usePreference, useCache)

Includes cross-domain reference guidance, FK design patterns,
cache tier selection, and cross-category migration examples.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Migrate MCP server configurations from Redux (state.mcp.servers)
to SQLite mcp_server table. Runtime flags (isUvInstalled,
isBunInstalled) are skipped as they are re-detected at startup.

- Create mcp_server SQLite schema with Drizzle ORM
- Implement McpServerMigrator (prepare/execute/validate)
- Add transform functions with full test coverage (17 tests)
- Register in migration pipeline (order=2)
- Add 'mcp' to ReduxExporter SLICES_TO_EXPORT
- Update v2-migrator skill with ReduxExporter step

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@DeJeune DeJeune requested a review from a team March 8, 2026 08:04
@DeJeune DeJeune requested a review from 0xfullex as a code owner March 8, 2026 08:04
@DeJeune DeJeune requested review from eeee0717 and kangfenmao March 8, 2026 08:08
@DeJeune DeJeune added this to the v2.0.0 milestone Mar 8, 2026
@DeJeune DeJeune added the v2 label Mar 8, 2026
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@EurFelux
Copy link
Collaborator

EurFelux commented Mar 8, 2026

Note

This issue/comment/review was translated by Claude.

The settings table also stores MCP servers pulled from the cloud of various providers, consider how to handle this


Original Content

settings表中还储存了从各个provider云端拉取的mcp servers,考虑一下如何处理吧

@DeJeune
Copy link
Collaborator Author

DeJeune commented Mar 8, 2026

Note

This issue/comment/review was translated by Claude.

I can't find the relevant code, I have MCP servers pulled from the cloud in this table


Original Content

我搜不到相关代码,我现在这个表中就有云端拉取的mcp servers


The settings table also stores MCP servers pulled from the cloud of various providers, consider how to handle this

@EurFelux
Copy link
Collaborator

EurFelux commented Mar 8, 2026

await db.settings.put({ id: dbKey, value: servers })

Note

This issue/comment/review was translated by Claude.

This data is all in the cloud. We can fetch it again even without migration, so it's not a big issue.


Original Content

这部分数据都在云端,不迁移也可以再fetch一次,倒是问题不大

@DeJeune
Copy link
Collaborator Author

DeJeune commented Mar 8, 2026

Note

This issue/comment/review was translated by Claude.

ok, please submit a new pr


Original Content

ok,重新提个pr吧

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants