prompyai-mcp 0.1.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.
- package/README.md +165 -0
- package/dist/cli/doctor.d.ts +6 -0
- package/dist/cli/doctor.d.ts.map +1 -0
- package/dist/cli.d.ts +3 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +2979 -0
- package/dist/cli.js.map +7 -0
- package/dist/config/defaults.d.ts +3 -0
- package/dist/config/defaults.d.ts.map +1 -0
- package/dist/config/types.d.ts +22 -0
- package/dist/config/types.d.ts.map +1 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/indexer/FileCollector.d.ts +12 -0
- package/dist/indexer/FileCollector.d.ts.map +1 -0
- package/dist/indexer/StackDetector.d.ts +12 -0
- package/dist/indexer/StackDetector.d.ts.map +1 -0
- package/dist/indexer/SymbolExtractor.d.ts +20 -0
- package/dist/indexer/SymbolExtractor.d.ts.map +1 -0
- package/dist/indexer/WorkspaceIndexer.d.ts +25 -0
- package/dist/indexer/WorkspaceIndexer.d.ts.map +1 -0
- package/dist/indexer/types.d.ts +44 -0
- package/dist/indexer/types.d.ts.map +1 -0
- package/dist/mcp/server.d.ts +2 -0
- package/dist/mcp/server.d.ts.map +1 -0
- package/dist/mcp/server.js +2708 -0
- package/dist/mcp/server.js.map +7 -0
- package/dist/mcp/tools/evaluate.d.ts +35 -0
- package/dist/mcp/tools/evaluate.d.ts.map +1 -0
- package/dist/mcp/tools/getContext.d.ts +18 -0
- package/dist/mcp/tools/getContext.d.ts.map +1 -0
- package/dist/mcp/tools/index.d.ts +4 -0
- package/dist/mcp/tools/index.d.ts.map +1 -0
- package/dist/mcp/tools/toggle.d.ts +19 -0
- package/dist/mcp/tools/toggle.d.ts.map +1 -0
- package/dist/mcp/types.d.ts +27 -0
- package/dist/mcp/types.d.ts.map +1 -0
- package/dist/scorer/AISuggestionGenerator.d.ts +28 -0
- package/dist/scorer/AISuggestionGenerator.d.ts.map +1 -0
- package/dist/scorer/ContextResolver.d.ts +14 -0
- package/dist/scorer/ContextResolver.d.ts.map +1 -0
- package/dist/scorer/DisplayFormatter.d.ts +7 -0
- package/dist/scorer/DisplayFormatter.d.ts.map +1 -0
- package/dist/scorer/HeuristicScorer.d.ts +22 -0
- package/dist/scorer/HeuristicScorer.d.ts.map +1 -0
- package/dist/scorer/ScoringEngine.d.ts +20 -0
- package/dist/scorer/ScoringEngine.d.ts.map +1 -0
- package/dist/scorer/types.d.ts +69 -0
- package/dist/scorer/types.d.ts.map +1 -0
- package/dist/session/SessionParser.d.ts +22 -0
- package/dist/session/SessionParser.d.ts.map +1 -0
- package/dist/session/types.d.ts +22 -0
- package/dist/session/types.d.ts.map +1 -0
- package/dist/utils/cache.d.ts +13 -0
- package/dist/utils/cache.d.ts.map +1 -0
- package/dist/utils/fileUtils.d.ts +9 -0
- package/dist/utils/fileUtils.d.ts.map +1 -0
- package/dist/utils/logger.d.ts +8 -0
- package/dist/utils/logger.d.ts.map +1 -0
- package/dist/utils/machineId.d.ts +6 -0
- package/dist/utils/machineId.d.ts.map +1 -0
- package/dist/utils/rateLimiter.d.ts +40 -0
- package/dist/utils/rateLimiter.d.ts.map +1 -0
- package/dist/utils/telemetry.d.ts +26 -0
- package/dist/utils/telemetry.d.ts.map +1 -0
- package/package.json +58 -0
package/README.md
ADDED
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
# prompyai-mcp
|
|
2
|
+
|
|
3
|
+
Context-aware prompt intelligence MCP server for Claude CLI. Scores your developer prompts against your real codebase, suggests improvements, and rewrites enhanced prompts.
|
|
4
|
+
|
|
5
|
+
## What it does
|
|
6
|
+
|
|
7
|
+
When you write a prompt in Claude CLI, PrompyAI automatically analyzes it against your actual project — files, tech stack, conventions, session history — and returns:
|
|
8
|
+
|
|
9
|
+
- **Score** (0-100) across 4 dimensions: specificity, context, clarity, anchoring
|
|
10
|
+
- **Suggestions** with concrete examples tailored to your project
|
|
11
|
+
- **Enhanced prompt** rewritten with the improvements applied
|
|
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
|
+
```
|
|
35
|
+
|
|
36
|
+
## Install
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
npm install -g prompyai-mcp
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
Requires Node.js 20+.
|
|
43
|
+
|
|
44
|
+
## Setup with Claude CLI
|
|
45
|
+
|
|
46
|
+
```bash
|
|
47
|
+
claude mcp add prompyai -- npx prompyai-mcp serve
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
Or add to `~/.claude/claude_desktop_config.json`:
|
|
51
|
+
|
|
52
|
+
```json
|
|
53
|
+
{
|
|
54
|
+
"mcpServers": {
|
|
55
|
+
"prompyai": {
|
|
56
|
+
"command": "npx",
|
|
57
|
+
"args": ["prompyai-mcp", "serve"]
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
## MCP Tools
|
|
64
|
+
|
|
65
|
+
### `evaluate_prompt`
|
|
66
|
+
|
|
67
|
+
Automatically called on every user message. Scores a prompt against your project codebase.
|
|
68
|
+
|
|
69
|
+
| Parameter | Required | Description |
|
|
70
|
+
|-----------|----------|-------------|
|
|
71
|
+
| `prompt` | yes | The prompt text to evaluate |
|
|
72
|
+
| `workspace_path` | yes | Absolute path to your project |
|
|
73
|
+
| `active_file` | no | Currently open file path |
|
|
74
|
+
| `session_id` | no | Claude Code session ID for multi-turn context |
|
|
75
|
+
|
|
76
|
+
Returns a JSON result with a pre-formatted `display` field that Claude shows directly.
|
|
77
|
+
|
|
78
|
+
### `get_context`
|
|
79
|
+
|
|
80
|
+
Returns a summary of your project: detected tech stack, recently modified files, key folders, and AI instruction summaries.
|
|
81
|
+
|
|
82
|
+
| Parameter | Required | Description |
|
|
83
|
+
|-----------|----------|-------------|
|
|
84
|
+
| `workspace_path` | yes | Absolute path to your project |
|
|
85
|
+
|
|
86
|
+
### `prompyai_toggle`
|
|
87
|
+
|
|
88
|
+
Turns auto-evaluation on or off. Enabled by default. Say "pause prompyai" or "enable prompyai" in Claude CLI.
|
|
89
|
+
|
|
90
|
+
| Parameter | Required | Description |
|
|
91
|
+
|-----------|----------|-------------|
|
|
92
|
+
| `enabled` | yes | `true` to enable, `false` to disable |
|
|
93
|
+
|
|
94
|
+
## Scoring Dimensions
|
|
95
|
+
|
|
96
|
+
Each dimension scores 0-25, total 0-100.
|
|
97
|
+
|
|
98
|
+
| Dimension | Measures |
|
|
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 |
|
|
104
|
+
|
|
105
|
+
**Grades:** A (90+), B (70+), C (50+), D (30+), F (<30)
|
|
106
|
+
|
|
107
|
+
## Features
|
|
108
|
+
|
|
109
|
+
- **Session-aware** — Reads Claude Code JSONL transcripts for multi-turn context
|
|
110
|
+
- **Multi-agent aware** — Includes subagent research in scoring context
|
|
111
|
+
- **Monorepo support** — Detects tech stacks across workspace packages
|
|
112
|
+
- **AI-powered suggestions** — Claude Haiku generates context-aware improvements
|
|
113
|
+
- **Template fallback** — Works without an API key using heuristic scoring
|
|
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-...
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
## Environment Variables
|
|
126
|
+
|
|
127
|
+
| Variable | Required | Description |
|
|
128
|
+
|----------|----------|-------------|
|
|
129
|
+
| `ANTHROPIC_API_KEY` | No | Enables AI-powered suggestions via Claude Haiku |
|
|
130
|
+
| `PROMPYAI_TELEMETRY` | No | Set to `false` to opt out of anonymous telemetry |
|
|
131
|
+
| `PROMPYAI_TELEMETRY_URL` | No | Override telemetry endpoint URL |
|
|
132
|
+
|
|
133
|
+
## CLI Commands
|
|
134
|
+
|
|
135
|
+
```bash
|
|
136
|
+
prompyai serve # Start the MCP server (default)
|
|
137
|
+
prompyai doctor # Run environment diagnostics
|
|
138
|
+
--workspace <path> # Workspace to check (default: cwd)
|
|
139
|
+
```
|
|
140
|
+
|
|
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
|
+
## Programmatic API
|
|
148
|
+
|
|
149
|
+
```typescript
|
|
150
|
+
import { WorkspaceIndexer, ScoringEngine } from 'prompyai-mcp';
|
|
151
|
+
|
|
152
|
+
const indexer = new WorkspaceIndexer();
|
|
153
|
+
const scorer = new ScoringEngine();
|
|
154
|
+
|
|
155
|
+
const fingerprint = await indexer.getFingerprint('/path/to/project');
|
|
156
|
+
const result = await scorer.evaluate('fix the auth', fingerprint);
|
|
157
|
+
|
|
158
|
+
console.log(result.display); // Pre-formatted score output
|
|
159
|
+
console.log(result.total); // 0-100
|
|
160
|
+
console.log(result.grade); // A-F
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
## License
|
|
164
|
+
|
|
165
|
+
MIT
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"doctor.d.ts","sourceRoot":"","sources":["../../src/cli/doctor.ts"],"names":[],"mappings":"AAWA;;;GAGG;AACH,wBAAsB,SAAS,CAAC,aAAa,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAkFrE"}
|
package/dist/cli.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":""}
|