@eigenpal/docx-js-editor 0.0.1

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/dist/mcp.d.cts ADDED
@@ -0,0 +1,155 @@
1
+ import { M as McpToolDefinition, d as McpSession, J as JsonSchema } from './types-BJXChtaM.cjs';
2
+
3
+ /**
4
+ * Core MCP Tools
5
+ *
6
+ * Built-in MCP tools for document operations that are always available.
7
+ * These provide basic document manipulation without requiring plugins.
8
+ */
9
+
10
+ /**
11
+ * Load a DOCX document from base64
12
+ */
13
+ declare const loadDocumentTool: McpToolDefinition;
14
+ /**
15
+ * Save a document to base64
16
+ */
17
+ declare const saveDocumentTool: McpToolDefinition;
18
+ /**
19
+ * Close a document
20
+ */
21
+ declare const closeDocumentTool: McpToolDefinition;
22
+ /**
23
+ * Get document information
24
+ */
25
+ declare const getDocumentInfoTool: McpToolDefinition;
26
+ /**
27
+ * Get document plain text
28
+ */
29
+ declare const getDocumentTextTool: McpToolDefinition;
30
+ /**
31
+ * Insert text at a position
32
+ */
33
+ declare const insertTextTool: McpToolDefinition;
34
+ /**
35
+ * Replace text in a range
36
+ */
37
+ declare const replaceTextTool: McpToolDefinition;
38
+ /**
39
+ * Delete text in a range
40
+ */
41
+ declare const deleteTextTool: McpToolDefinition;
42
+ /**
43
+ * Apply text formatting
44
+ */
45
+ declare const formatTextTool: McpToolDefinition;
46
+ /**
47
+ * Apply paragraph style
48
+ */
49
+ declare const applyStyleTool: McpToolDefinition;
50
+ declare const coreMcpTools: McpToolDefinition[];
51
+
52
+ /**
53
+ * MCP Server
54
+ *
55
+ * Model Context Protocol server that exposes document editing tools to AI clients.
56
+ * Discovers and registers tools from the plugin system plus core built-in tools.
57
+ *
58
+ * @example
59
+ * ```ts
60
+ * import { createMcpServer, startStdioServer } from '@eigenpal/docx-editor/mcp';
61
+ * import { pluginRegistry, docxtemplaterPlugin } from '@eigenpal/docx-editor/core-plugins';
62
+ *
63
+ * // Register plugins
64
+ * pluginRegistry.register(docxtemplaterPlugin);
65
+ *
66
+ * // Start MCP server
67
+ * startStdioServer();
68
+ * ```
69
+ */
70
+
71
+ /**
72
+ * MCP Server configuration
73
+ */
74
+ interface McpServerConfig {
75
+ /** Server name */
76
+ name?: string;
77
+ /** Server version */
78
+ version?: string;
79
+ /** Include core tools (default: true) */
80
+ includeCoreTools?: boolean;
81
+ /** Enable debug logging */
82
+ debug?: boolean;
83
+ /** Custom tools to add */
84
+ additionalTools?: McpToolDefinition[];
85
+ }
86
+ /**
87
+ * MCP Server instance
88
+ */
89
+ interface McpServer {
90
+ /** All registered tools */
91
+ tools: Map<string, McpToolDefinition>;
92
+ /** Active session */
93
+ session: McpSession;
94
+ /** Handle a tool call */
95
+ handleToolCall(toolName: string, input: unknown): Promise<unknown>;
96
+ /** List available tools */
97
+ listTools(): McpToolInfo[];
98
+ /** Get server info */
99
+ getInfo(): {
100
+ name: string;
101
+ version: string;
102
+ toolCount: number;
103
+ };
104
+ }
105
+ /**
106
+ * Tool info for listing
107
+ */
108
+ interface McpToolInfo {
109
+ name: string;
110
+ description: string;
111
+ inputSchema: JsonSchema;
112
+ category?: string;
113
+ }
114
+ /**
115
+ * Create an MCP server instance
116
+ *
117
+ * @param config - Server configuration
118
+ * @returns MCP server instance
119
+ */
120
+ declare function createMcpServer(config?: McpServerConfig): McpServer;
121
+ /**
122
+ * JSON-RPC request
123
+ */
124
+ interface JsonRpcRequest {
125
+ jsonrpc: '2.0';
126
+ id: string | number;
127
+ method: string;
128
+ params?: unknown;
129
+ }
130
+ /**
131
+ * JSON-RPC response
132
+ */
133
+ interface JsonRpcResponse {
134
+ jsonrpc: '2.0';
135
+ id: string | number;
136
+ result?: unknown;
137
+ error?: {
138
+ code: number;
139
+ message: string;
140
+ data?: unknown;
141
+ };
142
+ }
143
+ /**
144
+ * Handle a JSON-RPC request
145
+ */
146
+ declare function handleJsonRpcRequest(server: McpServer, request: JsonRpcRequest): Promise<JsonRpcResponse>;
147
+ /**
148
+ * Start the MCP server with stdio transport
149
+ *
150
+ * Reads JSON-RPC requests from stdin, writes responses to stdout.
151
+ * This is the standard way to run an MCP server for Claude Desktop.
152
+ */
153
+ declare function startStdioServer(config?: McpServerConfig): Promise<void>;
154
+
155
+ export { type McpServer, type McpServerConfig, type McpToolInfo, applyStyleTool, closeDocumentTool, coreMcpTools, createMcpServer, createMcpServer as default, deleteTextTool, formatTextTool, getDocumentInfoTool, getDocumentTextTool, handleJsonRpcRequest, insertTextTool, loadDocumentTool, replaceTextTool, saveDocumentTool, startStdioServer };
package/dist/mcp.d.ts ADDED
@@ -0,0 +1,155 @@
1
+ import { M as McpToolDefinition, d as McpSession, J as JsonSchema } from './types-BJXChtaM.js';
2
+
3
+ /**
4
+ * Core MCP Tools
5
+ *
6
+ * Built-in MCP tools for document operations that are always available.
7
+ * These provide basic document manipulation without requiring plugins.
8
+ */
9
+
10
+ /**
11
+ * Load a DOCX document from base64
12
+ */
13
+ declare const loadDocumentTool: McpToolDefinition;
14
+ /**
15
+ * Save a document to base64
16
+ */
17
+ declare const saveDocumentTool: McpToolDefinition;
18
+ /**
19
+ * Close a document
20
+ */
21
+ declare const closeDocumentTool: McpToolDefinition;
22
+ /**
23
+ * Get document information
24
+ */
25
+ declare const getDocumentInfoTool: McpToolDefinition;
26
+ /**
27
+ * Get document plain text
28
+ */
29
+ declare const getDocumentTextTool: McpToolDefinition;
30
+ /**
31
+ * Insert text at a position
32
+ */
33
+ declare const insertTextTool: McpToolDefinition;
34
+ /**
35
+ * Replace text in a range
36
+ */
37
+ declare const replaceTextTool: McpToolDefinition;
38
+ /**
39
+ * Delete text in a range
40
+ */
41
+ declare const deleteTextTool: McpToolDefinition;
42
+ /**
43
+ * Apply text formatting
44
+ */
45
+ declare const formatTextTool: McpToolDefinition;
46
+ /**
47
+ * Apply paragraph style
48
+ */
49
+ declare const applyStyleTool: McpToolDefinition;
50
+ declare const coreMcpTools: McpToolDefinition[];
51
+
52
+ /**
53
+ * MCP Server
54
+ *
55
+ * Model Context Protocol server that exposes document editing tools to AI clients.
56
+ * Discovers and registers tools from the plugin system plus core built-in tools.
57
+ *
58
+ * @example
59
+ * ```ts
60
+ * import { createMcpServer, startStdioServer } from '@eigenpal/docx-editor/mcp';
61
+ * import { pluginRegistry, docxtemplaterPlugin } from '@eigenpal/docx-editor/core-plugins';
62
+ *
63
+ * // Register plugins
64
+ * pluginRegistry.register(docxtemplaterPlugin);
65
+ *
66
+ * // Start MCP server
67
+ * startStdioServer();
68
+ * ```
69
+ */
70
+
71
+ /**
72
+ * MCP Server configuration
73
+ */
74
+ interface McpServerConfig {
75
+ /** Server name */
76
+ name?: string;
77
+ /** Server version */
78
+ version?: string;
79
+ /** Include core tools (default: true) */
80
+ includeCoreTools?: boolean;
81
+ /** Enable debug logging */
82
+ debug?: boolean;
83
+ /** Custom tools to add */
84
+ additionalTools?: McpToolDefinition[];
85
+ }
86
+ /**
87
+ * MCP Server instance
88
+ */
89
+ interface McpServer {
90
+ /** All registered tools */
91
+ tools: Map<string, McpToolDefinition>;
92
+ /** Active session */
93
+ session: McpSession;
94
+ /** Handle a tool call */
95
+ handleToolCall(toolName: string, input: unknown): Promise<unknown>;
96
+ /** List available tools */
97
+ listTools(): McpToolInfo[];
98
+ /** Get server info */
99
+ getInfo(): {
100
+ name: string;
101
+ version: string;
102
+ toolCount: number;
103
+ };
104
+ }
105
+ /**
106
+ * Tool info for listing
107
+ */
108
+ interface McpToolInfo {
109
+ name: string;
110
+ description: string;
111
+ inputSchema: JsonSchema;
112
+ category?: string;
113
+ }
114
+ /**
115
+ * Create an MCP server instance
116
+ *
117
+ * @param config - Server configuration
118
+ * @returns MCP server instance
119
+ */
120
+ declare function createMcpServer(config?: McpServerConfig): McpServer;
121
+ /**
122
+ * JSON-RPC request
123
+ */
124
+ interface JsonRpcRequest {
125
+ jsonrpc: '2.0';
126
+ id: string | number;
127
+ method: string;
128
+ params?: unknown;
129
+ }
130
+ /**
131
+ * JSON-RPC response
132
+ */
133
+ interface JsonRpcResponse {
134
+ jsonrpc: '2.0';
135
+ id: string | number;
136
+ result?: unknown;
137
+ error?: {
138
+ code: number;
139
+ message: string;
140
+ data?: unknown;
141
+ };
142
+ }
143
+ /**
144
+ * Handle a JSON-RPC request
145
+ */
146
+ declare function handleJsonRpcRequest(server: McpServer, request: JsonRpcRequest): Promise<JsonRpcResponse>;
147
+ /**
148
+ * Start the MCP server with stdio transport
149
+ *
150
+ * Reads JSON-RPC requests from stdin, writes responses to stdout.
151
+ * This is the standard way to run an MCP server for Claude Desktop.
152
+ */
153
+ declare function startStdioServer(config?: McpServerConfig): Promise<void>;
154
+
155
+ export { type McpServer, type McpServerConfig, type McpToolInfo, applyStyleTool, closeDocumentTool, coreMcpTools, createMcpServer, createMcpServer as default, deleteTextTool, formatTextTool, getDocumentInfoTool, getDocumentTextTool, handleJsonRpcRequest, insertTextTool, loadDocumentTool, replaceTextTool, saveDocumentTool, startStdioServer };