文本编辑MCP
一个模型上下文协议(MCP)服务器,使Claude Desktop能够创建格式精美的RTF文档,并与原生macOS TextEdit兼容。
特性
- 📝 支援多文本格式编写
- 粗体、斜体、下划线、删除线 - 标题(H1-H2) - 具有可自定义间距的段落格式
- 🎨 颜色和突出显示
- 文本颜色:红色、蓝色、绿色 - 突出显示颜色:黄色、青色、绿色、橙色 - 表格中的全彩色支持
- 📊 表格
- 带边框的真实RTF表 - 标题行样式 - 单元格内完全格式支持 - 自动填充和对齐单元格
- 🔗 超链接
- 可点击的URL - 格式化链接文本 - 适用于TextEdit、Pages和Word
- 📋 列表
- 要点 - 编号列表 - 正确压痕
- 🎯 模板
- 业务(默认) - 技术(单空间) - 会议(增加行距)
安装
先决条件
- macOS(生成NSAttributedString和RTF所需)
- Swift 5.0或更高版本
- 克劳德桌面
快速安装
- 克隆存储库:
git clone https://github.com/M-Pineapple/TextEdit-MCP.git
cd TextEdit-MCP- 运行安装程序:
./install.sh- 重新启动克劳德桌面
安装程序将:
- 构建Swift项目
- 安装MCP服务器二进制文件
- 更新您的Claude Desktop配置
- 创建现有配置的备份
用法
在Claude Desktop中,您可以使用自然语言创建RTF文档:
"Create an RTF document with my meeting notes"
"Make a formatted report with tables and highlights"
"Generate a technical document with code examples"或者直接使用该工具:
Use textedit:create_rtf_document to create a document at ~/Desktop/MyDoc.rtf格式化语法
TextEdit MCP使用直观的类似markdown的语法:
文本格式
**Bold text***Italic text****Bold italic text***~~Strikethrough text~~
颜色
{red}Red text{/red}{blue}Blue text{/blue}{green}Green text{/green}
高亮
==Yellow highlight==[[Cyan highlight]]{{Green highlight}}((Orange highlight))
标题
# Heading 1
## Heading 2
### Heading 3
#### Heading 4列表
• Bullet point (or use - )
1. Numbered item
2. Another item表格
| Column 1 | Column 2 | Column 3 |
|----------|----------|----------|
| Data 1 | Data 2 | Data 3 |
| More | Data | Here |链接
[Link text](https://example.com)示例
简单文档
# Meeting Notes
## Agenda
- Review **Q4 results**
- Discuss {red}urgent issues{/red}
- Plan for next quarter
## Action Items
1. ==Update documentation==
2. [[Review code changes]]
3. Schedule follow-up带格式的表格
| Task | Status | Owner |
|------|--------|-------|
| **Documentation** | {green}✅ Complete{/green} | Team A |
| *Testing* | ==In Progress== | Team B |
| Deployment | {red}Blocked{/red} | DevOps |发展
从源代码构建
swift build -c release运行测试
swift test项目结构
TextEdit-MCP/
├── Sources/
│ └── TextEditMCP/
│ ├── main.swift # Entry point
│ ├── MCPServer.swift # MCP protocol handler
│ ├── RTFDocumentService.swift # RTF generation
│ └── MCPLogger.swift # Logging utility
├── Package.swift
├── README.md
├── FORMATTING_GUIDE.md
└── install.sh运作原理
- MCP协议:实现模型上下文协议以与Claude Desktop通信
- NSAttributedString:使用macOS原生API进行富文本格式化
- NSTextTable:创建具有适当边框和单元格格式的真实RTF表
- RTF导出:生成与TextEdit、Pages和Word兼容的标准RTF文件
贡献
欢迎投稿!请随时提交拉取请求。
指南
- 保持与macOS TextEdit的兼容性
- 遵循Swift命名约定
- 为新功能添加测试
- 更新文档
支持
如果您发现此工具有用,请考虑支持开发:
许可证
MIT许可证-有关详细信息,请参阅许可证文件
致谢
- 专为与Claude Desktop配合使用而创建
- 使用Swift和AppKit构建
- 使用模型上下文协议(MCP)
______________________________________________________________________
由菠萝创造🍍
