SDOF MCP-结构化决策优化框架
](https://nodejs.org/)  
具有五阶段优化工作流的下一代知识管理系统
这 结构化决策优化框架(SDOF)知识库 是一个模型上下文协议(MCP)服务器,通过结构化的5阶段优化工作流为AI系统提供持久内存和上下文管理。
🚀 快速开始
先决条件
- Node.js 18+
- OpenAI API密钥(用于嵌入)
- MCP兼容客户端(克劳德桌面等)
安装
# Clone the repository
git clone https://github.com/your-username/sdof-mcp.git
cd sdof-mcp
# Install dependencies
npm install
npm run build
# Configure environment
cp .env.example .env
# Edit .env with your OpenAI API key
# Start the server
npm start📖 文档
✨ 特性
🎯 五阶段优化工作流程
- 第一阶段:探索-解决方案发现和头脑风暴
- 第2阶段:分析-详细评估和优化
- 第三期:实施-代码开发和测试
- 阶段4:评价-绩效和质量评估
- 阶段5:整合-学习巩固和记录
🧠 高级知识管理
- 矢量嵌入:使用OpenAI嵌入的语义搜索
- 永久存储:带向量索引的MongoDB/SQLite
- 快速缓存:针对LLM效率进行了优化
- 架构验证:结构化内容类型
- 多接口:MCP工具和HTTP API
🔧 内容类型
text-一般文件和注释code-代码实现和示例decision-决策记录和理由analysis-分析结果和发现solution-解决方案描述和设计evaluation-评估报告和指标integration-集成文档和指南
🛠️ MCP工具
主要工具: store_sdof_plan
使用元数据存储结构化知识:
{
plan_content: string; // Markdown content
metadata: {
planTitle: string; // Descriptive title
planType: ContentType; // Content type (text, code, decision, etc.)
tags?: string[]; // Categorization tags
phase?: string; // SDOF phase (1-5)
cache_hint?: boolean; // Mark for prompt caching
}
}示例用法
// Store a decision record
{
"server_name": "sdof_knowledge_base",
"tool_name": "store_sdof_plan",
"arguments": {
"plan_content": "# Database Selection\n\nChose MongoDB for vector storage due to...",
"metadata": {
"planTitle": "Database Architecture Decision",
"planType": "decision",
"tags": ["database", "architecture"],
"phase": "2",
"cache_hint": true
}
}
}🏗️ 建筑
┌─────────────────┐ ┌──────────────────┐ ┌─────────────────┐
│ AI Clients │───▶│ SDOF Knowledge │───▶│ Database │
│ (Claude, etc.) │ │ Base MCP │ │ (MongoDB/ │
└─────────────────┘ │ Server │ │ SQLite) │
└──────────────────┘ └─────────────────┘
│
▼
┌──────────────────┐
│ HTTP API │
│ (Port 3000) │
└──────────────────┘🔧 配置
MCP客户端配置
添加到MCP客户端配置中:
{
"mcpServers": {
"sdof_knowledge_base": {
"type": "stdio",
"command": "node",
"args": ["path/to/sdof-mcp/build/index.js"],
"env": {
"OPENAI_API_KEY": "your-openai-api-key"
},
"alwaysAllow": ["store_sdof_plan"]
}
}
}环境变量
# Required
OPENAI_API_KEY=sk-proj-your-openai-api-key
# Optional
EMBEDDING_MODEL=text-embedding-3-small
HTTP_PORT=3000
MONGODB_URI=mongodb://localhost:27017/sdof🧪 测试
# Run tests
npm test
# Run system validation
node build/test-unified-system.js
# Performance benchmarks
npm run test:performance📊 演出
目标指标:
- 查询响应:平均\<500ms
- 嵌入生成:每个请求\<2s
- 矢量搜索:相似度计算小于100ms
- 数据库操作:CRUD操作\<50ms
🤝 贡献
- 分叉存储库
- 创建要素分支:
git checkout -b feature/amazing-feature - 在中更改TypeScript文件
src/ - 运行测试:
npm test - 构建:
npm run build - 提交更改:
git commit -m 'Add amazing feature' - 推送到分支:
git push origin feature/amazing-feature - 打开拉取请求
📄 许可证
此项目根据MIT许可证获得许可-请参阅 许可证 文件以获取详细信息。
🆘 支持
- 文档:检查 docs/ 目录
- 问题:
- 安装帮助:参见 SDOF_INSTALLATION_GUIDE.md
🎉 成功指标
在以下情况下,您知道系统工作正常:
- ✅ 日志中没有身份验证错误
- ✅
store_sdof_plan工具成功响应 - ✅ 知识条目已存储并可检索
- ✅ 查询性能达到目标(\<500ms)
- ✅ 测试套件完全通过
______________________________________________________________________
内置于❤️ 对于AI社区
