Why Use Model Context Protocol (MCP) for Multi-Machine Skill Sync?
The Model Context Protocol (MCP) solves multi-machine skill synchronization by decoupling prompt and skill definitions from the local filesystem of any individual developer machine or AI client. Instead of manually copying raw markdown files between laptops, workstations, and cloud environments, your AI agents query a unified MCP server over JSON-RPC 2.0 to fetch up-to-date instructions on demand. This architecture eliminates manual dotfile cloning and prevents skill drift across development setups.
Traditional AI agent setups tie instructions to rigid filesystem locations. For example, Claude Code skills default to ~/.claude/skills/ on macOS and Linux, Cursor looks for .cursor/rules/ within the current project root, and terminal coding agents like OpenAI Codex look for local repository manifests. When you switch from an M3 MacBook Pro to an office Ubuntu workstation or an SSH-backed cloud development instance, these directory trees diverge immediately. Changes made during a debugging session on one laptop remain trapped locally unless manually committed, pushed, pulled, and symlinked on every other machine.
The Model Context Protocol establishes an open, vendor-neutral standard for context retrieval. According to the official Model Context Protocol specification version 2024-11-05:
"The Model Context Protocol (MCP) provides an open protocol that enables seamless integration between LLM applications and external data sources and tools."
By turning your skill library into an MCP server, you transform passive disk files into an active, queryable service. The Model Context Protocol specification version 2024-11-05 standardizes client-server communication using JSON-RPC 2.0, allowing AI agents to query external skill libraries over stdio or Server-Sent Events transports. Whether your client is Claude Code CLI, Cursor, or a headless CI agent, every tool accesses the exact same validated instruction set.
How Does an MCP Skill Sync Architecture Work?
An MCP skill sync architecture consists of an authoritative centralized storage backend, an MCP server process that translates skills into protocol primitives, and client configurations across each developer machine. The MCP server exposes skills both as readable resources for agent context ingestion and as executable tools for dynamic library updates. Local AI coding agents connect via stdio subprocesses or remote Server-Sent Events (SSE) transports to access identical skill versions.
The architecture relies on three primary MCP protocol primitives:
- Resources (
resources/listandresources/read): The server exposes your skills under a custom URI scheme such asskills://global/{skill_name}orskills://project/{repo}/{skill_name}. When an agent initializes a session, it queriesresources/listto discover available skills without loading their full bodies into memory. - Tools (
tools/call): To support bidirectional synchronization, the server registers mutation tools such assave_skill,update_skill, anddelete_skill. When Claude Code or Cursor optimizes or refactors a skill during an active coding session, the agent calls the tool to commit changes directly back to your central storage backend. - Prompts (
prompts/get): For templated prompts that require runtime variable injection (such as ticket IDs, target branches, or API versions), the MCP server formats dynamic prompt templates on the fly.
Decoupling skill storage into an MCP resource server reduces agent context window consumption by up to 96%, indexing 35-to-50 token YAML frontmatter headers initially rather than injecting multi-thousand-token instruction files on every turn. In a monolithic setup where twenty 800-word markdown skills are injected into the agent's system prompt, you expend 16,000+ tokens of context before typing a single character. With an MCP pipeline, the agent only ingests the specific SKILL.md body when its metadata matches the user's intent. Furthermore, local stdio MCP server execution introduces sub-150ms round-trip latency overhead, providing near-native filesystem read speeds while maintaining cross-machine synchronization.
Step-by-Step: Building an MCP Skill Server in TypeScript
Building a custom MCP skill sync server requires setting up a Node.js daemon that implements the official MCP TypeScript SDK (@modelcontextprotocol/sdk). The server connects to a shared storage backend—such as an S3-compatible bucket, a cloud database, or a synchronized local directory—and surfaces skills to connected AI agents over stdio.
Step 1: Project Initialization and Dependencies
Initialize a TypeScript project and install the official MCP SDK alongside Zod for schema validation:
mkdir mcp-skill-server && cd mcp-skill-server npm init -y npm install @modelcontextprotocol/sdk zod npm install -D typescript @types/node tsx
Step 2: Implementing the Server and Resource Handlers
Create src/index.ts. The server initializes a Server instance and registers request handlers for listing and reading skills:
import { Server } from "@modelcontextprotocol/sdk/server/index.js";
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
import {
ListResourcesRequestSchema,
ReadResourceRequestSchema,
ListToolsRequestSchema,
CallToolRequestSchema,
ErrorCode,
McpError
} from "@modelcontextprotocol/sdk/types.js";
import * as fs from "fs/promises";
import * as path from "path";
// Path to centralized storage or synced cloud directory
const STORAGE_DIR = process.env.SKILL_STORAGE_PATH || path.join(process.env.HOME || "", ".central-skills");
const server = new Server(
{
name: "prompttly-skill-sync-server",
version: "1.0.0",
},
{
capabilities: {
resources: {},
tools: {},
},
}
);
// 1. Discover all skills across machines
server.setRequestHandler(ListResourcesRequestSchema, async () => {
const files = await fs.readdir(STORAGE_DIR).catch(() => []);
const skillFiles = files.filter(f => f.endsWith(".md") || f.endsWith(".mdc"));
return {
resources: skillFiles.map(file => {
const skillName = path.basename(file, path.extname(file));
return {
uri: `skills://global/${skillName}`,
name: `Skill: ${skillName}`,
mimeType: "text/markdown",
description: `Cross-machine AI agent skill for ${skillName}`
};
})
};
});
// 2. Read full skill instructions on demand
server.setRequestHandler(ReadResourceRequestSchema, async (request) => {
const url = new URL(request.params.uri);
if (url.protocol !== "skills:") {
throw new McpError(ErrorCode.InvalidRequest, `Unsupported URI scheme: ${url.protocol}`);
}
const skillName = path.basename(url.pathname);
const filePath = path.join(STORAGE_DIR, `${skillName}.md`);
try {
const content = await fs.readFile(filePath, "utf-8");
return {
contents: [
{
uri: request.params.uri,
mimeType: "text/markdown",
text: content
}
]
};
} catch {
throw new McpError(ErrorCode.InvalidRequest, `Skill not found: ${skillName}`);
}
});Step 3: Implementing Two-Way Mutation Tools
To allow AI agents to create or modify skills during active workflows without leaving the terminal, implement writeback tools in the same server:
// 3. Register writeback tools for runtime skill updates
server.setRequestHandler(ListToolsRequestSchema, async () => {
return {
tools: [
{
name: "save_skill",
description: "Save or update a reusable AI skill in the centralized multi-machine library",
inputSchema: {
type: "object",
properties: {
skillName: { type: "string", description: "Name of the skill in kebab-case" },
content: { type: "string", description: "Complete SKILL.md content with frontmatter" }
},
required: ["skillName", "content"]
}
}
]
};
});
// 4. Handle tool execution and write to shared storage
server.setRequestHandler(CallToolRequestSchema, async (request) => {
if (request.params.name === "save_skill") {
const { skillName, content } = request.params.arguments as { skillName: string; content: string };
const safeName = skillName.replace(/[^a-z0-9_-]/gi, "");
const targetFile = path.join(STORAGE_DIR, `${safeName}.md`);
await fs.mkdir(STORAGE_DIR, { recursive: true });
await fs.writeFile(targetFile, content, "utf-8");
return {
content: [
{
type: "text",
text: `Skill '${safeName}' successfully synchronized to central storage.`
}
]
};
}
throw new McpError(ErrorCode.MethodNotFound, "Unknown tool");
});
// 5. Connect stdio transport
async function main() {
const transport = new StdioServerTransport();
await server.connect(transport);
}
main().catch(console.error);How Do You Connect Claude Code, Cursor, and Codex to the MCP Pipeline?
Connecting AI agents to your MCP skill pipeline requires registering the server command and environment arguments in each agent's local JSON configuration file. Claude Code connects via claude_desktop_config.json or ~/.claude/settings.json, while Cursor connects through its MCP settings tab or .cursor/mcp.json. Once configured, each agent automatically polls the server during startup and discovers your complete cross-machine skill library.
To configure Claude Code, open your global settings file located at ~/.claude/settings.json (or ~/Library/Application Support/Claude/claude_desktop_config.json for the desktop interface) and register the stdio transport:
{
"mcpServers": {
"skill-sync": {
"command": "node",
"args": ["/Users/developer/.config/mcp-skill-server/dist/index.js"],
"env": {
"SKILL_STORAGE_PATH": "/Users/developer/Library/CloudStorage/Sync/skills"
}
}
}
}For Cursor, navigate to Cursor Settings → Features → MCP and add a new stdio server, or define it in your repository's .cursor/mcp.json:
{
"mcpServers": {
"skill-sync": {
"command": "node",
"args": ["/Users/developer/.config/mcp-skill-server/dist/index.js"]
}
}
}For developers using OpenAI Codex in terminal environments or headless agent runners, pass the MCP server endpoint via the agent's startup flags or integrate it into your AGENTS.md execution context. To review native file syntax before connecting, reference our guides on agent instructions across repos and Claude Skills vs MCP.
Architectural Trade-Offs: MCP Pipeline vs Git Submodules vs Dotfile Symlinks
Engineering teams typically evaluate three distinct methods for synchronizing AI agent instructions across multiple machines: git submodules, dotfile symlink repositories, and custom MCP pipelines. While dotfiles are simple to set up initially, they fail as soon as teams need dynamic loading, cross-platform path translation, or runtime agent writeback.
| Evaluation Criteria | Git Submodules / Dotfiles | DIY MCP Skill Server | Prompttly Managed Sync |
|---|---|---|---|
| Multi-Machine Sync Speed | Manual (requires git pull) | Automated (<150ms stdio) | Instantaneous (<200ms hotkey) |
| Agent Writeback Capability | None (read-only filesystem) | Basic (custom tool handler) | Full two-way sync + versioning |
| Context Token Overhead | High (static preamble injection) | Minimal (lazy-loaded on demand) | Minimal (modular SKILL.md indexing) |
| Cross-Tool Compatibility | Limited to filesystem agents | Claude Code, Cursor, Codex | Claude Code, Codex, Cursor, ChatGPT, Web |
| Conflict Resolution | Git merge conflicts in terminal | DIY ETag / Last-write-wins | Automated version history & rollback |
| Maintenance Burden | Medium (script maintenance) | High (custom daemon code) | Zero (managed Mac & web app) |
How Do You Handle Multi-Machine Concurrency and State Conflicts?
Multi-machine skill synchronization requires an optimistic concurrency control strategy based on content hashes (SHA-256 ETags) or Lamport logical timestamps to prevent dirty writes. When an agent mutates a skill while another machine is offline, the MCP server rejects concurrent write operations that lack the latest version hash. Implementing a last-write-wins fallback with automated diff archiving ensures that no prompt refactoring is silently overwritten.
Concurrency failures typically manifest in three scenarios:
- Split-Brain Editing: You edit a skill manually in VS Code on your laptop while an autonomous agent in Cursor on your desktop invokes a
save_skillmutation tool. Without content hashing, whichever process writes last completely obliterates the other's changes. - Active Worktree Lock Collisions: If your MCP sync server writes directly into local repository folders while git is re-indexing or running a commit hook, file lock collisions can abort active agent execution loops.
- Partial Frontmatter Corruption: When synchronizing multi-file skills containing both YAML 1.2 frontmatter and supporting templates, an interrupted write can leave the skill unparseable by Claude Code.
To resolve these conflicts in your custom MCP pipeline, compute a SHA-256 hash of the skill content during resources/read and require the client agent to provide that hash during tools/call. If the hash on disk does not match the incoming base hash, write the conflicting version to a timestamped backup directory (e.g., ~/.skills/conflicts/skill-name.2026-09-28.bak.md) before returning a warning to the agent.
The Sprawl Moment: When Your Cloud Server Runs a Stale Skill
You spend three hours refining a comprehensive multi-step test-generation skill on your MacBook Pro, dialing in edge-case assertions, mock fixtures, and framework conventions for your team’s Python microservice. The skill performs flawlessly in local Claude Code runs. Later that evening, you SSH into your remote Linux workstation from a home desktop to execute an overnight refactoring batch across fourteen repositories. You launch Claude Code, invoke the skill name, and watch the agent fail within forty seconds: it is hallucinating deprecated API mocks and generating obsolete boilerplate. You dig into the terminal and realize the remote machine is still running a two-week-old version of the skill you manually copied in a tmux session before the sprint started. Your changes are trapped on your laptop’s local drive three hundred miles away, leaving you to either rebuild the prompt from memory or halt your entire build pipeline.
Why Teams Outgrow DIY MCP Scripts: When to Use a Managed Skill Manager
Building a DIY MCP server is a powerful exercise for technical power users, but maintaining custom socket connections, handling offline caching, building Mac hotkey overlays, and supporting non-MCP web surfaces (like ChatGPT and Claude.ai) quickly turns into a secondary software project.
Prompttly is a skill manager for AI agents — one library for your skills and prompts that syncs into Claude Code, Codex, ChatGPT, and Claude and is one hotkey away on your Mac, so your setup follows you across every machine, repo, and tool.
Instead of writing and maintaining custom Node.js daemons, Prompttly provides:
- Sub-200ms Hotkey Palette on Mac: Press a global keyboard shortcut to search your entire prompt and skill library instantly and paste instructions into any terminal, IDE, or browser window.
- Native Two-Way Filesystem Sync: Skills sync automatically into real skill directories across Claude Code (
~/.claude/skills) and Codex without requiring manual git pulls or symlink scripts. - Full MCP Connection with Write Access: Connect any MCP-compliant agent directly to your cloud library with full read and write capabilities.
- Cross-Platform Web & Extension Access: Use
//slash commands inside ChatGPT and Claude.ai, or generate production-ready skills using the free Claude Skill Creator.
When NOT to use Prompttly: If you work exclusively on a single computer, use only one AI coding assistant (such as Claude Code alone), and maintain fewer than five basic prompts, building a complex multi-machine sync pipeline or adopting a dedicated manager is unnecessary overhead. A simple local folder in ~/.claude/skills/ or a standard shell alias is completely sufficient. A multi-machine sync pipeline becomes essential only when you switch between laptops, desktops, and remote servers, work across multiple AI tools simultaneously, or manage a versioned instruction library that changes weekly.
Frequently Asked Questions About MCP Skill Sync Pipelines
What is an MCP skill sync pipeline?
An MCP skill sync pipeline is an automated synchronization system built on the Model Context Protocol (MCP) that exposes a centralized library of prompts, agent rules, and SKILL.md packages to local AI coding assistants—including Claude Code, Cursor, and Codex—over JSON-RPC 2.0 without requiring manual file copying across machines.
How does MCP synchronization differ from git submodules or dotfile symlinks?
Git submodules and dotfile symlinks require manual git pull commands, break on differing filesystem paths across operating systems, and cannot write runtime skill modifications back to central storage. In contrast, an MCP skill pipeline exposes real-time dynamic resources and writeback tools that update across machines automatically with sub-150ms latency.
Does an MCP skill server consume agent context window tokens permanently?
No. When configured as dynamic resources, an MCP skill server only indexes lightweight 35-to-50 token metadata headers during session startup. The agent loads the full instruction body on demand when a skill is triggered, saving up to 96% of the token context budget compared to hardcoded system preambles.
Can you connect multiple AI coding assistants to the same local MCP skill server?
Yes. Because MCP standardizes communication over stdio and Server-Sent Events (SSE), you can point Claude Code (~/.claude/settings.json), Cursor (.cursor/mcp.json), and Codex CLI to the exact same MCP skill server process on your machine.
How do you prevent edit conflicts when multiple machines update the same skill?
A production MCP skill sync pipeline uses optimistic concurrency control with SHA-256 content hashes (ETags) or logical timestamps. When an agent invokes a writeback tool, the server verifies that the incoming version matches the latest remote state before committing changes, preventing dirty writes across concurrent sessions.
Related Multi-Agent and Skill Architecture Resources
To explore advanced agent instruction patterns and multi-machine setups, consult our related engineering guides:
- How to Sync Prompts Across Laptops: Practical strategies for keeping Cursor rules, Claude Code skills, and prompt libraries synchronized across physical machines.
- Fixing Broken AI Agent Instructions Across Repositories: Architecture for managing polyrepos and git worktrees without instruction drift.
- Agent Skills & Claude Skills Architecture: The complete technical guide to SKILL.md format, YAML frontmatter, and multi-agent execution.
- Claude Skills vs MCP: A decision framework for knowing when to package instructions as skills versus Model Context Protocol tools.
- Explore the complete Prompttly Resources Hub or download the native Mac app to enable instant hotkey skill retrieval.
Related Prompt Resources
Turn this pack into skills that follow you everywhere
Save any of these as Prompttly skills and they're instantly available in ChatGPT via //, in Claude Code as real skill files, and to any AI agent you connect.