Skip to content

feat(mcp): Space instance-sync MCP tool - #274

Merged
rbuergi merged 3 commits into
mainfrom
feat/space-sync-mcp
Jul 5, 2026
Merged

rbuergi merged 3 commits into
mainfrom
feat/space-sync-mcp

Conversation

@rbuergi

@rbuergi rbuergi commented Jul 5, 2026

Copy link
Copy Markdown
Contributor

What

Adds a Sync tool to the meshweaver MCP server (McpMeshPlugin) that configures instance sync for a Space from an agent/assistant: it registers a {space}/_Sync/{id} InstanceSyncConfig node (remote URL, remote token, direction, remote-space id), which starts bi-directional replication with a remote MeshWeaver instance — the same registration the GUI's Synchronizations node-menu item writes.

Why it's safe

The write goes through the caller's session hub (ops.Create(...)), so it runs under the caller's identity and is permission-checked: writing under {space}/_Sync requires Editor (Update) on the Space. Viewers/commenters can't configure sync. No new mutation surface — just the existing Create path with a typed InstanceSyncConfig payload.

Notes

🤖 Generated with Claude Code

Exposes a `Sync` MCP tool that registers a `{space}/_Sync/{id}` InstanceSyncConfig
node (remote URL/token/direction), starting bi-directional replication with a remote
MeshWeaver instance. The write goes through the caller's session hub, so it runs under
the caller's identity and is permission-checked (writing under `_Sync` requires
Editor/Update on the Space) — matching the GUI's Synchronizations node-menu path.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR adds a new MCP tool (Sync) to the meshweaver MCP server (McpMeshPlugin) that programmatically creates an InstanceSyncConfig registration node under {space}/_Sync/{id}, enabling instance sync setup from an agent/assistant. It also wires in the required project reference so the MCP plugin can construct the typed config payload.

Changes:

  • Add MeshWeaver.InstanceSync project reference to MeshWeaver.Blazor.AI.
  • Introduce a new MCP tool Sync(...) that writes an InstanceSyncConfig node via existing ops.Create(...).

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.

File Description
src/MeshWeaver.Blazor.AI/MeshWeaver.Blazor.AI.csproj Adds a reference to MeshWeaver.InstanceSync so the MCP plugin can use InstanceSyncConfig types/constants.
src/MeshWeaver.Blazor.AI/McpMeshPlugin.cs Adds the Sync MCP tool that creates {space}/_Sync/{id} InstanceSyncConfig registration nodes.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/MeshWeaver.Blazor.AI/McpMeshPlugin.cs Outdated
Comment thread src/MeshWeaver.Blazor.AI/McpMeshPlugin.cs
Comment thread src/MeshWeaver.Blazor.AI/McpMeshPlugin.cs Outdated
Comment thread src/MeshWeaver.Blazor.AI/McpMeshPlugin.cs
@github-actions

github-actions Bot commented Jul 5, 2026 •

Copy link
Copy Markdown
Contributor

Test Results (shard 2)

1 112 tests  ±0   1 111 ✅ ±0   6m 34s ⏱️ +12s
   14 suites ±0       1 💤 ±0 
   14 files   ±0       0 ❌ ±0 

Results for commit a801b38. ± Comparison against base commit aaa73da.

♻️ This comment has been updated with latest results.

@github-actions

github-actions Bot commented Jul 5, 2026 •

Copy link
Copy Markdown
Contributor

Test Results (shard 1)

773 tests  +19   593 ✅ +18   3m 1s ⏱️ +23s
 13 suites ± 0   180 💤 + 1 
 13 files   ± 0     0 ❌ ± 0 

Results for commit a801b38. ± Comparison against base commit aaa73da.

