Clipboard MCP Server
Enables pattern-based file editing operations using copy/paste functionality with text landmarks instead of exact string matching. Allows AI agents to efficiently manipulate file content by identifying code patterns and insertion points without consuming large amounts of context tokens.
README
Clipboard MCP Server
⚠️ SECURITY WARNING ⚠️
🔒 CRITICAL NOTICE: FILE SYSTEM ACCESS
Installing this MCP server will allow AI agents to READ and modify files on your system without explicit user confirmation for each operation. Only install if you trust the AI system and understand the security implications.
⚠️ Version 0.0.1 - Experimental Release
This is an early experimental version that may contain bugs, incomplete features, and breaking changes. Use at your own risk and expect frequent updates.
🎯 Overview
Context-efficient file editing MCP server using pattern-based copy/paste operations. Provides an alternative to traditional exact-string editing tools by using text patterns and markers for content manipulation.
🚀 Quick Start
Prerequisites
- Node.js 18+
- Claude Code with MCP support
Installation
- Clone and build:
git clone <repository-url>
cd clipboard-mcp
npm install
npm run build
- Configure MCP server:
Add to your Claude Code MCP configuration:
{
"mcpServers": {
"clipboard": {
"command": "node",
"args": ["<absolute-path-to-project>/dist/server.js"],
"env": {}
}
}
}
- Restart Claude Code or run
/mcp reconnect
🛠️ Usage
The server provides a single copy_paste method for pattern-based file operations:
copy_paste({
source: {
file: string, // Path to source file
start_pattern: string, // Text pattern to find start of content
end_pattern?: string, // Optional: end pattern (if not provided, uses line_count)
line_count?: number // Optional: number of lines from start_pattern
},
target: {
file: string, // Path to target file
marker: string, // Text pattern to find insertion point
position: 'before' | 'after' | 'replace', // Where to insert relative to marker
replace_pattern?: string // Optional: specific pattern to replace (when position='replace')
},
cut?: boolean // Optional: true to cut (move) instead of copy
})
Examples
Copy a function:
copy_paste({
source: {
file: '/path/to/source.js',
start_pattern: 'function processData',
end_pattern: '^}'
},
target: {
file: '/path/to/target.js',
marker: '// Insert utilities here',
position: 'after'
}
})
Move a code block:
copy_paste({
source: {
file: '/path/to/old.js',
start_pattern: '// Helper functions',
line_count: 10
},
target: {
file: '/path/to/new.js',
marker: '// TODO: Add helpers',
position: 'replace'
},
cut: true
})
🧪 Development
Running Tests
npm test # Run all tests
npm run test:watch # Run tests in watch mode
Development Mode
npm run dev # MCP server with file watching
npm run dev:http # HTTP server for testing (localhost:3000)
HTTP Testing
For debugging, you can test the server logic via HTTP:
# Start HTTP server
npm run dev:http
# Test with curl
curl -X POST http://localhost:3000/copy_paste \
-H "Content-Type: application/json" \
-d '{
"source": {
"file": "/path/to/source.js",
"start_pattern": "function test",
"line_count": 5
},
"target": {
"file": "/path/to/target.js",
"marker": "// Insert here",
"position": "after"
}
}'
📚 Why Pattern-Based?
Traditional file editing tools require exact string matching, which:
- Consumes large amounts of context tokens
- Fails on whitespace differences
- Requires precise text copying
Pattern-based approach:
- Uses familiar text landmarks (
function name,// comments) - Significantly reduces context consumption
- More robust to formatting variations
- Leverages natural code structure
🔧 Technical Details
Architecture
- MCP Server (
src/server.ts) - Protocol compliance and request routing - Copy/Paste Handler (
src/handlers/) - Core business logic - File System Storage (
src/services/) - File operations and pattern matching - Utilities (
src/utils/) - Helper functions for position calculations
Error Handling
- Pattern not found in source file
- Marker not found in target file
- File permission and existence checks
- Invalid parameter validation
Testing
- 15 unit tests covering core functionality
- Snapshot testing for regression protection
- Fixture-based testing with cleanup automation
- Edge case coverage (special characters, empty content, etc.)
⚠️ Known Limitations (v0.0.1)
Security Limitations
- No file access restrictions - agents can access any readable file
- No operation confirmation - file modifications happen immediately
- No audit logging - operations are not logged for review
- No rollback protection - file changes are permanent
Technical Limitations
- Pattern matching is case-sensitive
- No regex pattern support yet (only literal text)
- Limited to single file operations per call
- No undo/rollback functionality
- File size limits not enforced
- No concurrent operation protection
🛣️ Roadmap
- [ ] Regex pattern support
- [ ] Batch operations (multiple files)
- [ ] Operation history and undo
- [ ] Performance optimizations
- [ ] Better error messages
- [ ] Configuration options
📄 License
MIT License
🤝 Contributing
This is experimental software. Issues and feedback welcome, but expect frequent breaking changes in early versions.
Version 0.0.1 - Initial experimental release
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。