@pollychrome/joan-mcp 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 (83) hide show
  1. package/README.md +385 -0
  2. package/bin/joan-mcp +16 -0
  3. package/dist/auth.d.ts +49 -0
  4. package/dist/auth.d.ts.map +1 -0
  5. package/dist/auth.js +264 -0
  6. package/dist/auth.js.map +1 -0
  7. package/dist/cli.d.ts +7 -0
  8. package/dist/cli.d.ts.map +1 -0
  9. package/dist/cli.js +326 -0
  10. package/dist/cli.js.map +1 -0
  11. package/dist/client/api-client.d.ts +86 -0
  12. package/dist/client/api-client.d.ts.map +1 -0
  13. package/dist/client/api-client.js +182 -0
  14. package/dist/client/api-client.js.map +1 -0
  15. package/dist/client/types.d.ts +270 -0
  16. package/dist/client/types.d.ts.map +1 -0
  17. package/dist/client/types.js +5 -0
  18. package/dist/client/types.js.map +1 -0
  19. package/dist/config.d.ts +33 -0
  20. package/dist/config.d.ts.map +1 -0
  21. package/dist/config.js +71 -0
  22. package/dist/config.js.map +1 -0
  23. package/dist/index.d.ts +14 -0
  24. package/dist/index.d.ts.map +1 -0
  25. package/dist/index.js +118 -0
  26. package/dist/index.js.map +1 -0
  27. package/dist/resources/goals.d.ts +7 -0
  28. package/dist/resources/goals.d.ts.map +1 -0
  29. package/dist/resources/goals.js +49 -0
  30. package/dist/resources/goals.js.map +1 -0
  31. package/dist/resources/index.d.ts +16 -0
  32. package/dist/resources/index.d.ts.map +1 -0
  33. package/dist/resources/index.js +20 -0
  34. package/dist/resources/index.js.map +1 -0
  35. package/dist/resources/milestones.d.ts +7 -0
  36. package/dist/resources/milestones.d.ts.map +1 -0
  37. package/dist/resources/milestones.js +40 -0
  38. package/dist/resources/milestones.js.map +1 -0
  39. package/dist/resources/notes.d.ts +7 -0
  40. package/dist/resources/notes.d.ts.map +1 -0
  41. package/dist/resources/notes.js +33 -0
  42. package/dist/resources/notes.js.map +1 -0
  43. package/dist/resources/projects.d.ts +7 -0
  44. package/dist/resources/projects.d.ts.map +1 -0
  45. package/dist/resources/projects.js +97 -0
  46. package/dist/resources/projects.js.map +1 -0
  47. package/dist/resources/tasks.d.ts +7 -0
  48. package/dist/resources/tasks.d.ts.map +1 -0
  49. package/dist/resources/tasks.js +36 -0
  50. package/dist/resources/tasks.js.map +1 -0
  51. package/dist/tools/goals.d.ts +7 -0
  52. package/dist/tools/goals.d.ts.map +1 -0
  53. package/dist/tools/goals.js +114 -0
  54. package/dist/tools/goals.js.map +1 -0
  55. package/dist/tools/index.d.ts +16 -0
  56. package/dist/tools/index.d.ts.map +1 -0
  57. package/dist/tools/index.js +20 -0
  58. package/dist/tools/index.js.map +1 -0
  59. package/dist/tools/milestones.d.ts +7 -0
  60. package/dist/tools/milestones.d.ts.map +1 -0
  61. package/dist/tools/milestones.js +119 -0
  62. package/dist/tools/milestones.js.map +1 -0
  63. package/dist/tools/notes.d.ts +7 -0
  64. package/dist/tools/notes.d.ts.map +1 -0
  65. package/dist/tools/notes.js +82 -0
  66. package/dist/tools/notes.js.map +1 -0
  67. package/dist/tools/projects.d.ts +7 -0
  68. package/dist/tools/projects.d.ts.map +1 -0
  69. package/dist/tools/projects.js +63 -0
  70. package/dist/tools/projects.js.map +1 -0
  71. package/dist/tools/tasks.d.ts +7 -0
  72. package/dist/tools/tasks.d.ts.map +1 -0
  73. package/dist/tools/tasks.js +125 -0
  74. package/dist/tools/tasks.js.map +1 -0
  75. package/dist/utils/converters.d.ts +78 -0
  76. package/dist/utils/converters.d.ts.map +1 -0
  77. package/dist/utils/converters.js +79 -0
  78. package/dist/utils/converters.js.map +1 -0
  79. package/dist/utils/errors.d.ts +27 -0
  80. package/dist/utils/errors.d.ts.map +1 -0
  81. package/dist/utils/errors.js +104 -0
  82. package/dist/utils/errors.js.map +1 -0
  83. package/package.json +53 -0
