@promptprojectmanager/mcp-server 2.8.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/README.md ADDED
@@ -0,0 +1,516 @@
1
+ # @promptprojectmanager/mcp-server
2
+
3
+ MCP server that exposes Prompt Project Manager workspace prompts through dual interfaces: **Prompts** (slash commands) and **Tools** (AI-discoverable).
4
+
5
+ ## Overview
6
+
7
+ `@promptprojectmanager/mcp-server` is a standalone npm package that integrates your Prompt Project Manager workspace with Claude Code via the Model Context Protocol (MCP). It exposes your prompts through **two complementary interfaces**:
8
+
9
+ 1. **Prompts Interface** (Slash Commands) - Explicitly invoke prompts via `/ppm:workspace:prompt` commands
10
+ 2. **Tools Interface** (AI Discovery) - AI assistants can discover and invoke prompts naturally through conversation
11
+
12
+ Both interfaces use the same underlying prompts and return identical flattened content. Choose explicit commands when you know exactly which prompt to use, or let the AI discover the right prompt for your task.
13
+
14
+ ## Features
15
+
16
+ - 🔐 **Secure Authentication** - Uses API keys from your Prompt Project Manager Settings page
17
+ - 🎯 **Selective Exposure** - Only prompts with "Expose to MCP" enabled appear
18
+ - 🏢 **Workspace Scoping** - Commands namespaced by workspace (e.g., `personal-prompt`, `work-prompt`)
19
+ - 🤖 **Dual Interface** - Both slash commands AND AI-discoverable tools
20
+ - ⚡ **Zero Configuration** - Works out of the box with `npx`
21
+ - 📝 **Flattened Content** - Returns pre-computed prompts with all resources embedded
22
+ - 🔄 **Flexible Caching** - Choose between cached (fast) or lazy loading (always fresh) modes
23
+
24
+ ## Installation
25
+
26
+ No installation required! Use `npx` to run the server directly:
27
+
28
+ ```bash
29
+ npx @promptprojectmanager/mcp-server
30
+ ```
31
+
32
+ ## Configuration
33
+
34
+ ### Quick Start (Recommended)
35
+
36
+ **The easiest way to configure the MCP server is through Prompt Project Manager Settings page**:
37
+
38
+ 1. Visit https://promptprojectmanager.com/settings
39
+ 2. Scroll to "MCP Server Configuration" section
40
+ 3. Select your CLI tool (Claude Code, Codex CLI, or Gemini CLI)
41
+ 4. Toggle "Lazy Loading" ON or OFF based on your preference
42
+ 5. Click "Copy Configuration" button
43
+ 6. Paste the configuration into your CLI's settings file
44
+
45
+ The settings page automatically generates the correct format (JSON or TOML) with your API key pre-filled and `@latest` package versioning. See [Multi-CLI Support](#multi-cli-support) below for details on each CLI tool.
46
+
47
+ ### Manual Configuration
48
+
49
+ If you prefer to configure manually:
50
+
51
+ **Step 1: Get Your API Key**
52
+
53
+ 1. Visit your Prompt Project Manager Settings page: https://promptprojectmanager.com/settings
54
+ 2. Your API key is auto-generated and displayed in the "API Keys" section
55
+ 3. Copy your API key (starts with `api_key_`)
56
+
57
+ **Step 2: Configure Your CLI Tool**
58
+
59
+ #### Claude Code (JSON)
60
+
61
+ Add to your Claude Code MCP settings:
62
+
63
+ ```json
64
+ {
65
+ "mcpServers": {
66
+ "tpe": {
67
+ "command": "npx",
68
+ "args": ["@promptprojectmanager/mcp-server@latest"],
69
+ "env": {
70
+ "PPM_API_KEY": "your_api_key_here"
71
+ }
72
+ }
73
+ }
74
+ }
75
+ ```
76
+
77
+ #### Codex CLI (TOML)
78
+
79
+ Add to `~/.codex/config.toml` in the `[mcp_servers]` section:
80
+
81
+ ```toml
82
+ [mcp_servers.tpe]
83
+ command = "npx"
84
+ args = ["@promptprojectmanager/mcp-server@latest"]
85
+
86
+ [mcp_servers.tpe.env]
87
+ PPM_API_KEY = "your_api_key_here"
88
+ ```
89
+
90
+ #### Gemini CLI (JSON)
91
+
92
+ Add to `~/.gemini/settings.json` in the `mcpServers` object:
93
+
94
+ ```json
95
+ {
96
+ "mcpServers": {
97
+ "tpe": {
98
+ "command": "npx",
99
+ "args": ["@promptprojectmanager/mcp-server@latest"],
100
+ "env": {
101
+ "PPM_API_KEY": "your_api_key_here"
102
+ }
103
+ }
104
+ }
105
+ }
106
+ ```
107
+
108
+ **With Lazy Loading:**
109
+
110
+ Add `--lazy-loading` to the args array for any CLI:
111
+
112
+ ```json
113
+ "args": ["@promptprojectmanager/mcp-server@latest", "--lazy-loading"]
114
+ ```
115
+
116
+ See [Caching Modes](#caching-modes) below to choose which configuration is right for you.
117
+
118
+ ### Step 3: Enable Prompts for MCP
119
+
120
+ 1. Open any prompt in your ContextFS workspace
121
+ 2. Check the "Expose to MCP" checkbox in the prompt editor
122
+ 3. Save the prompt
123
+ 4. Restart Claude Code to refresh available tools
124
+
125
+ ## Two Ways to Use Prompts
126
+
127
+ ### 1. Prompts Interface (Slash Commands)
128
+
129
+ Explicitly invoke prompts by typing slash commands. Great when you know exactly which prompt you need.
130
+
131
+ **Usage:**
132
+ ```
133
+ User: /ppm:personal-code-review
134
+ User: /ppm:work-api-design
135
+ User: /ppm:personal-technical-analysis
136
+ ```
137
+
138
+ **Pattern:**
139
+ - Format: `/ppm:workspace-prompt`
140
+ - Example: workspace slug "personal" + prompt slug "code-review" = `/ppm:personal-code-review`
141
+
142
+ **Note:**
143
+ - MCP protocol requires tool names to use only `[a-zA-Z0-9_-]` characters
144
+ - Hyphens (`-`) are used as separators between workspace and prompt
145
+ - **Folders are NOT included in slash commands** (only used for ZIP download organization)
146
+
147
+ ### 2. Tools Interface (AI Discovery)
148
+
149
+ Let AI assistants discover and invoke prompts naturally through conversation. Great for exploratory workflows.
150
+
151
+ **Usage:**
152
+ ```
153
+ User: "Help me review this code"
154
+ AI: [Discovers and invokes code-review tool]
155
+
156
+ User: "I need to plan a new feature"
157
+ AI: [Discovers and invokes planning tool from appropriate folder]
158
+ ```
159
+
160
+ **How it works:**
161
+ - Each prompt appears as a discoverable tool
162
+ - AI reads tool descriptions to match user intent
163
+ - AI invokes the appropriate tool automatically
164
+ - Same flattened content as slash commands
165
+
166
+ ## Command Naming Convention
167
+
168
+ The MCP server uses a hierarchical workspace-scoped naming convention for slash commands.
169
+
170
+ ### Format
171
+
172
+ **Pattern:** `workspace:prompt`
173
+
174
+ All commands follow this two-part format:
175
+ 1. Workspace slug (e.g., `personal`, `work`)
176
+ 2. Prompt slug (e.g., `code-review`, `api-design`)
177
+ 3. Separated by a colon (`:`)
178
+
179
+ ### Examples
180
+
181
+ **Command structure:**
182
+ - `/ppm:personal:code-review` → workspace: `personal`, prompt: `code-review`
183
+ - `/ppm:work:api-design` → workspace: `work`, prompt: `api-design`
184
+ - `/ppm:personal:technical-analysis` → workspace: `personal`, prompt: `technical-analysis`
185
+
186
+ **Character rules:**
187
+ - MCP protocol allows: `[a-zA-Z0-9_:-]`
188
+ - Hierarchy separator: `:` (colon) between workspace and prompt
189
+ - Word separator: `-` (hyphen) within multi-word slugs
190
+ - The `/ppm:` prefix is added by Claude Code (MCP namespace)
191
+ - The actual tool name is `workspace:prompt` (e.g., `personal:code-review`)
192
+
193
+ ### Folder Organization
194
+
195
+ **Important:** Folders are NOT included in slash command names.
196
+
197
+ - Folders are used only for ZIP download organization
198
+ - Multiple prompts with the same slug but different folders will have identical slash commands
199
+ - To avoid conflicts, ensure prompt slugs are unique across your entire workspace
200
+
201
+ ## Caching Modes
202
+
203
+ The MCP server supports two caching modes to fit different workflows. Choose based on how frequently you update your prompts:
204
+
205
+ ### Cached Mode (Default)
206
+
207
+ **How it works:**
208
+ - Prompts are fetched **once** when the MCP server starts
209
+ - Tool executions use the cached `flattenedPrompt` content
210
+ - Fast execution with minimal database queries
211
+
212
+ **Choose this if you:**
213
+ - Have stable, infrequently-changed prompts
214
+ - Want the fastest possible tool execution
215
+ - Prefer minimal network overhead
216
+ - Don't mind restarting Claude Code after editing prompts
217
+
218
+ **Configuration:** Use basic config without any flags (see Step 2 above)
219
+
220
+ ### Lazy Loading Mode
221
+
222
+ **How it works:**
223
+ - Prompts are fetched **fresh from Convex on each tool invocation**
224
+ - Always returns the latest `flattenedPrompt` content
225
+ - Falls back to cached version on fetch errors
226
+
227
+ **Choose this if you:**
228
+ - Actively iterate on prompt content frequently
229
+ - Want changes to take effect immediately without restarts
230
+ - Prefer convenience over maximum performance
231
+ - Have a stable internet connection
232
+
233
+ **Configuration:** Add `--lazy-loading` to the args array (see Step 2 above)
234
+
235
+ **Example workflow:**
236
+ ```bash
237
+ # With lazy loading enabled:
238
+ # 1. Edit prompt in ContextFS web UI
239
+ # 2. Save changes
240
+ # 3. Run tool in Claude Code → sees new content immediately
241
+ # 4. No Claude Code restart required!
242
+ ```
243
+
244
+ **Performance Note:** Lazy loading adds ~50-100ms per tool invocation for the database fetch. For most use cases, this overhead is negligible compared to Claude's processing time.
245
+
246
+ ## Multi-CLI Support
247
+
248
+ The MCP server works with multiple CLI tools. Each CLI has slightly different configuration requirements:
249
+
250
+ ### Claude Code
251
+
252
+ **Configuration Location:** Claude Code settings UI (MCP Servers section)
253
+ **Format:** JSON
254
+ **Installation:** https://claude.com/claude-code
255
+
256
+ Claude Code is Anthropic's official AI-powered code editor with native MCP support. Configuration is managed through the settings UI.
257
+
258
+ ### Codex CLI
259
+
260
+ **Configuration Location:** `~/.codex/config.toml` (paste into `[mcp_servers]` section)
261
+ **Format:** TOML
262
+ **Installation:** https://developers.openai.com/codex/mcp
263
+
264
+ OpenAI's command-line interface for AI-assisted development. Uses TOML format for configuration.
265
+
266
+ **Note:** When pasting the TOML configuration, add it to the existing `[mcp_servers]` section in your config file, or create the section if it doesn't exist. Don't replace your entire config file.
267
+
268
+ ### Gemini CLI
269
+
270
+ **Configuration Location:** `~/.gemini/settings.json` (paste into `mcpServers` object)
271
+ **Format:** JSON
272
+ **Installation:** https://ai.google.dev/gemini-api/docs/cli
273
+
274
+ Google's Gemini CLI for AI-powered development workflows. Uses the same JSON format as Claude Code.
275
+
276
+ **Note:** When pasting the JSON configuration, add the `tpe` object to the existing `mcpServers` object in your settings file, or create the object if it doesn't exist. Don't replace your entire settings file.
277
+
278
+ ### Recommended Approach
279
+
280
+ For all CLI tools, we recommend using Prompt Project Manager Settings page (https://promptprojectmanager.com/settings) to generate your configuration:
281
+
282
+ 1. Select your CLI tool from the dropdown
283
+ 2. Toggle lazy loading based on your workflow
284
+ 3. Click "Copy Configuration"
285
+ 4. Paste into the appropriate config file for your CLI
286
+
287
+ This ensures correct formatting, proper API key inclusion, and use of `@latest` versioning for automatic updates.
288
+
289
+ ## System Tools
290
+
291
+ In addition to your workspace prompts, the MCP server provides built-in system tools:
292
+
293
+ ### `list_prompts`
294
+
295
+ Lists all available prompts in alphabetical order by tool name. Optionally filter by search term.
296
+
297
+ **Parameters:**
298
+ - `search` (optional, string): Filter prompts by name or description (case-insensitive)
299
+
300
+ **Examples:**
301
+
302
+ ```
303
+ # List all available prompts
304
+ User: "Use list_prompts to see what's available"
305
+
306
+ # Search for specific prompts
307
+ User: "Use list_prompts with search 'review'"
308
+ User: "Use list_prompts with search 'documentation'"
309
+ ```
310
+
311
+ **Output Format:**
312
+ - Shows tool name, bundle, and description for each prompt
313
+ - Displays total count
314
+ - Sorts results alphabetically by tool name
315
+
316
+ ## Environment Variables
317
+
318
+ | Variable | Required | Description |
319
+ |----------|----------|-------------|
320
+ | `PPM_API_KEY` | Yes | Your Prompt Project Manager API key from Settings page |
321
+
322
+ ## Usage Example
323
+
324
+ Once configured, your prompts appear as tools in Claude Code:
325
+
326
+ ```
327
+ User: "Use the code-reviewer tool to review my changes"
328
+
329
+ Claude Code: [Invokes development/code-reviewer tool]
330
+ Tool Response: [Returns flattened prompt with all embedded resources]
331
+ ```
332
+
333
+ ## Troubleshooting
334
+
335
+ ### No Tools Available
336
+
337
+ **Problem**: Claude Code shows no tools from ContextFS
338
+
339
+ **Solutions**:
340
+ 1. Verify at least one prompt has "Expose to MCP" enabled
341
+ 2. Check that your API key is correct in `.mcp.json`
342
+ 3. Restart Claude Code to refresh the tool list
343
+ 4. Check MCP server logs for authentication errors
344
+
345
+ ### Invalid API Key
346
+
347
+ **Problem**: Server fails to start with "Invalid API key" error
348
+
349
+ **Solutions**:
350
+ 1. Copy your API key exactly from Settings page
351
+ 2. Ensure no extra spaces or quotes around the key
352
+ 3. Regenerate your API key if it was recently changed
353
+ 4. Verify the key is set in the `PPM_API_KEY` environment variable
354
+
355
+ ### Missing Flattened Content
356
+
357
+ **Problem**: Tool execution fails with "no flattened content" error
358
+
359
+ **Solutions**:
360
+ 1. Open the affected prompt in ContextFS
361
+ 2. Make a minor edit (add a space, then remove it)
362
+ 3. Save the prompt to trigger re-flattening
363
+ 4. Restart the MCP server
364
+
365
+ ### Stale Prompt Content
366
+
367
+ **Problem**: Prompt edits don't appear when running tools in Claude Code
368
+
369
+ **Solutions**:
370
+ 1. **Enable lazy loading**: Add `--lazy-loading` to the args array in your `.mcp.json` config to always fetch fresh content
371
+ 2. **Or restart Claude Code**: If using cached mode, restart Claude Code to refresh the cached prompts
372
+ 3. **Verify mode**: Check MCP server logs to see which caching mode is active (look for "Lazy loading: ENABLED" or "DISABLED")
373
+
374
+ ## How It Works
375
+
376
+ 1. **Startup**: Server validates your API key with Convex
377
+ 2. **Tool Registration**: Fetches all prompts with `exposeToMcp: true`
378
+ 3. **Tool Creation**: Builds MCP tool schemas with bundle-aware naming
379
+ 4. **Execution**: Returns `flattenedPrompt` content when tools are invoked
380
+ 5. **Logging**: Outputs diagnostic info to stderr (visible in Claude Code logs)
381
+
382
+ ## Development
383
+
384
+ ### Building from Source
385
+
386
+ ```bash
387
+ # Clone the repository
388
+ git clone https://github.com/promptprojectmanager/promptprojectmanager
389
+ cd promptprojectmanager/packages/mcp-server
390
+
391
+ # Install dependencies
392
+ npm install
393
+
394
+ # Build the package
395
+ npm run build
396
+
397
+ # Test locally
398
+ npm link
399
+ PPM_API_KEY=your_key npx @promptprojectmanager/mcp-server
400
+ ```
401
+
402
+ ### Package Structure
403
+
404
+ ```
405
+ packages/mcp-server/
406
+ ├── src/
407
+ │ ├── index.ts # CLI entry point with argument parsing
408
+ │ ├── server.ts # MCP server logic and tool registration
409
+ │ ├── convex-client.ts # Convex HTTP client initialization
410
+ │ ├── tool-builder.ts # Tool naming and schema generation
411
+ │ └── types.ts # TypeScript type definitions
412
+ ├── dist/ # Compiled output (generated)
413
+ ├── package.json
414
+ ├── tsconfig.json
415
+ ├── tsup.config.ts # Build configuration
416
+ └── README.md
417
+ ```
418
+
419
+ ## Version History
420
+
421
+ ### 2.0.6 (2025-11-16) - Bug Fix & Documentation Update
422
+
423
+ **Bug Fixes:**
424
+ - Fixed field name mismatch (`folderPath` vs `folder`) preventing proper data flow from backend
425
+ - Removed folder-based command scoping (folders only used for ZIP downloads now)
426
+ - Simplified to clean `workspace-prompt` format for all slash commands
427
+
428
+ **Documentation Updates:**
429
+ - Clarified that folders are NOT included in slash command names
430
+ - Updated all examples to show simple `workspace-prompt` format
431
+ - Added warning about slug uniqueness requirement across workspace
432
+
433
+ **Impact:**
434
+ - Simple, predictable command names
435
+ - No breaking changes for existing users (folder scoping never actually worked)
436
+
437
+ ### 2.0.2 (2025-11-06) - Character Sanitization Fix (DEPRECATED)
438
+
439
+ **Note:** Folder-based scoping was never functional due to field name bug. See v2.0.6 for correct implementation.
440
+
441
+ - Attempted to fix period (`.`) handling in folder paths
442
+ - Example: `.claude/commands` → `claude-commands`
443
+
444
+ ### 2.0.1 (2025-11-06) - MCP Validation Fix (DEPRECATED)
445
+
446
+ **Note:** Folder-based scoping was never functional due to field name bug. See v2.0.6 for correct implementation.
447
+
448
+ - Changed separators for MCP protocol compliance: colon (`:`) → underscore (`_`), slash (`/`) → hyphen (`-`)
449
+ - Tool name pattern: `[a-zA-Z0-9_-]`
450
+
451
+ ### 2.0.0 (2025-11-06) - Dual Interface Release (DEPRECATED)
452
+
453
+ **Note:** Folder-based scoping was never functional due to field name bug. See v2.0.6 for correct implementation.
454
+
455
+ **Working Feature:**
456
+ - **Dual Interface Architecture** - Added Tools interface alongside Prompts interface
457
+ - Each prompt appears as both a slash command AND an AI-discoverable tool
458
+
459
+ **Non-Functional Feature:**
460
+ - Folder-based command scoping was documented but never worked due to backend field mismatch
461
+ - Fixed in v2.0.3 with simplified workspace-prompt format
462
+
463
+ ### 1.4.0 (2025-11-05)
464
+ - **Breaking Change**: Namespace shortened from `theprompteditor` to `ppm`
465
+ - Users must update `.mcp.json` server key to `"ppm"`
466
+ - All slash commands now use `/ppm:workspace:prompt` format
467
+ - Migration: One-line config change, see README for details
468
+
469
+ ### 1.3.2 (2025-10-30)
470
+ - **Breaking Change**: Removed `ppm:` prefix - tools now appear as `promptprojectmanager:workspace:prompt`
471
+ - Simplified naming pattern to avoid double prefixing with MCP server name
472
+
473
+ ### 1.3.1 (2025-10-30)
474
+ - **Breaking Change**: Environment variable renamed from `CONTEXTFS_API_KEY` to `PPM_API_KEY`
475
+ - Updated all documentation and error messages with new branding
476
+
477
+ ### 1.3.0 (2025-10-30)
478
+ - **Breaking Change**: Tool naming pattern changed from `bundle/prompt` to workspace-scoped format
479
+ - **New Feature**: Workspace scoping - prompts are now namespaced by workspace
480
+ - Folders are now ignored in tool names (UI organization only)
481
+ - Fixed lazy loading to match prompts by both slug AND workspace slug
482
+ - Backend now includes workspace metadata in MCP prompt responses
483
+ - Updated Convex backend URLs to current deployments
484
+
485
+ ### 1.1.0 (2025-10-20)
486
+ - **New Feature**: Lazy loading mode (`--lazy-loading` flag)
487
+ - Users can now choose between cached (fast) and lazy loading (always fresh) modes
488
+ - Lazy loading fetches fresh prompt content on each invocation
489
+ - Enhanced Settings page UI with two-option configuration
490
+ - Updated documentation with user-centric caching mode guidance
491
+
492
+ ### 1.0.1 (2025-10-20)
493
+ - Documentation improvements
494
+ - Bug fixes
495
+
496
+ ### 1.0.0 (2025-10-20)
497
+ - Initial release
498
+ - Production and development deployment support
499
+ - Secure API key authentication
500
+ - Bundle-aware tool naming
501
+ - Flattened prompt execution
502
+ - Comprehensive error handling
503
+
504
+ ## Support
505
+
506
+ - **Issues**: https://github.com/contextfs/contextfs/issues
507
+ - **Documentation**: https://docs.contextfs.com
508
+ - **Email**: support@contextfs.com
509
+
510
+ ## License
511
+
512
+ MIT License - See LICENSE file for details
513
+
514
+ ---
515
+
516
+ **Made with ❤️ by the ContextFS team**
@@ -0,0 +1,2 @@
1
+
2
+ export { }