@mtcsistemas/appflowy-mcp-server 1.0.0

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.
Files changed (55) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +324 -0
  3. package/dist/config.d.ts +25 -0
  4. package/dist/config.d.ts.map +1 -0
  5. package/dist/config.js +56 -0
  6. package/dist/config.js.map +1 -0
  7. package/dist/index.d.ts +15 -0
  8. package/dist/index.d.ts.map +1 -0
  9. package/dist/index.js +53 -0
  10. package/dist/index.js.map +1 -0
  11. package/dist/prompts/appflowy-prompts.d.ts +7 -0
  12. package/dist/prompts/appflowy-prompts.d.ts.map +1 -0
  13. package/dist/prompts/appflowy-prompts.js +115 -0
  14. package/dist/prompts/appflowy-prompts.js.map +1 -0
  15. package/dist/resources/workspace-resources.d.ts +7 -0
  16. package/dist/resources/workspace-resources.d.ts.map +1 -0
  17. package/dist/resources/workspace-resources.js +86 -0
  18. package/dist/resources/workspace-resources.js.map +1 -0
  19. package/dist/server.d.ts +7 -0
  20. package/dist/server.d.ts.map +1 -0
  21. package/dist/server.js +31 -0
  22. package/dist/server.js.map +1 -0
  23. package/dist/services/appflowy-client.d.ts +65 -0
  24. package/dist/services/appflowy-client.d.ts.map +1 -0
  25. package/dist/services/appflowy-client.js +303 -0
  26. package/dist/services/appflowy-client.js.map +1 -0
  27. package/dist/services/auth.d.ts +26 -0
  28. package/dist/services/auth.d.ts.map +1 -0
  29. package/dist/services/auth.js +89 -0
  30. package/dist/services/auth.js.map +1 -0
  31. package/dist/tools/databases.d.ts +7 -0
  32. package/dist/tools/databases.d.ts.map +1 -0
  33. package/dist/tools/databases.js +199 -0
  34. package/dist/tools/databases.js.map +1 -0
  35. package/dist/tools/documents.d.ts +7 -0
  36. package/dist/tools/documents.d.ts.map +1 -0
  37. package/dist/tools/documents.js +197 -0
  38. package/dist/tools/documents.js.map +1 -0
  39. package/dist/tools/files.d.ts +7 -0
  40. package/dist/tools/files.d.ts.map +1 -0
  41. package/dist/tools/files.js +196 -0
  42. package/dist/tools/files.js.map +1 -0
  43. package/dist/tools/search.d.ts +7 -0
  44. package/dist/tools/search.d.ts.map +1 -0
  45. package/dist/tools/search.js +60 -0
  46. package/dist/tools/search.js.map +1 -0
  47. package/dist/tools/workspaces.d.ts +7 -0
  48. package/dist/tools/workspaces.d.ts.map +1 -0
  49. package/dist/tools/workspaces.js +66 -0
  50. package/dist/tools/workspaces.js.map +1 -0
  51. package/dist/types.d.ts +140 -0
  52. package/dist/types.d.ts.map +1 -0
  53. package/dist/types.js +6 -0
  54. package/dist/types.js.map +1 -0
  55. package/package.json +64 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 AppFlowy Community
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,324 @@
1
+ <div align="center">
2
+
3
+ # 🚀 AppFlowy MCP Server
4
+
5
+ **Connect your IDE to your self-hosted AppFlowy workspace**
6
+
7
+ [![npm version](https://img.shields.io/npm/v/@appflowy/mcp-server.svg)](https://www.npmjs.com/package/@appflowy/mcp-server)
8
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
9
+ [![Node.js](https://img.shields.io/badge/node-%3E%3D18.0.0-brightgreen)](https://nodejs.org/)
10
+
11
+ [Installation](#installation) • [Configuration](#configuration) • [Tools](#available-tools) • [File Attachments](#file-attachments)
12
+
13
+ </div>
14
+
15
+ ---
16
+
17
+ ## ✨ Features
18
+
19
+ - 🔍 **Full-text search** across all workspace content
20
+ - 📄 **Document management** — read, create, delete pages
21
+ - 📊 **Database operations** — CRUD on Grid, Board, Calendar, Gallery
22
+ - 📎 **File attachments** — upload, download, attach files to documents
23
+ - 🌐 **Works with any MCP-compatible IDE** — VS Code, Cursor, Claude Desktop, Zed, and more
24
+ - 🔐 **Secure JWT authentication** via GoTrue (Supabase Auth fork)
25
+ - 🏠 **Self-hosted first** — designed for AppFlowy Cloud self-hosted instances
26
+
27
+ ---
28
+
29
+ ## 📦 Installation
30
+
31
+ ### Option 1: Install via npx (recommended)
32
+
33
+ ```bash
34
+ npx @appflowy/mcp-server
35
+ ```
36
+
37
+ ### Option 2: Install globally
38
+
39
+ ```bash
40
+ npm install -g @appflowy/mcp-server
41
+ ```
42
+
43
+ ### Option 3: Clone and build from source
44
+
45
+ ```bash
46
+ git clone https://github.com/AppFlowy-IO/appflowy-mcp-server.git
47
+ cd appflowy-mcp-server
48
+ npm install
49
+ npm run build
50
+ ```
51
+
52
+ ---
53
+
54
+ ## ⚙️ Configuration
55
+
56
+ Create a `.env` file or set environment variables:
57
+
58
+ ```bash
59
+ # Required: Your AppFlowy Cloud URL
60
+ APPFLOWY_BASE_URL=https://tu-appflowy.dominio.com
61
+
62
+ # Authentication (choose one method)
63
+
64
+ # Method 1: Email + Password
65
+ APPFLOWY_EMAIL=admin@tu-dominio.com
66
+ APPFLOWY_PASSWORD=tu-password-seguro
67
+
68
+ # Method 2: Pre-generated JWT Token
69
+ # APPFLOWY_JWT_TOKEN=eyJhbGciOiJIUzI1NiIs...
70
+
71
+ # Optional: File upload limits
72
+ APPFLOWY_MAX_FILE_SIZE_MB=50
73
+ APPFLOWY_FILE_TIMEOUT_SEC=60
74
+ ```
75
+
76
+ ### Getting your JWT Token
77
+
78
+ 1. Log in to your AppFlowy web app
79
+ 2. Open browser DevTools → Application → Local Storage
80
+ 3. Find the `gotrue` token or call:
81
+ ```bash
82
+ curl -X POST https://tu-appflowy.dominio.com/gotrue/token?grant_type=password \
83
+ -H "Content-Type: application/json" \
84
+ -d '{"email":"your@email.com","password":"your-password"}'
85
+ ```
86
+
87
+ ---
88
+
89
+ ## 🖥️ IDE Setup
90
+
91
+ ### VS Code
92
+
93
+ Add to your `settings.json`:
94
+
95
+ ```json
96
+ {
97
+ "mcp.servers": {
98
+ "appflowy": {
99
+ "command": "npx",
100
+ "args": ["-y", "@appflowy/mcp-server"],
101
+ "env": {
102
+ "APPFLOWY_BASE_URL": "https://tu-appflowy.dominio.com",
103
+ "APPFLOWY_EMAIL": "admin@tu-dominio.com",
104
+ "APPFLOWY_PASSWORD": "tu-password-seguro"
105
+ }
106
+ }
107
+ }
108
+ }
109
+ ```
110
+
111
+ ### Cursor
112
+
113
+ In **Settings → MCP Servers**, add:
114
+
115
+ ```json
116
+ {
117
+ "mcpServers": [
118
+ {
119
+ "name": "appflowy",
120
+ "command": "npx -y @appflowy/mcp-server",
121
+ "env": {
122
+ "APPFLOWY_BASE_URL": "https://tu-appflowy.dominio.com",
123
+ "APPFLOWY_EMAIL": "admin@tu-dominio.com",
124
+ "APPFLOWY_PASSWORD": "tu-password-seguro"
125
+ }
126
+ }
127
+ ]
128
+ }
129
+ ```
130
+
131
+ ### Claude Desktop
132
+
133
+ Edit `claude_desktop_config.json`:
134
+
135
+ ```json
136
+ {
137
+ "mcpServers": {
138
+ "appflowy": {
139
+ "command": "npx",
140
+ "args": ["-y", "@appflowy/mcp-server"],
141
+ "env": {
142
+ "APPFLOWY_BASE_URL": "https://tu-appflowy.dominio.com",
143
+ "APPFLOWY_JWT_TOKEN": "eyJhbGciOiJIUzI1NiIs..."
144
+ }
145
+ }
146
+ }
147
+ }
148
+ ```
149
+
150
+ ### Zed
151
+
152
+ Add to your `settings.json`:
153
+
154
+ ```json
155
+ {
156
+ "assistant": {
157
+ "version": "2",
158
+ "default_model": {
159
+ "provider": "anthropic",
160
+ "model": "claude-3-5-sonnet-latest"
161
+ },
162
+ "enable_experimental_live_diffs": true
163
+ },
164
+ "context_servers": {
165
+ "appflowy-mcp-server": {
166
+ "command": {
167
+ "path": "npx",
168
+ "args": ["-y", "@appflowy/mcp-server"],
169
+ "env": {
170
+ "APPFLOWY_BASE_URL": "https://tu-appflowy.dominio.com",
171
+ "APPFLOWY_EMAIL": "admin@tu-dominio.com",
172
+ "APPFLOWY_PASSWORD": "tu-password-seguro"
173
+ }
174
+ }
175
+ }
176
+ }
177
+ }
178
+ ```
179
+
180
+ ---
181
+
182
+ ## 🛠️ Available Tools
183
+
184
+ ### Workspace Tools
185
+
186
+ | Tool | Description |
187
+ |------|-------------|
188
+ | `appflowy_list_workspaces` | List all available workspaces |
189
+ | `appflowy_get_workspace` | Get details of a specific workspace |
190
+
191
+ ### Document Tools
192
+
193
+ | Tool | Description |
194
+ |------|-------------|
195
+ | `appflowy_list_documents` | List documents in a workspace/folder |
196
+ | `appflowy_read_document` | Read full content of a document |
197
+ | `appflowy_create_document` | Create a new document/page |
198
+ | `appflowy_delete_document` | Delete a document |
199
+ | `appflowy_duplicate_document` | Duplicate/clone a document |
200
+
201
+ ### Database Tools
202
+
203
+ | Tool | Description |
204
+ |------|-------------|
205
+ | `appflowy_list_databases` | List all databases (Grid, Board, Calendar, Gallery) |
206
+ | `appflowy_read_database` | Read all rows from a database |
207
+ | `appflowy_create_database_row` | Create a new row |
208
+ | `appflowy_update_database_row` | Update an existing row |
209
+ | `appflowy_delete_database_row` | Delete a row |
210
+
211
+ ### Search Tools
212
+
213
+ | Tool | Description |
214
+ |------|-------------|
215
+ | `appflowy_search` | Full-text search across workspace content |
216
+
217
+ ### File Attachment Tools
218
+
219
+ | Tool | Description |
220
+ |------|-------------|
221
+ | `appflowy_upload_file` | Upload a file to AppFlowy storage |
222
+ | `appflowy_download_file` | Download a file to your local machine |
223
+ | `appflowy_list_files` | List files in storage |
224
+ | `appflowy_delete_file` | Delete a file from storage |
225
+ | `appflowy_attach_file_to_document` | Attach a file to a document |
226
+
227
+ ---
228
+
229
+ ## 📎 File Attachments
230
+
231
+ Upload files from your local machine and attach them to AppFlowy documents:
232
+
233
+ ```
234
+ "Upload the file /home/user/report.pdf to my AppFlowy workspace"
235
+ → Uses appflowy_upload_file
236
+
237
+ "Attach the uploaded report to the Sprint Review document"
238
+ → Uses appflowy_attach_file_to_document
239
+
240
+ "Download the file with ID abc123 to /home/user/downloads"
241
+ → Uses appflowy_download_file
242
+ ```
243
+
244
+ ### Supported File Types
245
+
246
+ - **Images**: PNG, JPG, GIF, SVG, WebP
247
+ - **Documents**: PDF, DOCX, TXT, MD
248
+ - **Code files**: JS, TS, PY, JSON, YAML, etc.
249
+ - **Archives**: ZIP, TAR, GZ
250
+ - **Any file type** up to the configured max size (default: 50MB)
251
+
252
+ ---
253
+
254
+ ## 💡 Usage Examples
255
+
256
+ ### Find documentation
257
+ ```
258
+ "Search in AppFlowy for documents about API architecture"
259
+ → appflowy_search(query="API architecture")
260
+ ```
261
+
262
+ ### Create meeting notes
263
+ ```
264
+ "Create meeting notes for today's standup in AppFlowy"
265
+ → appflowy_create_document(name="Standup - 2026-06-13")
266
+ ```
267
+
268
+ ### Manage tasks
269
+ ```
270
+ "Show me all pending tasks in the project database"
271
+ → appflowy_read_database → filter by status
272
+ ```
273
+
274
+ ### Upload and attach files
275
+ ```
276
+ "Upload the design mockup.png and attach it to the Design Specs document"
277
+ → appflowy_upload_file → appflowy_attach_file_to_document
278
+ ```
279
+
280
+ ---
281
+
282
+ ## 🔧 Development
283
+
284
+ ```bash
285
+ # Install dependencies
286
+ npm install
287
+
288
+ # Build
289
+ npm run build
290
+
291
+ # Watch mode
292
+ npm run dev
293
+
294
+ # Test with MCP Inspector
295
+ npm run inspector
296
+ ```
297
+
298
+ ---
299
+
300
+ ## 🐛 Troubleshooting
301
+
302
+ | Problem | Solution |
303
+ |---------|----------|
304
+ | `ECONNREFUSED` | Check that AppFlowy Cloud is running and `APPFLOWY_BASE_URL` is correct |
305
+ | Authentication failed | Verify email/password or regenerate JWT token |
306
+ | Workspace not found | Run `appflowy_list_workspaces` to get valid IDs |
307
+ | File upload too large | Increase `APPFLOWY_MAX_FILE_SIZE_MB` |
308
+ | Token expired | The server auto-refreshes tokens; if issues persist, restart the IDE |
309
+
310
+ ---
311
+
312
+ ## 📄 License
313
+
314
+ MIT License — see [LICENSE](LICENSE) for details.
315
+
316
+ ---
317
+
318
+ <div align="center">
319
+
320
+ Made with ❤️ for the AppFlowy community
321
+
322
+ [AppFlowy](https://appflowy.com) • [GitHub](https://github.com/AppFlowy-IO) • [Discord](https://discord.gg/9Q2xaN37tV)
323
+
324
+ </div>
@@ -0,0 +1,25 @@
1
+ /**
2
+ * AppFlowy MCP Server - Configuration
3
+ * Environment variables and validation
4
+ */
5
+ import { AppFlowyConfig, McpServerConfig } from './types.js';
6
+ export declare const APPFLOWY_CONFIG: AppFlowyConfig;
7
+ export declare const MCP_CONFIG: McpServerConfig;
8
+ /**
9
+ * Validate required configuration
10
+ * @throws Error if configuration is invalid
11
+ */
12
+ export declare function validateConfig(): void;
13
+ /**
14
+ * Get the GoTrue authentication URL
15
+ */
16
+ export declare function getGoTrueUrl(): string;
17
+ /**
18
+ * Get the AppFlowy API base URL
19
+ */
20
+ export declare function getApiUrl(): string;
21
+ /**
22
+ * Get the file storage API URL
23
+ */
24
+ export declare function getFileStorageUrl(): string;
25
+ //# sourceMappingURL=config.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAK7D,eAAO,MAAM,eAAe,EAAE,cAO7B,CAAC;AAEF,eAAO,MAAM,UAAU,EAAE,eAGxB,CAAC;AAEF;;;GAGG;AACH,wBAAgB,cAAc,IAAI,IAAI,CAiBrC;AAED;;GAEG;AACH,wBAAgB,YAAY,IAAI,MAAM,CAErC;AAED;;GAEG;AACH,wBAAgB,SAAS,IAAI,MAAM,CAElC;AAED;;GAEG;AACH,wBAAgB,iBAAiB,IAAI,MAAM,CAE1C"}
package/dist/config.js ADDED
@@ -0,0 +1,56 @@
1
+ /**
2
+ * AppFlowy MCP Server - Configuration
3
+ * Environment variables and validation
4
+ */
5
+ import { config } from 'dotenv';
6
+ // Load environment variables from .env file
7
+ config();
8
+ export const APPFLOWY_CONFIG = {
9
+ baseUrl: process.env.APPFLOWY_BASE_URL?.replace(/\/$/, '') || 'http://localhost:80',
10
+ email: process.env.APPFLOWY_EMAIL || '',
11
+ password: process.env.APPFLOWY_PASSWORD || '',
12
+ jwtToken: process.env.APPFLOWY_JWT_TOKEN || '',
13
+ maxFileSizeMB: parseInt(process.env.APPFLOWY_MAX_FILE_SIZE_MB || '50', 10),
14
+ fileTimeoutSec: parseInt(process.env.APPFLOWY_FILE_TIMEOUT_SEC || '60', 10),
15
+ };
16
+ export const MCP_CONFIG = {
17
+ serverName: process.env.MCP_SERVER_NAME || 'appflowy-mcp-server',
18
+ serverVersion: process.env.MCP_SERVER_VERSION || '1.0.0',
19
+ };
20
+ /**
21
+ * Validate required configuration
22
+ * @throws Error if configuration is invalid
23
+ */
24
+ export function validateConfig() {
25
+ const errors = [];
26
+ if (!APPFLOWY_CONFIG.baseUrl) {
27
+ errors.push('APPFLOWY_BASE_URL is required');
28
+ }
29
+ const hasJwt = !!APPFLOWY_CONFIG.jwtToken;
30
+ const hasCredentials = !!(APPFLOWY_CONFIG.email && APPFLOWY_CONFIG.password);
31
+ if (!hasJwt && !hasCredentials) {
32
+ errors.push('Authentication required: provide either APPFLOWY_JWT_TOKEN or APPFLOWY_EMAIL + APPFLOWY_PASSWORD');
33
+ }
34
+ if (errors.length > 0) {
35
+ throw new Error(`Configuration errors:\n${errors.map(e => ` - ${e}`).join('\n')}`);
36
+ }
37
+ }
38
+ /**
39
+ * Get the GoTrue authentication URL
40
+ */
41
+ export function getGoTrueUrl() {
42
+ return `${APPFLOWY_CONFIG.baseUrl}/gotrue`;
43
+ }
44
+ /**
45
+ * Get the AppFlowy API base URL
46
+ */
47
+ export function getApiUrl() {
48
+ return `${APPFLOWY_CONFIG.baseUrl}/api`;
49
+ }
50
+ /**
51
+ * Get the file storage API URL
52
+ */
53
+ export function getFileStorageUrl() {
54
+ return `${APPFLOWY_CONFIG.baseUrl}/api/file_storage`;
55
+ }
56
+ //# sourceMappingURL=config.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAGhC,4CAA4C;AAC5C,MAAM,EAAE,CAAC;AAET,MAAM,CAAC,MAAM,eAAe,GAAmB;IAC7C,OAAO,EAAE,OAAO,CAAC,GAAG,CAAC,iBAAiB,EAAE,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,IAAI,qBAAqB;IACnF,KAAK,EAAE,OAAO,CAAC,GAAG,CAAC,cAAc,IAAI,EAAE;IACvC,QAAQ,EAAE,OAAO,CAAC,GAAG,CAAC,iBAAiB,IAAI,EAAE;IAC7C,QAAQ,EAAE,OAAO,CAAC,GAAG,CAAC,kBAAkB,IAAI,EAAE;IAC9C,aAAa,EAAE,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,yBAAyB,IAAI,IAAI,EAAE,EAAE,CAAC;IAC1E,cAAc,EAAE,QAAQ,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B,CAAC;AACvD,CAAC"}
@@ -0,0 +1,15 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * AppFlowy MCP Server
4
+ * Entry point - connects MCP server to IDE via stdio transport
5
+ *
6
+ * Usage:
7
+ * npx @appflowy/mcp-server
8
+ * node dist/index.js
9
+ *
10
+ * Environment variables (required):
11
+ * APPFLOWY_BASE_URL - Your AppFlowy Cloud URL
12
+ * APPFLOWY_EMAIL + APPFLOWY_PASSWORD - OR - APPFLOWY_JWT_TOKEN
13
+ */
14
+ export {};
15
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAEA;;;;;;;;;;;GAWG"}
package/dist/index.js ADDED
@@ -0,0 +1,53 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * AppFlowy MCP Server
4
+ * Entry point - connects MCP server to IDE via stdio transport
5
+ *
6
+ * Usage:
7
+ * npx @appflowy/mcp-server
8
+ * node dist/index.js
9
+ *
10
+ * Environment variables (required):
11
+ * APPFLOWY_BASE_URL - Your AppFlowy Cloud URL
12
+ * APPFLOWY_EMAIL + APPFLOWY_PASSWORD - OR - APPFLOWY_JWT_TOKEN
13
+ */
14
+ import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
15
+ import { createMcpServer } from './server.js';
16
+ import { validateConfig } from './config.js';
17
+ async function main() {
18
+ try {
19
+ // Validate configuration
20
+ validateConfig();
21
+ // Create MCP server
22
+ const server = createMcpServer();
23
+ // Use stdio transport (standard for IDE integration)
24
+ const transport = new StdioServerTransport();
25
+ await server.connect(transport);
26
+ // Log to stderr (stdout is reserved for MCP protocol)
27
+ console.error('✅ AppFlowy MCP Server started successfully');
28
+ console.error(` Server: ${process.env.MCP_SERVER_NAME || 'appflowy-mcp-server'}`);
29
+ console.error(` Version: ${process.env.MCP_SERVER_VERSION || '1.0.0'}`);
30
+ console.error(` Connected to: ${process.env.APPFLOWY_BASE_URL}`);
31
+ console.error(` Tools: workspaces, documents, databases, search, files`);
32
+ }
33
+ catch (error) {
34
+ console.error('❌ Failed to start AppFlowy MCP Server:', error);
35
+ process.exit(1);
36
+ }
37
+ }
38
+ // Graceful shutdown
39
+ process.on('SIGINT', () => {
40
+ console.error('\n👋 Shutting down AppFlowy MCP Server...');
41
+ process.exit(0);
42
+ });
43
+ process.on('SIGTERM', () => {
44
+ console.error('\n👋 Shutting down AppFlowy MCP Server...');
45
+ process.exit(0);
46
+ });
47
+ // Handle uncaught errors
48
+ process.on('uncaughtException', (error) => {
49
+ console.error('💥 Uncaught exception:', error);
50
+ process.exit(1);
51
+ });
52
+ main();
53
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAEA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AACjF,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAE7C,KAAK,UAAU,IAAI;IACjB,IAAI,CAAC;QACH,yBAAyB;QACzB,cAAc,EAAE,CAAC;QAEjB,oBAAoB;QACpB,MAAM,MAAM,GAAG,eAAe,EAAE,CAAC;QAEjC,qDAAqD;QACrD,MAAM,SAAS,GAAG,IAAI,oBAAoB,EAAE,CAAC;QAE7C,MAAM,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;QAEhC,sDAAsD;QACtD,OAAO,CAAC,KAAK,CAAC,4CAA4C,CAAC,CAAC;QAC5D,OAAO,CAAC,KAAK,CAAC,cAAc,OAAO,CAAC,GAAG,CAAC,eAAe,IAAI,qBAAqB,EAAE,CAAC,CAAC;QACpF,OAAO,CAAC,KAAK,CAAC,eAAe,OAAO,CAAC,GAAG,CAAC,kBAAkB,IAAI,OAAO,EAAE,CAAC,CAAC;QAC1E,OAAO,CAAC,KAAK,CAAC,oBAAoB,OAAO,CAAC,GAAG,CAAC,iBAAiB,EAAE,CAAC,CAAC;QACnE,OAAO,CAAC,KAAK,CAAC,2DAA2D,CAAC,CAAC;IAC7E,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,CAAC,KAAK,CAAC,wCAAwC,EAAE,KAAK,CAAC,CAAC;QAC/D,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;AACH,CAAC;AAED,oBAAoB;AACpB,OAAO,CAAC,EAAE,CAAC,QAAQ,EAAE,GAAG,EAAE;IACxB,OAAO,CAAC,KAAK,CAAC,2CAA2C,CAAC,CAAC;IAC3D,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC;AAEH,OAAO,CAAC,EAAE,CAAC,SAAS,EAAE,GAAG,EAAE;IACzB,OAAO,CAAC,KAAK,CAAC,2CAA2C,CAAC,CAAC;IAC3D,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC;AAEH,yBAAyB;AACzB,OAAO,CAAC,EAAE,CAAC,mBAAmB,EAAE,CAAC,KAAK,EAAE,EAAE;IACxC,OAAO,CAAC,KAAK,CAAC,wBAAwB,EAAE,KAAK,CAAC,CAAC;IAC/C,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC;AAEH,IAAI,EAAE,CAAC"}
@@ -0,0 +1,7 @@
1
+ /**
2
+ * AppFlowy MCP Server - MCP Prompts
3
+ * Pre-built prompt templates for common workflows
4
+ */
5
+ import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
6
+ export declare function registerAppFlowyPrompts(server: McpServer): void;
7
+ //# sourceMappingURL=appflowy-prompts.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"appflowy-prompts.d.ts","sourceRoot":"","sources":["../../src/prompts/appflowy-prompts.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAGpE,wBAAgB,uBAAuB,CAAC,MAAM,EAAE,SAAS,QAmIxD"}
@@ -0,0 +1,115 @@
1
+ /**
2
+ * AppFlowy MCP Server - MCP Prompts
3
+ * Pre-built prompt templates for common workflows
4
+ */
5
+ import { z } from 'zod';
6
+ export function registerAppFlowyPrompts(server) {
7
+ // Prompt: Create technical documentation
8
+ server.prompt('appflowy_create_tech_doc', 'Create structured technical documentation in AppFlowy', {
9
+ title: z.string().describe('Document title'),
10
+ topic: z.string().describe('Main topic/subject'),
11
+ workspace_id: z.string().describe('Target workspace ID'),
12
+ }, ({ title, topic, workspace_id }) => ({
13
+ messages: [
14
+ {
15
+ role: 'user',
16
+ content: {
17
+ type: 'text',
18
+ text: `Create a comprehensive technical document in AppFlowy workspace ${workspace_id} with the following structure:
19
+
20
+ **Title**: ${title}
21
+ **Topic**: ${topic}
22
+
23
+ Please:
24
+ 1. Create the document using appflowy_create_document
25
+ 2. Structure it with these sections:
26
+ - Executive Summary
27
+ - Scope & Objectives
28
+ - Architecture / Design
29
+ - Implementation Details
30
+ - Security Considerations
31
+ - References & Links
32
+
33
+ Make it professional and ready for team collaboration.`,
34
+ },
35
+ },
36
+ ],
37
+ }));
38
+ // Prompt: Analyze database
39
+ server.prompt('appflowy_analyze_database', 'Analyze an AppFlowy database and generate insights', {
40
+ workspace_id: z.string().describe('Workspace ID'),
41
+ database_id: z.string().describe('Database/view ID'),
42
+ }, ({ workspace_id, database_id }) => ({
43
+ messages: [
44
+ {
45
+ role: 'user',
46
+ content: {
47
+ type: 'text',
48
+ text: `Analyze the AppFlowy database ${database_id} in workspace ${workspace_id}.
49
+
50
+ Please:
51
+ 1. Read the database structure and all rows using appflowy_read_database
52
+ 2. Identify patterns, trends, and anomalies
53
+ 3. Generate a summary with key insights
54
+ 4. Suggest actionable improvements based on the data
55
+ 5. If appropriate, create a summary document with your findings`,
56
+ },
57
+ },
58
+ ],
59
+ }));
60
+ // Prompt: Meeting notes
61
+ server.prompt('appflowy_meeting_notes', 'Create structured meeting notes in AppFlowy', {
62
+ workspace_id: z.string().describe('Workspace ID'),
63
+ meeting_title: z.string().describe('Meeting title'),
64
+ attendees: z.string().describe('Comma-separated list of attendees'),
65
+ }, ({ workspace_id, meeting_title, attendees }) => ({
66
+ messages: [
67
+ {
68
+ role: 'user',
69
+ content: {
70
+ type: 'text',
71
+ text: `Create meeting notes in AppFlowy workspace ${workspace_id}.
72
+
73
+ **Meeting**: ${meeting_title}
74
+ **Attendees**: ${attendees}
75
+
76
+ Please create a document with this structure:
77
+ - Meeting Details (date, time, attendees)
78
+ - Agenda Items
79
+ - Discussion Points
80
+ - Action Items (with owners and due dates)
81
+ - Decisions Made
82
+ - Next Steps
83
+
84
+ Use appflowy_create_document to create it.`,
85
+ },
86
+ },
87
+ ],
88
+ }));
89
+ // Prompt: Sprint retrospective
90
+ server.prompt('appflowy_sprint_retro', 'Create a sprint retrospective document', {
91
+ workspace_id: z.string().describe('Workspace ID'),
92
+ sprint_number: z.string().describe('Sprint number or name'),
93
+ }, ({ workspace_id, sprint_number }) => ({
94
+ messages: [
95
+ {
96
+ role: 'user',
97
+ content: {
98
+ type: 'text',
99
+ text: `Create a Sprint ${sprint_number} retrospective in AppFlowy workspace ${workspace_id}.
100
+
101
+ Structure:
102
+ - Sprint Overview (dates, goals, team)
103
+ - What Went Well 🟢
104
+ - What Could Be Improved 🟡
105
+ - Action Items for Next Sprint 🔴
106
+ - Metrics & Velocity
107
+ - Team Feedback
108
+
109
+ Create it as a document and make it collaborative.`,
110
+ },
111
+ },
112
+ ],
113
+ }));
114
+ }
115
+ //# sourceMappingURL=appflowy-prompts.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"appflowy-prompts.js","sourceRoot":"","sources":["../../src/prompts/appflowy-prompts.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,CAAC,EAAE,MAAM,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AAC,MAAM,EAAE,CAAC,QAAQ,CAAC,cAAc,CAAC;QACjD,aAAa,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,eAAe,CAAC;QACnD,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,mCAAmC,CAAC;KACpE,EACD,CAAC,EAAE,YAAY,EAAE,aAAa,EAAE,SAAS,EAAE,EAAE,EAAE,CAAC,CAAC;QAC/C,QAAQ,EAAE;YACR;gBACE,IAAI,EAAE,MAAM;gBACZ,OAAO,EAAE;oBACP,IAAI,EAAE,MAAM;oBACZ,IAAI,EAAE,8CAA8C,YAAY;;eAE7D,aAAa;iBACX,SAAS;;;;;;;;;;2CAUiB;iBAChC;aACF;SACF;KACF,CAAC,CACH,CAAC;IAEF,+BAA+B;IAC/B,MAAM,CAAC,MAAM,CACX,uBAAuB,EACvB,wCAAwC,EACxC;QACE,YAAY,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,cAAc,CAAC;QACjD,aAAa,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,uBAAuB,CAAC;KAC5D,EACD,CAAC,EAAE,YAAY,EAAE,aAAa,EAAE,EAAE,EAAE,CAAC,CAAC;QACpC,QAAQ,EAAE;YACR;gBACE,IAAI,EAAE,MAAM;gBACZ,OAAO,EAAE;oBACP,IAAI,EAAE,MAAM;oBACZ,IAAI,EAAE,mBAAmB,aAAa,wCAAwC,YAAY;;;;;;;;;;mDAUnD;iBACxC;aACF;SACF;KACF,CAAC,CACH,CAAC;AACJ,CAAC"}
@@ -0,0 +1,7 @@
1
+ /**
2
+ * AppFlowy MCP Server - MCP Resources
3
+ * Exposes AppFlowy data as MCP resources
4
+ */
5
+ import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
6
+ export declare function registerWorkspaceResources(server: McpServer): void;
7
+ //# sourceMappingURL=workspace-resources.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"workspace-resources.d.ts","sourceRoot":"","sources":["../../src/resources/workspace-resources.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAGpE,wBAAgB,0BAA0B,CAAC,MAAM,EAAE,SAAS,QAwG3D"}