Skip to content

feat(mcp): AI-oriented MCP tools and Claude Code plugin - #14

Merged
xiaolai merged 17 commits into
mainfrom
feat/ai-oriented-mcp-tools
Jan 28, 2026
Merged

feat(mcp): AI-oriented MCP tools and Claude Code plugin#14
xiaolai merged 17 commits into
mainfrom
feat/ai-oriented-mcp-tools

Conversation

@xiaolai

@xiaolai xiaolai commented Jan 28, 2026

Copy link
Copy Markdown
Owner

Summary

Major overhaul of the VMark MCP server to be AI-oriented, plus a comprehensive Claude Code skill for interacting with VMark.

What's Changed

MCP Server Enhancements

  • Protocol tools: get_capabilities, get_document_revision for discovery and concurrency
  • Structure tools: get_document_ast, get_document_digest, list_blocks, get_section, resolve_targets
  • Mutation tools: batch_edit, apply_diff, replace_text_anchored with suggestion/dryRun modes
  • Section tools: update_section, insert_section, move_section
  • Batch operations: table_modify, list_modify for atomic multi-operation support

Claude Code Plugin

New plugin structure for distribution via Claude Code marketplace:

.claude-plugin/
├── plugin.json          # Plugin metadata
└── marketplace.json     # Self-hosted marketplace registry

plugins/vmark-mcp/
├── README.md
└── skills/vmark-mcp/
    ├── SKILL.md                    # Core principles & workflows
    └── references/
        ├── tools-by-intent.md      # Intent → tool mapping
        ├── workflows.md            # 9 step-by-step patterns
        └── examples.md             # Real tool call examples

CI/CD Automation

  • Marketplace sync workflow: Auto-PRs to every-marketplace on release
  • Release workflow now triggers both Homebrew tap update AND marketplace sync

Other Changes

  • MCP health check UI in settings
  • Documentation updates for MCP setup and tools
  • Type consolidation and cleanup

Key Design Decisions

Decision Rationale
Suggestion mode default Writers want collaboration, not automation
Read-before-write pattern Always understand document before modifying
Revision-based concurrency Handle conflicts when document changes
Self-hosted marketplace Immediate availability without external approval

Test Plan

  • MCP tools work in Claude Code / Claude Desktop
  • Suggestion mode creates reviewable suggestions
  • Health check shows correct server status
  • Release workflow triggers all downstream jobs
  • Plugin installable via claude marketplace add github:xiaolai/vmark

Add comprehensive AI-oriented tools following the spec in dev-docs/ai-oriented-mcp-design.md:

Phase 0 - Protocol Foundation:
- Revision tracking system with optimistic concurrency control
- Idempotency cache for request deduplication (5-min TTL)
- get_capabilities and get_document_revision tools

Phase 1 - Structure Layer:
- get_document_ast with projections and filtering
- get_document_digest for quick document overview
- list_blocks for querying blocks by type/content
- resolve_targets for pre-flight disambiguation
- get_section for section-level access

Phase 2 - Declarative Mutations:
- batch_edit for atomic multi-operation edits
- apply_diff for smart find/replace with match policies
- replace_text_anchored for drift-tolerant replacements

Phase 3 - Higher Abstractions:
- Section operations (update, insert, move)
- Table batch operations (add/delete rows/columns, update cells)
- List batch operations (add/delete items, reorder, toggle checks)

All tools support three modes: apply, suggest, dryRun.
Integrates with existing suggestion system for user approval workflow.
Remove 5 AI-powered tools that required external AI service integration:
- fix_grammar
- improve_writing
- translate
- summarize
- expand

These were stubbed but never implemented.
- Fix apply_diff to use proper ProseMirror positions instead of textContent
  offsets, which caused wrong replacements in multi-block documents
- Fix batch_edit to resolve nodeId to PM positions instead of using cursor,
  making operations deterministic and matching the API contract
- Add validation for nth parameter: must be non-negative integer when
  matchPolicy="nth"
- Add findTextMatches(), resolveNodeId(), getTextRange() helpers in utils.ts
- Add --version flag to print version and exit
- Add --health-check flag to validate binary functionality:
  - Imports server module successfully
  - Lists all registered tools and resources
  - Validates tool schema structure
- Update release workflow to run health checks after building
  sidecar for macOS, Windows, and Linux
- Health check runs on native architecture, skips cross-builds

This ensures corrupted or misconfigured binaries fail the release.
Three ways for users to check MCP server health:

1. **Status bar indicator** - Shows green/red dot with "MCP" label
   - Click to open detailed status dialog
   - Pulses when server is starting

2. **Settings panel** - Enhanced MCP section showing:
   - Version (0.2.0)
   - Tool count (76)
   - Resource count (4)
   - Last checked time
   - "Test Connection" button
   - "View Details" button

3. **Menu item** - Help → MCP Server Status...
   - Opens detailed diagnostic dialog
   - Shows all available tools
   - Copy tool list button