package/README.md ADDED
@@ -0,0 +1,385 @@
1
+ # Joan MCP Server
2
+
3
+ Model Context Protocol (MCP) server for the Joan productivity app. Enables AI assistants like Claude Code to interact with your projects, tasks, goals, milestones, and notes.
4
+
5
+ ## Features
6
+
7
+ - **Read & Write Access**: Full CRUD operations for projects, tasks, goals, milestones, and notes
8
+ - **Secure Authentication**: Login via browser with encrypted token storage
9
+ - **Claude Code Integration**: Works seamlessly with Claude Code and other MCP clients
10
+ - **Self-Describing**: Automatically provides usage instructions to AI assistants via MCP protocol
11
+ - **Production API**: Connects directly to your Joan account data
12
+
13
+ ## Installation
14
+
15
+ ### Option 1: Global Install via npm link (Recommended for Development)
16
+
17
+ ```bash
18
+ cd mcp-server
19
+ npm install
20
+ npm run build
21
+ npm link
22
+
23
+ # Now available globally:
24
+ joan-mcp init
25
+ ```
26
+
27
+ ### Option 2: npm Install (After Publishing)
28
+
29
+ ```bash
30
+ npm install -g @joan/mcp-server
31
+
32
+ # Or run directly without installing:
33
+ npx @joan/mcp-server init
34
+ ```
35
+
36
+ ### Option 3: From Source (Development)
37
+
38
+ ```bash
39
+ cd mcp-server
40
+ npm install
41
+ npx tsx src/cli.ts init
42
+ ```
43
+
44
+ ## Quick Start (Recommended)
45
+
46
+ Run the setup wizard to authenticate and configure Claude Code in one command:
47
+
48
+ ```bash
49
+ # From source
50
+ cd /path/to/Joan/mcp-server && npx tsx src/cli.ts init
51
+
52
+ # Or after global install
53
+ joan-mcp init
54
+ ```
55
+
56
+ This will:
57
+ 1. Open your browser to authenticate with Joan
58
+ 2. Store the token encrypted in `~/.joan-mcp/credentials.json`
59
+ 3. Automatically configure Claude Code to use Joan MCP
60
+
61
+ After setup, restart Claude Code and you're ready to go!
62
+
63
+ ## Using Joan MCP in Other Projects
64
+
65
+ Once you've completed the initial setup above, you can use Joan MCP from **any project repository**. This lets you create tasks, track progress, and manage your work directly while coding on other projects.
66
+
67
+ ### Option A: Global Configuration (Recommended)
68
+
69
+ Add Joan MCP to your global Claude Code settings so it's available in all projects:
70
+
71
+ **Location:** `~/.claude/settings.json`
72
+
73
+ ```json
74
+ {
75
+ "mcpServers": {
76
+ "joan": {
77
+ "command": "npx",
78
+ "args": ["tsx", "/Users/YOUR_USERNAME/Joan/mcp-server/src/cli.ts", "serve"]
79
+ }
80
+ }
81
+ }
82
+ ```
83
+
84
+ Replace `/Users/YOUR_USERNAME/Joan` with the actual path to your Joan repository.
85
+
86
+ ### Option B: Per-Project Configuration
87
+
88
+ Add Joan MCP to a specific project by creating/editing `.claude/settings.json` in that project's root:
89
+
90
+ ```json
91
+ {
92
+ "mcpServers": {
93
+ "joan": {
94
+ "command": "npx",
95
+ "args": ["tsx", "/Users/YOUR_USERNAME/Joan/mcp-server/src/cli.ts", "serve"]
96
+ }
97
+ }
98
+ }
99
+ ```
100
+
101
+ ### Verifying the Connection
102
+
103
+ After configuring, restart Claude Code and verify Joan MCP is connected:
104
+
105
+ 1. Start Claude Code in your other project
106
+ 2. Ask: "Show me my Joan projects"
107
+ 3. If connected, you'll see your projects list
108
+
109
+ ### Example Workflows
110
+
111
+ **While working on another project, you can:**
112
+
113
+ ```
114
+ "Create a task in my Joan project for the bug I just found in this codebase"
115
+
116
+ "Add a note in Joan about the architecture decisions I'm making here"
117
+
118
+ "What tasks do I have assigned in my Backend Refactor project?"
119
+
120
+ "Mark my 'Review PR #42' task as completed in Joan"
121
+
122
+ "Create a milestone in Joan called 'v2.0 Release' for my current sprint"
123
+ ```
124
+
125
+ ### How It Works (Self-Describing Server)
126
+
127
+ Joan MCP uses the MCP protocol's `instructions` field to automatically describe itself to AI assistants. When Claude Code connects to the Joan MCP server, it receives:
128
+
129
+ - A description of what Joan is
130
+ - All available tools and their parameters
131
+ - All available resources and their URIs
132
+ - Usage guidelines and valid field values
133
+
134
+ **This means you don't need to manually document Joan in your CLAUDE.md files** - the server tells Claude Code everything it needs to know during initialization.
135
+
136
+ ### Troubleshooting Other-Project Setup
137
+
138
+ **Joan MCP not appearing:**
139
+ 1. Ensure the path to Joan repository is absolute (starts with `/`)
140
+ 2. Verify Joan's mcp-server has dependencies installed: `cd /path/to/Joan/mcp-server && npm install`
141
+ 3. Restart Claude Code completely (not just the conversation)
142
+
143
+ **Authentication errors:**
144
+ - Credentials are stored globally at `~/.joan-mcp/credentials.json`
145
+ - Re-authenticate from any directory: `cd /path/to/Joan/mcp-server && npx tsx src/cli.ts login`
146
+
147
+ ## Manual Setup
148
+
149
+ If you prefer to set up manually, follow these steps:
150
+
151
+ ### Step 1: Authenticate
152
+
153
+ ```bash
154
+ # From source
155
+ npx tsx src/cli.ts login
156
+
157
+ # Or after global install
158
+ joan-mcp login
159
+ ```
160
+
161
+ ### Step 2: Configure Claude Code
162
+
163
+ Add the Joan MCP server to your Claude Code configuration:
164
+
165
+ **For development (from source):**
166
+
167
+ Add to `~/.config/claude-code/settings.json` or your project's `.claude/settings.json`:
168
+
169
+ ```json
170
+ {
171
+ "mcpServers": {
172
+ "joan": {
173
+ "command": "npx",
174
+ "args": ["tsx", "/path/to/Joan/mcp-server/src/cli.ts", "serve"]
175
+ }
176
+ }
177
+ }
178
+ ```
179
+
180
+ **After global install:**
181
+
182
+ ```json
183
+ {
184
+ "mcpServers": {
185
+ "joan": {
186
+ "command": "joan-mcp",
187
+ "args": ["serve"]
188
+ }
189
+ }
190
+ }
191
+ ```
192
+
193
+ ### Alternative: Environment Variable
194
+
195
+ Instead of using `joan-mcp login`, you can set the token directly:
196
+
197
+ ```json
198
+ {
199
+ "mcpServers": {
200
+ "joan": {
201
+ "command": "joan-mcp",
202
+ "args": ["serve"],
203
+ "env": {
204
+ "JOAN_AUTH_TOKEN": "your-jwt-token-here"
205
+ }
206
+ }
207
+ }
208
+ }
209
+ ```
210
+
211
+ ## CLI Commands
212
+
213
+ | Command | Description |
214
+ |---------|-------------|
215
+ | `joan-mcp init` | Full setup wizard (login + configure Claude Code) |
216
+ | `joan-mcp login` | Authenticate with Joan (opens browser) |
217
+ | `joan-mcp logout` | Clear stored credentials |
218
+ | `joan-mcp status` | Show authentication status |
219
+ | `joan-mcp serve` | Start the MCP server (default) |
220
+ | `joan-mcp help` | Show help message |
221
+
222
+ ## Available Tools
223
+
224
+ These tools allow AI assistants to modify data in Joan:
225
+
226
+ ### Task Tools
227
+
228
+ | Tool | Description |
229
+ |------|-------------|
230
+ | `create_task` | Create a new task in a project |
231
+ | `update_task` | Update task title, description, status, priority, etc. |
232
+ | `complete_task` | Mark a task as completed |
233
+ | `delete_task` | Delete a task |
234
+
235
+ ### Project Tools
236
+
237
+ | Tool | Description |
238
+ |------|-------------|
239
+ | `create_project` | Create a new project |
240
+ | `update_project` | Update project name, description, status |
241
+
242
+ ### Milestone Tools
243
+
244
+ | Tool | Description |
245
+ |------|-------------|
246
+ | `create_milestone` | Create a milestone in a project |
247
+ | `update_milestone` | Update milestone details |
248
+ | `delete_milestone` | Delete a milestone |
249
+ | `link_tasks_to_milestone` | Link tasks to a milestone |
250
+ | `unlink_task_from_milestone` | Remove task from milestone |
251
+
252
+ ### Goal Tools
253
+
254
+ | Tool | Description |
255
+ |------|-------------|
256
+ | `create_goal` | Create a new goal |
257
+ | `update_goal` | Update goal title, status, progress |
258
+ | `delete_goal` | Delete a goal |
259
+ | `link_task_to_goal` | Link a task to track progress |
260
+ | `unlink_task_from_goal` | Remove task from goal |
261
+
262
+ ### Note Tools
263
+
264
+ | Tool | Description |
265
+ |------|-------------|
266
+ | `create_note` | Create a new note |
267
+ | `update_note` | Update note content and metadata |
268
+ | `delete_note` | Delete a note |
269
+
270
+ ## Available Resources
271
+
272
+ These resources provide read-only access to Joan data:
273
+
274
+ | Resource URI | Description |
275
+ |--------------|-------------|
276
+ | `joan://projects` | List all projects |
277
+ | `joan://projects/{id}` | Project details with stats |
278
+ | `joan://projects/{id}/tasks` | Tasks in a project |
279
+ | `joan://projects/{id}/milestones` | Project milestones |
280
+ | `joan://projects/{id}/columns` | Kanban columns |
281
+ | `joan://projects/{id}/analytics` | Project analytics |
282
+ | `joan://tasks` | All user tasks |
283
+ | `joan://tasks/{id}` | Task details |
284
+ | `joan://goals` | All goals |
285
+ | `joan://goals/{id}` | Goal with linked tasks |
286
+ | `joan://goals/{id}/stats` | Goal statistics |
287
+ | `joan://notes` | All notes |
288
+ | `joan://notes/{id}` | Note details |
289
+
290
+ ## Usage Examples
291
+
292
+ Once configured, you can interact with Joan through Claude Code:
293
+
294
+ ### View Projects
295
+
296
+ ```
297
+ "Show me all my projects in Joan"
298
+ ```
299
+
300
+ ### Create Tasks
301
+
302
+ ```
303
+ "Create a task in my 'Website Redesign' project for implementing the new header component"
304
+ ```
305
+
306
+ ### Update Task Status
307
+
308
+ ```
309
+ "Mark task ABC-123 as completed"
310
+ ```
311
+
312
+ ### Create Milestones
313
+
314
+ ```
315
+ "Create a milestone called 'Beta Release' in my project with a target date of next Friday"
316
+ ```
317
+
318
+ ### Link Tasks to Milestones
319
+
320
+ ```
321
+ "Link these 3 tasks to the Beta Release milestone"
322
+ ```
323
+
324
+ ### Check Progress
325
+
326
+ ```
327
+ "What's the progress on my Q4 Goals?"
328
+ ```
329
+
330
+ ## Development
331
+
332
+ ### Run in Development Mode
333
+
334
+ ```bash
335
+ cd mcp-server
336
+ npm run dev
337
+ ```
338
+
339
+ ### Type Check
340
+
341
+ ```bash
342
+ npm run typecheck
343
+ ```
344
+
345
+ ### Build
346
+
347
+ ```bash
348
+ npm run build
349
+ ```
350
+
351
+ ## Environment Variables
352
+
353
+ | Variable | Description | Default |
354
+ |----------|-------------|---------|
355
+ | `JOAN_AUTH_TOKEN` | JWT authentication token | (from login) |
356
+ | `JOAN_API_URL` | API base URL | `https://joan-api.alexbbenson.workers.dev/api/v1` |
357
+
358
+ ## Security
359
+
360
+ - Authentication tokens are encrypted at rest using AES-256-GCM
361
+ - Tokens are stored in `~/.joan-mcp/credentials.json` with restricted permissions (600)
362
+ - Tokens expire after 7 days
363
+ - You can revoke MCP access from your Joan profile settings
364
+
365
+ ## Troubleshooting
366
+
367
+ ### "Authentication failed"
368
+
369
+ 1. Run `joan-mcp logout` to clear credentials
370
+ 2. Run `joan-mcp login` to re-authenticate
371
+ 3. Verify your Joan account is active
372
+
373
+ ### "Token expired"
374
+
375
+ Tokens expire after 7 days. Simply run `joan-mcp login` again.
376
+
377
+ ### MCP server not connecting
378
+
379
+ 1. Check that the path in your Claude Code config is correct
380
+ 2. Verify the server starts: `npx tsx src/cli.ts serve`
381
+ 3. Check for any error messages in the output
382
+
383
+ ## License
384
+
385
+ MIT
package/bin/joan-mcp ADDED
@@ -0,0 +1,16 @@
1
+ #!/usr/bin/env node
2
+
3
+ // Entry point for joan-mcp CLI
4
+ // This file is referenced in package.json "bin" field
5
+
6
+ import { fileURLToPath } from 'node:url';
7
+ import { dirname, join } from 'node:path';
8
+
9
+ const __dirname = dirname(fileURLToPath(import.meta.url));
10
+ const cliPath = join(__dirname, '..', 'dist', 'cli.js');
11
+
12
+ import(cliPath).catch((err) => {
13
+ console.error('Failed to load Joan MCP CLI:', err.message);
14
+ console.error('Make sure to run "npm run build" first.');
15
+ process.exit(1);
16
+ });
package/dist/auth.d.ts ADDED
@@ -0,0 +1,49 @@
1
+ /**
2
+ * Auth token management for Joan MCP server
3
+ * Handles storing, retrieving, and validating auth tokens
4
+ */
5
+ /**
6
+ * Store auth token securely
7
+ */
8
+ export declare function storeToken(token: string, email?: string, expiresAt?: Date): Promise<void>;
9
+ /**
10
+ * Retrieve stored auth token
11
+ */
12
+ export declare function getStoredToken(): Promise<{
13
+ token: string;
14
+ email?: string;
15
+ expiresAt?: Date;
16
+ } | null>;
17
+ /**
18
+ * Clear stored token
19
+ */
20
+ export declare function clearToken(): Promise<void>;
21
+ /**
22
+ * Get auth token from stored credentials or environment variable
23
+ */
24
+ export declare function getAuthToken(): Promise<string>;
25
+ /**
26
+ * Parse JWT to extract payload (without verification)
27
+ */
28
+ export declare function parseJwt(token: string): {
29
+ sub?: string;
30
+ email?: string;
31
+ exp?: number;
32
+ } | null;
33
+ /**
34
+ * Check if token is expired based on JWT payload
35
+ */
36
+ export declare function isTokenExpired(token: string): boolean;
37
+ /**
38
+ * Start local HTTP server for OAuth callback
39
+ * Returns a promise that resolves with the token when received
40
+ */
41
+ export declare function startCallbackServer(port: number): Promise<{
42
+ token: string;
43
+ email?: string;
44
+ }>;
45
+ /**
46
+ * Find an available port for the callback server
47
+ */
48
+ export declare function findAvailablePort(startPort?: number): Promise<number>;
49
+ //# sourceMappingURL=auth.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../src/auth.ts"],"names":[],"mappings":"AAAA;;;GAGG;AA8EH;;GAEG;AACH,wBAAsB,UAAU,CAC9B,KAAK,EAAE,MAAM,EACb,KAAK,CAAC,EAAE,MAAM,EACd,SAAS,CAAC,EAAE,IAAI,GACf,OAAO,CAAC,IAAI,CAAC,CAgBf;AAED;;GAEG;AACH,wBAAsB,cAAc,IAAI,OAAO,CAAC;IAC9C,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,IAAI,CAAC;CAClB,GAAG,IAAI,CAAC,CA4BR;AAED;;GAEG;AACH,wBAAsB,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC,CAQhD;AAED;;GAEG;AACH,wBAAsB,YAAY,IAAI,OAAO,CAAC,MAAM,CAAC,CAepD;AAED;;GAEG;AACH,wBAAgB,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG;IAAE,GAAG,CAAC,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IAAC,GAAG,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,IAAI,CAW7F;AAED;;GAEG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAMrD;AAED;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC,CAgF5F;AAED;;GAEG;AACH,wBAAsB,iBAAiB,CAAC,SAAS,GAAE,MAAa,GAAG,OAAO,CAAC,MAAM,CAAC,CAiBjF"}