scrivener-mcp 0.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +109 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +796 -0
- package/dist/index.js.map +1 -0
- package/dist/rtf-handler.d.ts +121 -0
- package/dist/rtf-handler.d.ts.map +1 -0
- package/dist/rtf-handler.js +583 -0
- package/dist/rtf-handler.js.map +1 -0
- package/dist/scrivener-project.d.ts +199 -0
- package/dist/scrivener-project.d.ts.map +1 -0
- package/dist/scrivener-project.js +855 -0
- package/dist/scrivener-project.js.map +1 -0
- package/dist/types/internal.d.ts +86 -0
- package/dist/types/internal.d.ts.map +1 -0
- package/dist/types/internal.js +7 -0
- package/dist/types/internal.js.map +1 -0
- package/package.json +82 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 David Condrey
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
# Scrivener MCP Server
|
|
2
|
+
|
|
3
|
+
A Model Context Protocol (MCP) server for Scrivener integration that allows Claude to manipulate Scrivener projects, including file and folder operations, metadata management, and content analysis.
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
### Core Scrivener Operations
|
|
8
|
+
- **Project Management**: Open and manage Scrivener `.scriv` projects
|
|
9
|
+
- **Document CRUD**: Read, write, create, delete, and move documents and folders
|
|
10
|
+
- **Metadata Management**: Update document titles, keywords, and custom metadata
|
|
11
|
+
- **Project Structure**: Navigate and manipulate the hierarchical binder structure
|
|
12
|
+
|
|
13
|
+
### RTF Support
|
|
14
|
+
- **Full RTF Parsing**: Complete support for Scrivener's RTF document format
|
|
15
|
+
- **Formatted Content**: Preserve and manipulate bold, italic, underline, and other formatting
|
|
16
|
+
- **Scrivener Annotations**: Extract and preserve Scrivener-specific annotations and comments
|
|
17
|
+
- **Unicode Support**: Handle international characters and special symbols
|
|
18
|
+
|
|
19
|
+
### Content Analysis
|
|
20
|
+
- **Search Functionality**: Full-text search across documents with regex support
|
|
21
|
+
- **Word Counting**: Per-document or project-wide word and character counts
|
|
22
|
+
- **Writing Analysis**: Readability metrics, sentence structure analysis, passive voice detection
|
|
23
|
+
- **Document Critique**: Constructive feedback on structure, flow, clarity, and style
|
|
24
|
+
|
|
25
|
+
### Document Compilation
|
|
26
|
+
- **Multi-document Compilation**: Combine multiple documents into single output
|
|
27
|
+
- **Format Preservation**: Option to maintain or strip RTF formatting
|
|
28
|
+
- **Custom Separators**: Configure how documents are joined
|
|
29
|
+
|
|
30
|
+
## Installation
|
|
31
|
+
|
|
32
|
+
```bash
|
|
33
|
+
npm install
|
|
34
|
+
npm run build
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
## Usage
|
|
38
|
+
|
|
39
|
+
The MCP server provides the following tools:
|
|
40
|
+
|
|
41
|
+
### Project Operations
|
|
42
|
+
- `open_project(path)` - Open a Scrivener project
|
|
43
|
+
- `get_structure()` - Get the project's hierarchical structure
|
|
44
|
+
- `get_project_metadata()` - Get project-level metadata
|
|
45
|
+
|
|
46
|
+
### Document Operations
|
|
47
|
+
- `read_document(documentId)` - Read plain text content
|
|
48
|
+
- `read_document_formatted(documentId)` - Read with RTF formatting preserved
|
|
49
|
+
- `write_document(documentId, content)` - Write content to document
|
|
50
|
+
- `get_document_annotations(documentId)` - Get Scrivener annotations
|
|
51
|
+
|
|
52
|
+
### File Management
|
|
53
|
+
- `create_document(parentId?, title, type?)` - Create new document or folder
|
|
54
|
+
- `delete_document(documentId)` - Delete document or folder
|
|
55
|
+
- `move_document(documentId, newParentId?)` - Move document to new location
|
|
56
|
+
|
|
57
|
+
### Metadata & Search
|
|
58
|
+
- `update_metadata(documentId, metadata)` - Update document metadata
|
|
59
|
+
- `search_content(query, options?)` - Search across all documents
|
|
60
|
+
- `get_word_count(documentId?)` - Get word/character counts
|
|
61
|
+
|
|
62
|
+
### Analysis & Compilation
|
|
63
|
+
- `analyze_document(documentId)` - Analyze writing quality metrics
|
|
64
|
+
- `critique_document(documentId, focusAreas?)` - Get constructive feedback
|
|
65
|
+
- `compile_documents(documentIds, separator?, preserveFormatting?)` - Compile multiple documents
|
|
66
|
+
|
|
67
|
+
## RTF Format Support
|
|
68
|
+
|
|
69
|
+
This MCP server includes comprehensive RTF (Rich Text Format) support specifically designed for Scrivener's document format:
|
|
70
|
+
|
|
71
|
+
- **RTF Parsing**: Converts RTF to structured content with formatting preserved
|
|
72
|
+
- **RTF Generation**: Creates valid RTF from plain or formatted text
|
|
73
|
+
- **Scrivener Extensions**: Handles Scrivener-specific RTF extensions and annotations
|
|
74
|
+
- **Character Encoding**: Properly handles Unicode and special characters
|
|
75
|
+
- **Metadata Extraction**: Extracts document metadata from RTF info groups
|
|
76
|
+
|
|
77
|
+
## Architecture
|
|
78
|
+
|
|
79
|
+
- `ScrivenerProject` - Main class for project operations
|
|
80
|
+
- `RTFHandler` - Comprehensive RTF parsing and generation
|
|
81
|
+
- MCP Server - Tool definitions and request handling
|
|
82
|
+
|
|
83
|
+
## Error Handling
|
|
84
|
+
|
|
85
|
+
The server includes robust error handling for:
|
|
86
|
+
- Invalid project paths
|
|
87
|
+
- Missing documents
|
|
88
|
+
- RTF parsing failures
|
|
89
|
+
- File system errors
|
|
90
|
+
- Malformed project structures
|
|
91
|
+
|
|
92
|
+
## Development
|
|
93
|
+
|
|
94
|
+
```bash
|
|
95
|
+
npm run dev # Development mode with hot reload
|
|
96
|
+
npm run build # Build TypeScript
|
|
97
|
+
npm run lint # ESLint
|
|
98
|
+
npm run typecheck # TypeScript checking
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
## Requirements
|
|
102
|
+
|
|
103
|
+
- Node.js 18+
|
|
104
|
+
- TypeScript 5.0+
|
|
105
|
+
- Valid Scrivener 3 project files
|
|
106
|
+
|
|
107
|
+
## License
|
|
108
|
+
|
|
109
|
+
MIT
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":""}
|