New files:
- src/stores/mcpHealthStore.ts - Shared health state
- src/hooks/useMcpHealthCheck.ts - Health check logic
- src/hooks/useMcpStatusMenuEvent.ts - Menu event handler
- src/components/Dialogs/McpStatusDialog.tsx/css - Status dialog
- Sync vmark-mcp-server version from 0.2.0 to 0.3.10
- Update VERSION constant in cli.ts
- Update MCP_VERSION in useMcpHealthCheck.ts

Version bump procedure now includes:
1. package.json
2. src-tauri/tauri.conf.json
3. src-tauri/Cargo.toml
4. vmark-mcp-server/package.json
5. vmark-mcp-server/src/cli.ts
- Add "Checking MCP Status" section to mcp-setup.md documenting:
  - Status bar indicator
  - Status dialog
  - Settings panel integration
- Add new AI-oriented tools to mcp-tools.md:
  - Document inspection: get_capabilities, get_document_revision,
    get_document_ast, get_document_digest, list_blocks, resolve_targets
  - Section operations: get_section, update_section, insert_section, move_section
  - Batch operations: batch_edit, apply_diff, replace_text_anchored
  - Structure manipulation: table_modify, list_modify
- Merge latest website updates from main branch
Frontend handlers:
- Remove duplicate isAutoApproveEnabled, import from utils
- Fix TypeScript any casts with proper typed assertions

MCP server tools:
- Move TableTarget, ListTarget, SectionTarget types to bridge/types.ts
- Replace `as any` casts with properly typed BridgeRequest
- Use NewHeading type for heading parameters
Provides a comprehensive AI writing assistant skill that teaches Claude Code
how to effectively use VMark's MCP tools. Includes:

- Main SKILL.md with core principles and quick reference
- tools-by-intent.md: Maps writer intents to appropriate tools
- workflows.md: 9 detailed step-by-step patterns
- examples.md: Real tool calls with parameters and responses

Key design decisions:
- Writer-centric organization ("continue this thought" not "call batch_edit")
- Suggestion-first approach for content changes
- Read-before-write workflow
- Honest about limitations (no real-time, no alternatives)

Plugin structure enables distribution via Claude Code marketplace while
keeping source in the vmark repository.
- Add marketplace.json to make vmark a self-hosted marketplace
- Add GitHub Action to auto-PR plugin updates to external marketplaces

Users can now:
1. Add vmark directly as a marketplace source
2. Or install from every-marketplace after the sync PR is merged
- Fix repo name: EveryInc/compound-engineering-plugin (not every-marketplace)
- Use fork (xiaolai/compound-engineering-plugin) for PRs
- Sync fork with upstream before making changes
- Create proper directory structure before copying
- Add author and homepage to marketplace.json entry
Complete release automation:
- Build app on v* tag
- Publish release
- Update homebrew tap
- Sync Claude skill to marketplace

All steps now triggered automatically on version tag.
- New page: claude-code-skill.md with installation and usage guide
- Add to sidebar under AI Integration
- Link from mcp-setup.md next steps
Transform README from developer-focused to user-friendly:

- New headline: "The Markdown Editor That Gets It Right"
- Lead with benefits, not tech stack
- Add screenshot at top
- Organize by user value: AI-Native, CJK, Two Modes, Design, Privacy
- Simple installation instructions upfront
- AI integration section with quick setup
- Essential shortcuts table
- Links to full documentation
- Development guide moved to bottom (still present for contributors)

Target audience: Writers, not just developers.

@xiaolai xiaolai left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

Code Review

Verdict: Ready to merge

What's Good

  • Solid AI-oriented MCP design with revision tracking + idempotency
  • Structured tools follow read-before-write pattern
  • Suggestion mode lets writers approve content changes
  • Claude Code skill is comprehensive with 9 workflows
  • Tests included for cache and protocol handlers
  • UI additions follow design tokens

Minor Notes

  • Table/list batch ops in suggest mode return warnings (expected limitation)
  • Large PR (8979 lines) - future features could be smaller increments

Recommendation

CI should pass before merge. Otherwise looks good to ship.

- Fix suggestionHandlers.test.ts to properly mock isAutoApproveEnabled
- Add --success-color-dark token for dark mode success indicators
- Replace hardcoded #4ade80 with var(--success-color-dark) token
@xiaolai
xiaolai merged commit 2eb3dc5 into main Jan 28, 2026
@xiaolai
xiaolai deleted the feat/ai-oriented-mcp-tools branch January 28, 2026 10:31
xiaolai added a commit that referenced this pull request Feb 19, 2026
Issues fixed:
- #6: Add StatusBar warning when auto-save paused (file missing)
- #15: Use Documents folder instead of Home for default save location
- #19: Fix race condition in recent files menu by storing snapshot in Rust
- #30: Fix dock icon drop when no document windows exist
- #35: Show toast notification when file auto-reloads
- #37: Add "Restore to Disk" context menu for missing files

Additional improvements:
- Add toast on pinned tab close attempt (#7)
- Add toast on save failure (#5/#14)
- Add toasts for drag-drop failures (#25, #26, #27)
- Improve cold start file open reliability (#9, #34)
- Fix no-window menu operations (#17, #18, #21)
xiaolai added a commit that referenced this pull request Feb 19, 2026
feat(mcp): AI-oriented MCP tools and Claude Code plugin
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.

1 participant