This pull request removes 53 and adds 72 tests. Note that renamed tests count towards both.
MeshWeaver.Hosting.Monolith.Test.AgentSyncedQueryFromHostedHubTest ‑ HostedSubHub_GetQuery_AgentDropdownNamesAreNonEmpty
MeshWeaver.Hosting.Monolith.Test.AgentSyncedQueryFromHostedHubTest ‑ HostedSubHub_GetQuery_ReturnsAgentsAndModels
MeshWeaver.Hosting.Monolith.Test.CessionLayoutAreaTest ‑ BusinessRulesDoc_RelativeReference_ResolvesToMotorXL
MeshWeaver.Hosting.Monolith.Test.CessionLayoutAreaTest ‑ Cession_Trace_HubConfiguration
MeshWeaver.Hosting.Monolith.Test.CessionLayoutAreaTest ‑ MotorXL_LayoutArea_ReturnsContent
MeshWeaver.Hosting.Monolith.Test.CessionLayoutAreaTest ‑ MotorXL_Overview_ShouldRender
MeshWeaver.Hosting.Monolith.Test.CessionLayoutAreaTest ‑ MotorXL_PathResolves
MeshWeaver.Hosting.Monolith.Test.CessionLayoutAreaTest ‑ NonExistentPath_Failure
MeshWeaver.Hosting.Monolith.Test.DeleteNodeBehaviorTest ‑ Leaf_Delete_SucceedsAndRemovesNode
MeshWeaver.Hosting.Monolith.Test.DeleteNodeBehaviorTest ‑ Missing_Node_Fails_NotFound
…
MeshWeaver.Hosting.Monolith.Test.AgentChatClientNoSuitableAgentTest ‑ AgentChatClient_OnHostedSubHub_DoesNotReturn_NoSuitableAgent
MeshWeaver.Hosting.Monolith.Test.AgentPickerProjectionPartitionedTest ‑ PartitionedPath_ObserveAgents_FromHostedSubHub_PopulatesCombobox
MeshWeaver.Hosting.Monolith.Test.AgentPickerProjectionPartitionedTest ‑ PartitionedPath_ObserveAgents_PopulatesCombobox
MeshWeaver.Hosting.Monolith.Test.AgentPickerProjectionPartitionedTest ‑ PartitionedPath_ObserveModels_PopulatesCombobox
MeshWeaver.Hosting.Monolith.Test.AgentPickerProjectionTest ‑ ObserveAgents_FromHostedSubHub_PopulatesCombobox
MeshWeaver.Hosting.Monolith.Test.AgentPickerProjectionTest ‑ ObserveAgents_FromMeshHub_PopulatesCombobox
MeshWeaver.Hosting.Monolith.Test.AgentPickerProjectionTest ‑ ObserveAgents_SpaceAndUserSet_SurfacesSpaceAgent_UserAgent_AndPlatform
MeshWeaver.Hosting.Monolith.Test.AgentPickerProjectionTest ‑ ObserveModels_FromHostedSubHub_PopulatesCombobox
MeshWeaver.Hosting.Monolith.Test.AgentPickerProjectionTest ‑ ObserveModels_FromMeshHub_PopulatesCombobox
MeshWeaver.Hosting.Monolith.Test.BrokenNodeTypeAccessTest ‑ AccessingInstance_OfNonCompilingNodeType_AnswersTerminalError_NotSilence
…

♻️ This comment has been updated with latest results.

@github-actions

github-actions Bot commented Jul 5, 2026 •

Copy link
Copy Markdown
Contributor

Test Results (shard 3)

1 739 tests  ±0   1 738 ✅ ±0   7m 3s ⏱️ +4s
   14 suites ±0       1 💤 ±0 
   14 files   ±0       0 ❌ ±0 

Results for commit a801b38. ± Comparison against base commit aaa73da.

♻️ This comment has been updated with latest results.

@github-actions

github-actions Bot commented Jul 5, 2026 •

Copy link
Copy Markdown
Contributor

Test Results (shard 0)

   15 files  ±  0     15 suites  ±0   4m 0s ⏱️ -40s
1 338 tests  - 198  1 337 ✅  - 198  1 💤 ±0  0 ❌ ±0 
1 348 runs   - 227  1 347 ✅  - 227  1 💤 ±0  0 ❌ ±0 

Results for commit a801b38. ± Comparison against base commit aaa73da.

This pull request removes 198 tests.
MeshWeaver.Persistence.Test.DocumentationCodeBlockCompilationTest ‑ ExecutedCsharpBlocks_MustCompile(embeddedResourceName: "MeshWeaver.Documentation.Data.AI.AgenticAI.md")
MeshWeaver.Persistence.Test.DocumentationCodeBlockCompilationTest ‑ ExecutedCsharpBlocks_MustCompile(embeddedResourceName: "MeshWeaver.Documentation.Data.AI.ChatCommands.md")
MeshWeaver.Persistence.Test.DocumentationCodeBlockCompilationTest ‑ ExecutedCsharpBlocks_MustCompile(embeddedResourceName: "MeshWeaver.Documentation.Data.AI.ExecuteScript.md")
MeshWeaver.Persistence.Test.DocumentationCodeBlockCompilationTest ‑ ExecutedCsharpBlocks_MustCompile(embeddedResourceName: "MeshWeaver.Documentation.Data.AI.ExecutiveAssistan"···)
MeshWeaver.Persistence.Test.DocumentationCodeBlockCompilationTest ‑ ExecutedCsharpBlocks_MustCompile(embeddedResourceName: "MeshWeaver.Documentation.Data.AI.McpAuthentication"···)
MeshWeaver.Persistence.Test.DocumentationCodeBlockCompilationTest ‑ ExecutedCsharpBlocks_MustCompile(embeddedResourceName: "MeshWeaver.Documentation.Data.AI.ModelProviderSetu"···)
MeshWeaver.Persistence.Test.DocumentationCodeBlockCompilationTest ‑ ExecutedCsharpBlocks_MustCompile(embeddedResourceName: "MeshWeaver.Documentation.Data.AI.PlatformProviderS"···)
MeshWeaver.Persistence.Test.DocumentationCodeBlockCompilationTest ‑ ExecutedCsharpBlocks_MustCompile(embeddedResourceName: "MeshWeaver.Documentation.Data.AI.ProviderConfigura"···)
MeshWeaver.Persistence.Test.DocumentationCodeBlockCompilationTest ‑ ExecutedCsharpBlocks_MustCompile(embeddedResourceName: "MeshWeaver.Documentation.Data.AI.TeamsBot.md")
MeshWeaver.Persistence.Test.DocumentationCodeBlockCompilationTest ‑ ExecutedCsharpBlocks_MustCompile(embeddedResourceName: "MeshWeaver.Documentation.Data.AI.Tools.MeshPlugin."···)
…

