prompyai-mcp 0.1.2 → 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/README.md +68 -90
- package/dist/cli.js +12 -10
- package/dist/cli.js.map +2 -2
- package/dist/mcp/server.js +11 -9
- package/dist/mcp/server.js.map +2 -2
- package/dist/utils/telemetry.d.ts +2 -1
- package/dist/utils/telemetry.d.ts.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,70 +1,71 @@
|
|
|
1
1
|
# prompyai-mcp
|
|
2
2
|
|
|
3
|
-
Context-aware prompt intelligence MCP server for Claude CLI. Scores your
|
|
3
|
+
Context-aware prompt intelligence MCP server for Claude CLI. Scores your prompts against your real codebase and rewrites them with AI.
|
|
4
4
|
|
|
5
|
-
##
|
|
5
|
+
## Install
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
```bash
|
|
8
|
+
claude mcp add prompyai -- npx prompyai-mcp serve
|
|
9
|
+
```
|
|
8
10
|
|
|
9
|
-
|
|
10
|
-
- **Suggestions** with concrete examples tailored to your project
|
|
11
|
-
- **Enhanced prompt** rewritten with the improvements applied
|
|
11
|
+
No sign-up. No config. Works immediately. Requires Node.js 20+.
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
Prompt Score: 28/100 [F]
|
|
15
|
-
Session context: 12 file references carried forward
|
|
16
|
-
|
|
17
|
-
Specificity 6/25 ===...........
|
|
18
|
-
Context 5/25 ==............
|
|
19
|
-
Clarity 10/25 ======........
|
|
20
|
-
Anchoring 7/25 ====..........
|
|
21
|
-
|
|
22
|
-
This prompt is too vague for good results. Critical fixes:
|
|
23
|
-
1. Replace "fix" with what's actually broken
|
|
24
|
-
> "debug the JWT validation error in @src/middleware/auth.ts"
|
|
25
|
-
2. Describe expected vs actual behavior
|
|
26
|
-
> "should return 200 but returns 401 when token has role claim"
|
|
27
|
-
|
|
28
|
-
Enhanced prompt:
|
|
29
|
-
```
|
|
30
|
-
In @src/middleware/auth.ts, the JWT validation returns 401 for valid
|
|
31
|
-
tokens. Update validateToken to extract the role claim correctly.
|
|
32
|
-
Ensure existing vitest tests pass.
|
|
33
|
-
```
|
|
34
|
-
```
|
|
13
|
+
## What It Does
|
|
35
14
|
|
|
36
|
-
|
|
15
|
+
Every time you write a prompt in Claude CLI, PrompyAI automatically:
|
|
16
|
+
|
|
17
|
+
1. **Scores it** (0–100) across Specificity, Context Completeness, Task Clarity, and File & Folder Anchoring
|
|
18
|
+
2. **Suggests improvements** tailored to your project
|
|
19
|
+
3. **Rewrites the prompt** with real file paths, verified symbols, and codebase context
|
|
37
20
|
|
|
38
|
-
```bash
|
|
39
|
-
npm install -g prompyai-mcp
|
|
40
21
|
```
|
|
22
|
+
Prompt Score: 43/100 [D]
|
|
41
23
|
|
|
42
|
-
|
|
24
|
+
Specificity 3/25 ==..............
|
|
25
|
+
Context Completeness 13/25 ========........
|
|
26
|
+
Task Clarity 15/25 =========.......
|
|
27
|
+
File & Folder Anchoring 10/25 ======..........
|
|
43
28
|
|
|
44
|
-
|
|
29
|
+
Key improvements:
|
|
30
|
+
1. Expand your prompt with more context
|
|
31
|
+
2. Add file paths using @mentions
|
|
32
|
+
3. Specify what format you expect the output in
|
|
45
33
|
|
|
46
|
-
|
|
47
|
-
|
|
34
|
+
Try something more like:
|
|
35
|
+
|
|
36
|
+
"Build the VS Code extension in packages/vscode-extension/ that integrates
|
|
37
|
+
with the PrompyAI MCP server at packages/mcp-server/. It should provide
|
|
38
|
+
real-time prompt scoring in the editor sidebar, show score breakdowns
|
|
39
|
+
(specificity, context, clarity, anchoring), and offer a 'rewrite prompt'
|
|
40
|
+
action. Use the shared types from packages/shared/."
|
|
48
41
|
```
|
|
49
42
|
|
|
50
|
-
|
|
43
|
+
## AI Enhancement — Works for Everyone
|
|
51
44
|
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
45
|
+
PrompyAI uses a two-layer architecture:
|
|
46
|
+
|
|
47
|
+
- **API key users** (`ANTHROPIC_API_KEY` set) → PrompyAI calls Claude Haiku directly for fast AI rewrites
|
|
48
|
+
- **Subscription users** (no API key) → PrompyAI returns rich codebase context to Claude, which generates the enhanced prompt using your existing session
|
|
49
|
+
|
|
50
|
+
All users get AI-enhanced output. No separate API key required.
|
|
51
|
+
|
|
52
|
+
## How It Knows Your Codebase
|
|
53
|
+
|
|
54
|
+
PrompyAI indexes your project locally:
|
|
55
|
+
|
|
56
|
+
- **File tree** — structure, key folders, recently modified files
|
|
57
|
+
- **Tech stack** — language, framework, ORM, test runner detection
|
|
58
|
+
- **Code symbols** — functions, classes, interfaces extracted via the TypeScript Compiler API
|
|
59
|
+
- **Git state** — branch, dirty files, recent changes
|
|
60
|
+
- **Session history** — reads Claude Code conversation transcripts for multi-turn context
|
|
61
|
+
|
|
62
|
+
All indexing happens locally. Nothing is sent externally (except optional anonymous telemetry).
|
|
62
63
|
|
|
63
64
|
## MCP Tools
|
|
64
65
|
|
|
65
66
|
### `evaluate_prompt`
|
|
66
67
|
|
|
67
|
-
|
|
68
|
+
Auto-called on every user message. Scores your prompt against your project.
|
|
68
69
|
|
|
69
70
|
| Parameter | Required | Description |
|
|
70
71
|
|-----------|----------|-------------|
|
|
@@ -73,11 +74,9 @@ Automatically called on every user message. Scores a prompt against your project
|
|
|
73
74
|
| `active_file` | no | Currently open file path |
|
|
74
75
|
| `session_id` | no | Claude Code session ID for multi-turn context |
|
|
75
76
|
|
|
76
|
-
Returns a JSON result with a pre-formatted `display` field that Claude shows directly.
|
|
77
|
-
|
|
78
77
|
### `get_context`
|
|
79
78
|
|
|
80
|
-
Returns
|
|
79
|
+
Returns your project summary: tech stack, recent files, key folders.
|
|
81
80
|
|
|
82
81
|
| Parameter | Required | Description |
|
|
83
82
|
|-----------|----------|-------------|
|
|
@@ -85,50 +84,29 @@ Returns a summary of your project: detected tech stack, recently modified files,
|
|
|
85
84
|
|
|
86
85
|
### `prompyai_toggle`
|
|
87
86
|
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
| Parameter | Required | Description |
|
|
91
|
-
|-----------|----------|-------------|
|
|
92
|
-
| `enabled` | yes | `true` to enable, `false` to disable |
|
|
93
|
-
|
|
94
|
-
## Scoring Dimensions
|
|
87
|
+
Turn auto-evaluation on or off. Say "pause prompyai" or "enable prompyai" in Claude CLI.
|
|
95
88
|
|
|
96
|
-
|
|
89
|
+
## Desktop Config
|
|
97
90
|
|
|
98
|
-
|
|
99
|
-
|-----------|----------|
|
|
100
|
-
| **Specificity** | Concrete actions vs vague verbs, output format, constraints |
|
|
101
|
-
| **Context** | File references, error messages, expected vs actual behavior |
|
|
102
|
-
| **Clarity** | Single focused task, success criteria, unambiguous language |
|
|
103
|
-
| **Anchoring** | File paths, project entity references, hot file mentions |
|
|
91
|
+
Alternatively, add to `~/.claude/claude_desktop_config.json`:
|
|
104
92
|
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
- **Rate limiting** — 100 AI calls/day per machine, graceful fallback
|
|
115
|
-
- **Anonymous telemetry** — Usage stats only, opt-out with `PROMPYAI_TELEMETRY=false`
|
|
116
|
-
|
|
117
|
-
## AI-Powered Suggestions
|
|
118
|
-
|
|
119
|
-
When `ANTHROPIC_API_KEY` is set, PrompyAI uses Claude Haiku to generate context-aware suggestions grounded in your project structure. Without an API key, it falls back to smart template-based suggestions from the heuristic analysis.
|
|
120
|
-
|
|
121
|
-
```bash
|
|
122
|
-
export ANTHROPIC_API_KEY=sk-ant-...
|
|
93
|
+
```json
|
|
94
|
+
{
|
|
95
|
+
"mcpServers": {
|
|
96
|
+
"prompyai": {
|
|
97
|
+
"command": "npx",
|
|
98
|
+
"args": ["prompyai-mcp", "serve"]
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
}
|
|
123
102
|
```
|
|
124
103
|
|
|
125
104
|
## Environment Variables
|
|
126
105
|
|
|
127
106
|
| Variable | Required | Description |
|
|
128
107
|
|----------|----------|-------------|
|
|
129
|
-
| `ANTHROPIC_API_KEY` | No | Enables AI
|
|
108
|
+
| `ANTHROPIC_API_KEY` | No | Enables direct AI suggestions via Claude Haiku (optional) |
|
|
130
109
|
| `PROMPYAI_TELEMETRY` | No | Set to `false` to opt out of anonymous telemetry |
|
|
131
|
-
| `PROMPYAI_TELEMETRY_URL` | No | Override telemetry endpoint URL |
|
|
132
110
|
|
|
133
111
|
## CLI Commands
|
|
134
112
|
|
|
@@ -138,12 +116,6 @@ prompyai doctor # Run environment diagnostics
|
|
|
138
116
|
--workspace <path> # Workspace to check (default: cwd)
|
|
139
117
|
```
|
|
140
118
|
|
|
141
|
-
## Rate Limits
|
|
142
|
-
|
|
143
|
-
- **Per machine:** 100 AI-enhanced evaluations per day
|
|
144
|
-
- **Global:** Monthly cost cap
|
|
145
|
-
- **When limits hit:** Heuristic scoring continues, AI suggestions paused
|
|
146
|
-
|
|
147
119
|
## Programmatic API
|
|
148
120
|
|
|
149
121
|
```typescript
|
|
@@ -160,6 +132,12 @@ console.log(result.total); // 0-100
|
|
|
160
132
|
console.log(result.grade); // A-F
|
|
161
133
|
```
|
|
162
134
|
|
|
135
|
+
## Links
|
|
136
|
+
|
|
137
|
+
- **Website:** [prompyai.com](https://prompyai.com)
|
|
138
|
+
- **GitHub:** [github.com/samouh-waleed/PrompyAI](https://github.com/samouh-waleed/PrompyAI)
|
|
139
|
+
- **MCP Registry:** [io.github.samouh-waleed/prompyai](https://registry.modelcontextprotocol.io)
|
|
140
|
+
|
|
163
141
|
## License
|
|
164
142
|
|
|
165
143
|
MIT
|
package/dist/cli.js
CHANGED
|
@@ -2657,7 +2657,7 @@ var init_telemetry = __esm({
|
|
|
2657
2657
|
BATCH_INTERVAL_MS = 3e4;
|
|
2658
2658
|
MAX_BATCH_SIZE = 50;
|
|
2659
2659
|
VERSION = "0.1.0";
|
|
2660
|
-
TelemetryClient = class {
|
|
2660
|
+
TelemetryClient = class _TelemetryClient {
|
|
2661
2661
|
buffer = [];
|
|
2662
2662
|
timer = null;
|
|
2663
2663
|
enabled;
|
|
@@ -2668,6 +2668,7 @@ var init_telemetry = __esm({
|
|
|
2668
2668
|
if (this.timer.unref) this.timer.unref();
|
|
2669
2669
|
}
|
|
2670
2670
|
}
|
|
2671
|
+
static IMMEDIATE_EVENTS = /* @__PURE__ */ new Set(["server_start"]);
|
|
2671
2672
|
track(event, properties) {
|
|
2672
2673
|
if (!this.enabled) return;
|
|
2673
2674
|
this.buffer.push({
|
|
@@ -2677,7 +2678,7 @@ var init_telemetry = __esm({
|
|
|
2677
2678
|
timestamp: Date.now(),
|
|
2678
2679
|
properties
|
|
2679
2680
|
});
|
|
2680
|
-
if (this.buffer.length >= MAX_BATCH_SIZE) {
|
|
2681
|
+
if (this.buffer.length >= MAX_BATCH_SIZE || _TelemetryClient.IMMEDIATE_EVENTS.has(event)) {
|
|
2681
2682
|
this.flush();
|
|
2682
2683
|
}
|
|
2683
2684
|
}
|
|
@@ -2697,13 +2698,12 @@ var init_telemetry = __esm({
|
|
|
2697
2698
|
} catch {
|
|
2698
2699
|
}
|
|
2699
2700
|
}
|
|
2700
|
-
shutdown() {
|
|
2701
|
+
async shutdown() {
|
|
2701
2702
|
if (this.timer) {
|
|
2702
2703
|
clearInterval(this.timer);
|
|
2703
2704
|
this.timer = null;
|
|
2704
2705
|
}
|
|
2705
|
-
this.flush()
|
|
2706
|
-
});
|
|
2706
|
+
await this.flush();
|
|
2707
2707
|
}
|
|
2708
2708
|
};
|
|
2709
2709
|
telemetry = new TelemetryClient();
|
|
@@ -2832,7 +2832,7 @@ import {
|
|
|
2832
2832
|
CallToolRequestSchema,
|
|
2833
2833
|
ListToolsRequestSchema
|
|
2834
2834
|
} from "@modelcontextprotocol/sdk/types.js";
|
|
2835
|
-
var server, indexer, scorer, rateLimiter, transport;
|
|
2835
|
+
var server, indexer, scorer, rateLimiter, gracefulShutdown, transport;
|
|
2836
2836
|
var init_server = __esm({
|
|
2837
2837
|
async "src/mcp/server.ts"() {
|
|
2838
2838
|
"use strict";
|
|
@@ -2907,13 +2907,15 @@ var init_server = __esm({
|
|
|
2907
2907
|
process.on("unhandledRejection", (error) => {
|
|
2908
2908
|
logError("Unhandled rejection", error);
|
|
2909
2909
|
});
|
|
2910
|
-
|
|
2911
|
-
telemetry.shutdown();
|
|
2910
|
+
gracefulShutdown = async () => {
|
|
2911
|
+
await telemetry.shutdown();
|
|
2912
2912
|
process.exit(0);
|
|
2913
|
+
};
|
|
2914
|
+
process.on("SIGINT", () => {
|
|
2915
|
+
gracefulShutdown();
|
|
2913
2916
|
});
|
|
2914
2917
|
process.on("SIGTERM", () => {
|
|
2915
|
-
|
|
2916
|
-
process.exit(0);
|
|
2918
|
+
gracefulShutdown();
|
|
2917
2919
|
});
|
|
2918
2920
|
transport = new StdioServerTransport();
|
|
2919
2921
|
await server.connect(transport);
|