关于 prompyai
prompyai 是面向 Claude CLI 编码流程的 MCP 服务,会结合本地代码库评估提示词并生成改写建议。它索引项目结构、技术栈、代码符号和会话记录,为提示词补充相关上下文。
主要功能
- 01按四项维度评分提示词
- 02提供项目定制改进建议
- 03用文件路径和符号改写提示词
- 04本地索引项目上下文
- 05读取会话记录辅助多轮理解
适用场景
- 01让模糊的编码请求更具体
- 02为提示词补充相关文件和符号
- 03获取项目技术栈与近期文件摘要
MCP 相关
prompyai MCP 服务提供 evaluate_prompt、get_context 和 prompyai_toggle 工具,供 Claude CLI 获取提示词评估、项目上下文及自动评估控制。
配置
本地服务的配置在各客户端中通用,复制后粘贴到客户端的 MCP 配置文件即可。
工具
3收录的工具列表 · 更新于 3 周前
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
| prompt | string | 是 | 要评估的提示词文本 |
| session_id | string | 否 | 用于多轮上下文的 Claude Code 会话 ID(可选) |
| active_file | string | 否 | 当前打开的文件路径(可选) |
| workspace_path | string | 是 | 项目工作区的绝对路径 |
详细介绍
prompyai-mcp
面向 Claude CLI 的上下文感知提示词智能 MCP 服务。根据真实代码库为提示词评分,并使用 AI 重写提示词。
安装
claude mcp add prompyai -- npx prompyai-mcp serve
无需注册,无需配置,即装即用。需要 Node.js 20+。
功能
每次在 Claude CLI 中编写提示词时,PrompyAI 都会自动:
- 评分(0–100),评估具体性、上下文完整性、任务清晰度,以及文件和文件夹锚定程度
- 提供改进建议,并根据项目量身定制
- 重写提示词,加入真实文件路径、经过验证的符号和代码库上下文
Prompt Score: 43/100 [D]
Specificity 3/25 ==..............
Context Completeness 13/25 ========........
Task Clarity 15/25 =========.......
File & Folder Anchoring 10/25 ======..........
Key improvements:
1. Expand your prompt with more context
2. Add file paths using @mentions
3. Specify what format you expect the output in
Try something more like:
"Build the VS Code extension in packages/vscode-extension/ that integrates
with the PrompyAI MCP server at packages/mcp-server/. It should provide
real-time prompt scoring in the editor sidebar, show score breakdowns
(specificity, context, clarity, anchoring), and offer a 'rewrite prompt'
action. Use the shared types from packages/shared/."
AI 增强 — 人人可用
PrompyAI 采用双层架构:
- API 密钥用户(已设置
ANTHROPIC_API_KEY)→ PrompyAI 直接调用 Claude Haiku,快速重写提示词 - 订阅用户(未设置 API 密钥)→ PrompyAI 将丰富的代码库上下文返回给 Claude,由 Claude 使用你现有的会话生成增强后的提示词
所有用户都能获得 AI 增强输出。无需单独的 API 密钥。
如何了解你的代码库
PrompyAI 会在本地为项目建立索引:
- 文件树 — 结构、关键文件夹、最近修改的文件
- 技术栈 — 检测语言、框架、ORM 和测试运行器
- 代码符号 — 通过 TypeScript Compiler API 提取函数、类和接口
- Git 状态 — 分支、已修改文件、近期变更
- 会话历史 — 读取 Claude Code 对话记录,提供多轮上下文
所有索引操作都在本地完成。不会向外部发送任何内容(可选的匿名遥测除外)。
MCP 工具
evaluate_prompt
每次用户发送消息时自动调用。根据项目为提示词评分。
| 参数 | 必填 | 描述 |
|---|---|---|
prompt | 是 | 要评估的提示词文本 |
workspace_path | 是 | 项目的绝对路径 |
active_file | 否 | 当前打开的文件路径 |
session_id | 否 | 用于多轮上下文的 Claude Code 会话 ID |
get_context
返回项目摘要:技术栈、近期文件、关键文件夹。
| 参数 | 必填 | 描述 |
|---|---|---|
workspace_path | 是 | 项目的绝对路径 |
prompyai_toggle
开启或关闭自动评估。在 Claude CLI 中说“暂停 prompyai”或“启用 prompyai”即可。
桌面配置
或者,将以下内容添加到 ~/.claude/claude_desktop_config.json:
{
"mcpServers": {
"prompyai": {
"command": "npx",
"args": ["prompyai-mcp", "serve"]
}
}
}
环境变量
| 变量 | 必填 | 描述 |
|---|---|---|
ANTHROPIC_API_KEY | 否 | 启用通过 Claude Haiku 提供的直接 AI 建议(可选) |
PROMPYAI_TELEMETRY | 否 | 设置为 false 可选择退出匿名遥测 |
CLI 命令
prompyai serve # Start the MCP server (default)
prompyai doctor # Run environment diagnostics
--workspace <path> # Workspace to check (default: cwd)
编程接口
import { WorkspaceIndexer, ScoringEngine } from 'prompyai-mcp';
const indexer = new WorkspaceIndexer();
const scorer = new ScoringEngine();
const fingerprint = await indexer.getFingerprint('/path/to/project');
const result = await scorer.evaluate('fix the auth', fingerprint);
console.log(result.display); // Pre-formatted score output
console.log(result.total); // 0-100
console.log(result.grade); // A-F
链接
- 网站: prompyai.com
- GitHub: github.com/samouh-waleed/PrompyAI
- MCP Registry: io.github.samouh-waleed/prompyai
许可证
MIT
评论
支持 Markdown
一个开放协议,规定了 AI 应用如何以统一方式连接外部工具与数据源。客户端负责与模型对话,MCP 服务负责提供工具、资源和提示模板,两者通过标准消息通信,同一个服务可以被不同客户端复用。