♻️ This comment has been updated with latest results.

@github-actions

github-actions Bot commented Jul 5, 2026 •

Copy link
Copy Markdown
Contributor

Test Results

   56 files  ±  0     56 suites  ±0   20m 40s ⏱️ -2s
4 962 tests  - 179  4 779 ✅  - 180  183 💤 +1  0 ❌ ±0 
4 972 runs   - 208  4 789 ✅  - 209  183 💤 +1  0 ❌ ±0 

Results for commit a801b38. ± Comparison against base commit aaa73da.

This pull request removes 251 and adds 72 tests. Note that renamed tests count towards both.
MeshWeaver.Hosting.Monolith.Test.AgentSyncedQueryFromHostedHubTest ‑ HostedSubHub_GetQuery_AgentDropdownNamesAreNonEmpty
MeshWeaver.Hosting.Monolith.Test.AgentSyncedQueryFromHostedHubTest ‑ HostedSubHub_GetQuery_ReturnsAgentsAndModels
MeshWeaver.Hosting.Monolith.Test.CessionLayoutAreaTest ‑ BusinessRulesDoc_RelativeReference_ResolvesToMotorXL
MeshWeaver.Hosting.Monolith.Test.CessionLayoutAreaTest ‑ Cession_Trace_HubConfiguration
MeshWeaver.Hosting.Monolith.Test.CessionLayoutAreaTest ‑ MotorXL_LayoutArea_ReturnsContent
MeshWeaver.Hosting.Monolith.Test.CessionLayoutAreaTest ‑ MotorXL_Overview_ShouldRender
MeshWeaver.Hosting.Monolith.Test.CessionLayoutAreaTest ‑ MotorXL_PathResolves
MeshWeaver.Hosting.Monolith.Test.CessionLayoutAreaTest ‑ NonExistentPath_Failure
MeshWeaver.Hosting.Monolith.Test.DeleteNodeBehaviorTest ‑ Leaf_Delete_SucceedsAndRemovesNode
MeshWeaver.Hosting.Monolith.Test.DeleteNodeBehaviorTest ‑ Missing_Node_Fails_NotFound
…
MeshWeaver.Hosting.Monolith.Test.AgentChatClientNoSuitableAgentTest ‑ AgentChatClient_OnHostedSubHub_DoesNotReturn_NoSuitableAgent
MeshWeaver.Hosting.Monolith.Test.AgentPickerProjectionPartitionedTest ‑ PartitionedPath_ObserveAgents_FromHostedSubHub_PopulatesCombobox
MeshWeaver.Hosting.Monolith.Test.AgentPickerProjectionPartitionedTest ‑ PartitionedPath_ObserveAgents_PopulatesCombobox
MeshWeaver.Hosting.Monolith.Test.AgentPickerProjectionPartitionedTest ‑ PartitionedPath_ObserveModels_PopulatesCombobox
MeshWeaver.Hosting.Monolith.Test.AgentPickerProjectionTest ‑ ObserveAgents_FromHostedSubHub_PopulatesCombobox
MeshWeaver.Hosting.Monolith.Test.AgentPickerProjectionTest ‑ ObserveAgents_FromMeshHub_PopulatesCombobox
MeshWeaver.Hosting.Monolith.Test.AgentPickerProjectionTest ‑ ObserveAgents_SpaceAndUserSet_SurfacesSpaceAgent_UserAgent_AndPlatform
MeshWeaver.Hosting.Monolith.Test.AgentPickerProjectionTest ‑ ObserveModels_FromHostedSubHub_PopulatesCombobox
MeshWeaver.Hosting.Monolith.Test.AgentPickerProjectionTest ‑ ObserveModels_FromMeshHub_PopulatesCombobox
MeshWeaver.Hosting.Monolith.Test.BrokenNodeTypeAccessTest ‑ AccessingInstance_OfNonCompilingNodeType_AnswersTerminalError_NotSilence
…

♻️ This comment has been updated with latest results.

rbuergi and others added 2 commits July 5, 2026 20:59
- Not Idempotent: ops.Create errors if {space}/_Sync/{id} already exists, so a retry
  fails rather than being a safe no-op — the attribute now reflects that.
- Reject a nested `space`: instance sync only activates a registration at {space}/_Sync/{id}
  with a single top-level {space}; a nested path was silently written and never picked up.
- Use InstanceSyncService.SanitizeSourceId (now public, case-preserving) instead of a
  lower-cased copy, so GUI ("Partner") and MCP produce the SAME id — no duplicate
  registration differing only by casing.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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.

2 participants