MCP 人择服务器 ( mcp-anthropic
)
MCP(模型上下文协议)服务器提供与 Anthropic 的实验提示工程 API 交互的工具。
特征
提供以下工具:
generate_prompt
:根据任务描述生成提示。improve_prompt
:根据反馈改进现有提示。templatize_prompt
:将具体的提示示例转换为可重复使用的模板。
设置
- 克隆存储库(如果适用)
- 导航到项目目录:
- 安装依赖项:
- 配置API密钥:
- 在项目根目录中创建一个
.env
文件 ( ./mcp-anthropic/.env
)。 - 将您的 Anthropic API 密钥添加到
.env
文件:ANTHROPIC_KEY=your_anthropic_api_key_here
- 确保此文件未提交到版本控制(它应该被
.gitignore
覆盖)。 - **LibreChat 集成注意事项:**有关在 LibreChat 中设置和运行此服务器作为子进程的具体说明(包括 API 密钥处理),请参阅
documentation.md
文件。
运行服务器
- 构建 TypeScript 代码:
- 启动服务器:服务器将启动并监听 MCP 连接。您将看到输出,指示服务器已启动以及已注册的工具。
工具文档
generate_prompt
根据任务描述生成提示。
输入模式:
{
"type": "object",
"properties": {
"task": {
"type": "string",
"description": "A description of the task the prompt should be designed for (e.g., \"a chef for a meal prep planning service\")."
},
"target_model": {
"type": "string",
"description": "The target Anthropic model identifier (e.g., \"claude-3-opus-20240229\")."
}
},
"required": ["task", "target_model"]
}
improve_prompt
根据反馈改进现有提示。
输入模式:
{
"type": "object",
"properties": {
"messages": {
"type": "array",
"items": {
"type": "object",
"properties": {
"role": { "type": "string", "description": "Role (e.g., 'user', 'assistant')." },
"content": {
"type": "array",
"items": {
"type": "object",
"properties": {
"type": { "type": "string", "description": "Content type (e.g., 'text')." },
"text": { "type": "string", "description": "Text content." }
},
"required": ["type", "text"]
},
"description": "Content blocks."
}
},
"required": ["role", "content"]
},
"description": "The sequence of messages representing the prompt conversation."
},
"system": {
"type": "string",
"description": "(Optional) A system prompt to guide the model."
},
"feedback": {
"type": "string",
"description": "Specific feedback on how to improve the prompt (e.g., \"Make it more detailed\")."
},
"target_model": {
"type": "string",
"description": "The target Anthropic model identifier (e.g., \"claude-3-opus-20240229\")."
}
},
"required": ["messages", "feedback", "target_model"]
}
templatize_prompt
将具体的提示示例转换为可重复使用的模板。
输入模式:
{
"type": "object",
"properties": {
"messages": {
"type": "array",
"items": {
"type": "object",
"properties": {
"role": { "type": "string", "description": "Role (e.g., 'user', 'assistant')." },
"content": {
"type": "array",
"items": {
"type": "object",
"properties": {
"type": { "type": "string", "description": "Content type (e.g., 'text')." },
"text": { "type": "string", "description": "Text content." }
},
"required": ["type", "text"]
},
"description": "Content blocks."
}
},
"required": ["role", "content"]
},
"description": "The sequence of messages representing the prompt conversation example."
},
"system": {
"type": "string",
"description": "(Optional) A system prompt associated with the example."
}
},
"required": ["messages"]
}