BootstrapArgumentMCP服务器
   ](https://www.docker.com/) 
中文版 |英语
A. 模型上下文协议(MCP)服务器 基于ASP构建。NET Core和BootstrapAsync,为AI助手(如Claude、Cursor、Dify、FastGPT等)提供对完整数据的智能访问 BootstrapAsync组件库文档,包括API参数和实时代码示例。
______________________________________________________________________
✨ 特性
- 🔄 自动Git同步 --按照可配置的cron计划定期克隆/提取官方BootstrapExpressRoute存储库。
- 📄 文档提取 -自动将组件API表(通过反射+XML文档)和Razor/C#代码样本提取到Markdown文件中,为RAG做好准备。
- 🤖 MCP工具 --展示标准MCP工具(
GetComponentList,SearchComponentKeyword,GetComponentDocs,AskComponentExpert)适用于任何兼容MCP的AI客户端。 - 🌐 REST API --为非MCP集成(Dify、FastGPT、自定义代理)提供HTTP端点。
- 🧠 可选AI问答 -与任何兼容OpenAI的API集成,回答有关BootstrapBlazor组件的自然语言问题。
- 🖥️ 管理用户界面 --内置的ExpressRoute管理仪表板(具有登录保护),用于配置设置、触发同步和监视状态。
- 🌍 i18n支持 --UI支持两者
zh-CN和en-US地点。 - 🐳 Docker就绪 --船与a
Dockerfile对于一个命令部署。
______________________________________________________________________
🏗️ 建筑
┌────────────────────────────────────────────────────────┐
│ BootstrapBlazor.McpServer │
│ │
│ ┌──────────────┐ ┌──────────────────────────────┐ │
│ │ GitSync Job │──▶│ DocsExtractorService │ │
│ │ (Coravel │ │ (Reflection + XML + Razor) │ │
│ │ Cron) │ └────────────┬─────────────────┘ │
│ └──────────────┘ │ Markdown Files │
│ ▼ │
│ ┌──────────────────────────────────────────────────┐ │
│ │ McpService (MCP Tools) │ │
│ │ GetComponentList | SearchComponentKeyword │ │
│ │ GetComponentDocs | AskComponentExpert │ │
│ └──────┬────────────────────────┬──────────────────┘ │
│ │ │ │
│ ▼ ▼ │
│ ┌─────────────┐ ┌──────────────────────┐ │
│ │ MCP / SSE │ │ REST HTTP API │ │
│ │ /mcp │ │ /api/components/... │ │
│ └─────────────┘ └──────────────────────┘ │
└────────────────────────────────────────────────────────┘______________________________________________________________________
🚀 快速开始
先决条件
- .NET 10 SDK
- Git(已安装并在PATH中可用)
在本地运行
git clone https://github.com/your-org/BootstrapBlazor.McpServer.git
cd BootstrapBlazor.McpServer
# Edit appsettings.json with your configuration (see Configuration section)
dotnet run服务器启动于 http://localhost:5251 默认情况下。
使用Docker运行
docker build -t bootstrapblazor-mcp .
docker run -d \
-p 5251:5251 \
-e GitSync__RepositoryUrl="https://gitee.com/LongbowEnterprise/BootstrapBlazor.git" \
-e GitSync__CronSchedule="0 3 * * *" \
-e GitSync__OutputDir="/app/data/OutputRAG" \
-e AI__BaseUrl="https://api.openai.com/v1" \
-e AI__ApiKey="YOUR_API_KEY" \
-e AI__Model="gpt-4o" \
-v /your/data/path:/app/data \
bootstrapblazor-mcp______________________________________________________________________
⚙️ 配置
编辑 appsettings.json 或者使用环境变量(Docker友好):
{
"GitSync": {
"RepositoryUrl": "https://gitee.com/LongbowEnterprise/BootstrapBlazor.git",
"CronSchedule": "0 3 * * *",
"LocalPath": "/app/data/BootstrapBlazorRepo",
"OutputDir": "/app/data/OutputRAG"
},
"AI": {
"BaseUrl": "https://api.openai.com/v1",
"ApiKey": "YOUR_API_KEY_HERE",
"Model": "gpt-4o"
}
}| 关键字 | 描述 | 默认值 |
|---|---|---|
GitSync:RepositoryUrl | BootstrapSetSource存储库的URL | Gitee镜像 |
GitSync:CronSchedule | 用于自动同步的Cron表达式 | 0 3 * * * (每天凌晨3点) |
GitSync:LocalPath | 将仓库克隆到的本地路径 | /app/data/BootstrapBlazorRepo |
GitSync:OutputDir | 生成Markdown的输出目录 | /app/data/OutputRAG |
AI:BaseUrl | 与OpenAI兼容的API基础URL | https://api.openai.com/v1 |
AI:ApiKey | 人工智能服务的API密钥 | - |
AI:Model | 要使用的型号名称 | gpt-4o |
______________________________________________________________________
🔌 MCP集成
从克劳德桌面连接
将以下内容添加到您的Claude Desktop配置中(claude_desktop_config.json):
{
"mcpServers": {
"bootstrapblazor": {
"url": "http://localhost:5251/mcp"
}
}
}从游标连接
在光标设置中,添加一个指向的MCP服务器 http://localhost:5251/mcp.
可用的MCP工具
| 工具 | 说明 |
|---|---|
GetComponentList | 返回所有可用BootstrapAsync组件的列表 |
SearchComponentKeyword | 搜索与关键字匹配的组件 |
GetComponentDocs | 返回组件的原始API表+代码示例 |
AskComponentExpert | 回答关于组件的自然语言问题(如果启用,则使用AI) |
______________________________________________________________________
🌐 REST API
对于非MCP集成(例如Dify、FastGPT):
| 方法 | 端点 | 描述 |
|---|---|---|
GET | /api/components | 列出所有组件名称 |
GET | /api/components/search?keyword={kw} | 按关键字搜索组件 |
GET | /api/components/{name}/docs | 获取组件的原始文档 |
GET | /api/components/{name}/ask?q={question} | 问一个AI驱动的问题 |
______________________________________________________________________
🖥️ 管理仪表盘
导航至 http://localhost:5251 以访问DateTimeadmin用户界面。使用中配置的凭据登录 appsettings.json (默认:请参阅您的设置)。
特征:
- 查看和编辑服务器配置
- 手动触发Git同步
- 监控同步状态和日志
- 打开/关闭AI集成
______________________________________________________________________
🛠️ 技术栈
| 层 | 技术 |
|---|---|
| 框架 | ASP。NET核心(.NET 10) |
| UI | BootstrapAsync(System.Server) |
| MCP | 模型上下文协议SDK 0.9 |
| 人工智能集成 | 微软。扩展。AI+OpenAI |
.Git同步.LibGit2Sharp。 |日程安排| Coravel| |i18n | ASP。NET核心本地化|
______________________________________________________________________
📁 项目结构
BootstrapBlazor.McpServer/
├── Components/ # Blazor UI components (Admin pages, App shell)
├── Services/
│ ├── McpService.cs # MCP tool definitions
│ ├── DocsExtractorService.cs # Docs extraction logic (reflection + XML + Razor)
│ ├── GitSyncInvocable.cs # Git clone/pull + trigger extraction
│ ├── AiIntegrationService.cs # OpenAI-compatible HTTP client
│ └── AppSettingsManager.cs # Read/write appsettings.json at runtime
├── Locales/ # i18n JSON files (zh-CN, en-US)
├── Program.cs # App startup & endpoint mapping
├── Dockerfile # Container build definition
└── appsettings.json # Default configuration______________________________________________________________________
📄 许可证
该项目根据MIT许可证获得许可。看 许可证 了解详情。
______________________________________________________________________
🤝 贡献
欢迎投稿!请打开问题或提交拉取请求。
