Skip to main content
Glama
README.md
<div align="center">

<img src="assets/logo.svg" alt="TextEdit MCP logo" width="240"/>

# TextEdit MCP

[![Licence: MIT](https://img.shields.io/github/license/M-Pineapple/TextEdit-MCP)](LICENSE)
[![Swift](https://img.shields.io/badge/Swift-5.9-F05138?logo=swift&logoColor=white)](https://www.swift.org)
[![Stars](https://img.shields.io/github/stars/M-Pineapple/TextEdit-MCP)](https://github.com/M-Pineapple/TextEdit-MCP/stargazers)
[![M-Pineapple/TextEdit-MCP MCP server](https://glama.ai/mcp/servers/M-Pineapple/TextEdit-MCP/badges/score.svg)](https://glama.ai/mcp/servers/M-Pineapple/TextEdit-MCP)

**Ask your AI (Claude, ChatGPT, Cursor or any MCP client) for a formatted document. Open a real RTF in TextEdit.**

<img src="docs/demo.gif" width="800" alt="Simulated demo: an MCP client asks for a standup RTF, TextEdit MCP runs create_rtf_document, then a TextEdit-style preview shows headings, a table, colours, and highlights"/>

<sub>Simulated demo, not a live macOS capture. The tool is <code>create_rtf_document</code>. It writes a real <code>.rtf</code> you can open in TextEdit, Pages, or Word.</sub>

</div>

A Model Context Protocol (MCP) server that enables Claude Desktop to create beautifully formatted RTF documents with native macOS TextEdit compatibility.

## Quick start

macOS, Swift 5.9 or later, and an MCP client.

1. Clone the repository:

```bash
git clone https://github.com/M-Pineapple/TextEdit-MCP.git
cd TextEdit-MCP
```

2. Run the installer:

```bash
./install.sh
```

3. Restart your MCP client and ask for a formatted RTF on your Desktop.

## Features

- šŸ“ **Rich Text Formatting**
  - Bold, italic, underline, strikethrough
  - Headings (H1-H2)
  - Paragraph formatting with customizable spacing

- šŸŽØ **Colors & Highlighting**
  - Text colors: Red, Blue, Green
  - Highlight colors: Yellow, Cyan, Green, Orange
  - Full color support in tables

- šŸ“Š **Tables**
  - Real RTF tables with borders
  - Header row styling
  - Full formatting support within cells
  - Automatic cell padding and alignment

- šŸ”— **Hyperlinks**
  - Clickable URLs
  - Formatted link text
  - Works in TextEdit, Pages, and Word

- šŸ“‹ **Lists**
  - Bullet points
  - Numbered lists
  - Proper indentation

- šŸŽÆ **Templates**
  - Business (default)
  - Technical (monospace)
  - Meeting (increased line spacing)

- šŸ›”ļø **Path guard**
  - New `.rtf` files only, inside the home folder
  - Hidden paths, overwrites, and symlinks that resolve outside home are refused

## Installation

### Prerequisites

- macOS (required for NSAttributedString and RTF generation)
- Swift 5.0 or later
- Claude Desktop

The installer will:

- Build the Swift project
- Install the MCP server binary
- Update your Claude Desktop configuration
- Create a backup of your existing config

See [Quick start](#quick-start) for the three commands.

## Usage

In Claude Desktop, you can create RTF documents using natural language:

```
"Create an RTF document with my meeting notes"
"Make a formatted report with tables and highlights"
"Generate a technical document with code examples"
```

Or use the tool directly:

```
Use textedit:create_rtf_document to create a document at ~/Desktop/MyDoc.rtf
```

## Formatting Syntax

The TextEdit MCP uses an intuitive markdown-like syntax:

### Text Formatting
- `**Bold text**`
- `*Italic text*`
- `***Bold italic text***`
- `~~Strikethrough text~~`

### Colors
- `{red}Red text{/red}`
- `{blue}Blue text{/blue}`
- `{green}Green text{/green}`

### Highlighting
- `==Yellow highlight==`
- `[[Cyan highlight]]`
- `{{Green highlight}}`
- `((Orange highlight))`

### Headings
```markdown
# Heading 1
## Heading 2
### Heading 3
#### Heading 4
```

### Lists
```markdown
• Bullet point (or use - )
1. Numbered item
2. Another item
```

### Tables
```markdown
| Column 1 | Column 2 | Column 3 |
|----------|----------|----------|
| Data 1   | Data 2   | Data 3   |
| More     | Data     | Here     |
```

### Links
```markdown
[Link text](https://example.com)
```

## Examples

### Simple Document
```markdown
# 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
```

### Table with Formatting
```markdown
| Task | Status | Owner |
|------|--------|-------|
| **Documentation** | {green}āœ… Complete{/green} | Team A |
| *Testing* | ==In Progress== | Team B |
| Deployment | {red}Blocked{/red} | DevOps |
```

## Development

### Building from Source

```bash
swift build -c release
```

### Running Tests

```bash
swift test
```

### Project Structure

```
TextEdit-MCP/
ā”œā”€ā”€ Sources/
│   └── TextEditMCP/
│       ā”œā”€ā”€ main.swift           # Entry point
│       ā”œā”€ā”€ MCPServer.swift      # MCP protocol handler
│       ā”œā”€ā”€ RTFDocumentService.swift  # RTF generation
│       └── MCPLogger.swift      # Logging utility
ā”œā”€ā”€ docs/
│   ā”œā”€ā”€ demo.gif                 # Simulated README demo
│   └── generate-demo-gif.py     # Regenerates the demo GIF
ā”œā”€ā”€ Package.swift
ā”œā”€ā”€ README.md
ā”œā”€ā”€ FORMATTING_GUIDE.md
└── install.sh
```

## How It Works

1. **MCP Protocol**: Implements the Model Context Protocol to communicate with Claude Desktop
2. **NSAttributedString**: Uses macOS native APIs for rich text formatting
3. **NSTextTable**: Creates real RTF tables with proper borders and cell formatting
4. **RTF Export**: Generates standard RTF files compatible with TextEdit, Pages, and Word

## Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

### Guidelines

1. Maintain compatibility with macOS TextEdit
2. Follow Swift naming conventions
3. Add tests for new features
4. Update documentation

## Support

If this saves you time, a star helps others find it.

If you find this tool useful, consider supporting development:

<a href="https://www.buymeacoffee.com/mpineapple" target="_blank"><img src="https://cdn.buymeacoffee.com/buttons/v2/default-yellow.png" alt="Buy Me A Coffee" style="height: 60px !important;width: 217px !important;" ></a>

## More MCP servers by M-Pineapple

Other MCP servers in this portfolio:

- [Claude Project Coordinator](https://github.com/M-Pineapple/Claude-Project-Coordinator). Track Xcode projects, status, tech stack and health.
- [CryptoAnalysisMCP](https://github.com/M-Pineapple/CryptoAnalysisMCP). Cryptocurrency technical analysis for Claude Desktop.
- [Warp Command Runner](https://github.com/M-Pineapple/warp-command-runner). Give any chat AI a real terminal.
- [Msty Admin MCP](https://github.com/M-Pineapple/msty-admin-mcp). Administer Msty Studio Desktop.
- [Member Berries](https://github.com/M-Pineapple/member-berries-apple-mcp). Apple Calendar, Notes and Reminders with personality.
- [SeaShell](https://github.com/M-Pineapple/seashell). Talk to Claude from any terminal block.
- [HubSpot Auditor](https://github.com/M-Pineapple/hubspot-auditor). Read-only HubSpot portal audit.

## Licence

MIT Licence. See [LICENSE](LICENSE) for details.

## Acknowledgments

- Created for use with Claude Desktop
- Built with Swift and AppKit
- Uses Model Context Protocol (MCP)

---

**Created by Pineapple šŸ**