BootstrapBlazor/BootstrapBlazor.Copilot.MCPServer
If you are the rightful owner of BootstrapBlazor.Copilot.MCPServer and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to henry@mcphub.com.
BootstrapBlazor.Copilot.MCPServer is a Model Context Protocol server designed to provide AI assistants with access to BootstrapBlazor component documentation and source code.
BootstrapBlazor.Copilot.MCPServer
| English README
A Model Context Protocol (MCP) server that provides AI assistants (like GitHub Copilot, Claude) with access to BootstrapBlazor component documentation and source code.
Project Overview
BootstrapBlazor.Copilot.MCPServer is an MCP server specifically designed for the BootstrapBlazor framework that can:
- š Provide complete documentation for BootstrapBlazor components
- š Allow AI assistants to search and browse component source code
- š Offer component usage examples and best practices
- š Automatically sync the latest BootstrapBlazor source code
- š ļø Support integration with AI assistants via HTTP transport
Architecture
The project is built with .NET 9.0 and ASP.NET Core, including the following main components:
Project Structure
BootstrapBlazor.Copilot.MCPServer/
āāā BootstrapBlazor.Copilot.MCPServer/ # Main service project
ā āāā Services/ # Core services
ā ā āāā GitRepositoryManager.cs # Git repository management
ā ā āāā ComponentDocumentationService.cs # Component documentation service
ā āāā Tools/ # MCP tool definitions
ā ā āāā ComponentsTool.cs # Component query tools
ā āāā Models/ # Data models
ā ā āāā Component.cs # Component-related models
ā āāā Program.cs # Application entry point
āāā BootstrapBlazor.Copilot.MCPServer.AppHost/ # Aspire application host
āāā BootstrapBlazor.Copilot.MCPServer.ServiceDefaults/ # Shared service configuration
Core Features
-
Git Repository Management (
GitRepositoryManager
)- Automatically clone and update BootstrapBlazor official repository
- Check if local repository is up to date
- Background service for periodic code synchronization
-
Component Documentation Service (
ComponentDocumentationService
)- Scan and index all BootstrapBlazor components
- Provide access to component source code and example files
- Intelligent path resolution supporting multiple file organization structures
-
MCP Tools (
ComponentsTool
)ListComponents
: List all available componentsGetComponentFiles
: Get component file listGetFileContent
: Get specific file contentEcho
: Test tool
Technology Stack
- .NET 9.0: Latest .NET framework
- ASP.NET Core: Web application framework
- Model Context Protocol: AI assistant integration protocol
- LibGit2Sharp: Git operations library
- .NET Aspire: Cloud-native application development platform
- OpenTelemetry: Observability and monitoring
Installation and Configuration
Prerequisites
- .NET 9.0 SDK
- Git
- Visual Studio 2022 or VS Code
Quick Start
-
Clone the project
git clone https://github.com/your-repo/BootstrapBlazor.Copilot.MCPServer.git cd BootstrapBlazor.Copilot.MCPServer
-
Restore dependencies
dotnet restore
-
Run the service
# Using Aspire (recommended) dotnet run --project BootstrapBlazor.Copilot.MCPServer.AppHost # Or run the main project directly dotnet run --project BootstrapBlazor.Copilot.MCPServer
-
Verify the service The service runs on
http://localhost:3001
by default and supports the following endpoints:/health
- Health check/alive
- Liveness check- MCP protocol endpoints
Configuration Options
Configure the following options in appsettings.json
:
{
"McpToolConfig": {
"ServerUrl": "http://localhost:3001"
},
"GitRepository": {
"LocalPath": "C:\\temp\\BootstrapBlazorRepo" // Optional: custom local repository path
}
}
MCP Tool Usage
1. List All Components
# MCP call example
ListComponents()
Returns names and descriptions of all BootstrapBlazor components.
2. Get Component File List
GetComponentFiles("Button")
Returns a list of source code files and example files for the specified component.
3. Get File Content
GetFileContent({
"ComponentName": "Button",
"FileName": "Button.razor.cs",
"Category": "Source" // Source or Example
})
Returns the complete content of the specified file.
AI Assistant Integration
This service is designed to integrate with AI assistants that support the MCP protocol:
GitHub Copilot Integration
- Add MCP server in GitHub Copilot settings
- Configure server address:
https://localhost:3001
- Restart GitHub Copilot to apply configuration
Claude Desktop Integration
Add to Claude Desktop configuration file:
{
"mcpServers": {
"bootstrapblazor": {
"command": "dotnet",
"args": ["run", "--project", "path/to/BootstrapBlazor.Copilot.MCPServer"],
"env": {
"ASPNETCORE_ENVIRONMENT": "Production"
}
}
}
}
Development Guide
Adding New MCP Tools
- Create a new tool class in the
Tools
directory - Mark the class with
[McpServerToolType]
- Mark tool methods with
[McpServerTool]
- Register the service in
Program.cs
Example:
[McpServerToolType]
public class NewTool
{
[McpServerTool, Description("New tool description")]
public string NewMethod(string parameter)
{
return "Result";
}
}
Extending Component Analysis
You can add new component analysis logic in ComponentDocumentationService
:
- Parse component properties
- Extract usage examples
- Generate component relationship diagrams
Monitoring and Operations
Health Checks
/health
- Complete health check/alive
- Basic liveness check
Logging
The project uses the .NET standard logging framework, supporting:
- Console output
- File logging (requires configuration)
- Structured logging
- OpenTelemetry integration
Performance Monitoring
Provided through .NET Aspire and OpenTelemetry:
- Request tracing
- Performance metrics
- Distributed tracing
- Error monitoring
Troubleshooting
Common Issues
-
Git repository clone failure
- Check network connectivity
- Verify Git is properly installed
- Check firewall settings
-
MCP connection failure
- Verify server address configuration
- Check if port is in use
- Confirm MCP client configuration is correct
-
Component files not found
- Confirm BootstrapBlazor repository is properly cloned
- Check local repository path configuration
- Verify component name spelling
Debug Mode
Enable detailed logging in development environment:
{
"Logging": {
"LogLevel": {
"Default": "Debug",
"BootstrapBlazor.Copilot.MCPServer": "Trace"
}
}
}
Contributing
- Fork this project
- Create a feature branch (
git checkout -b feature/AmazingFeature
) - Commit your changes (
git commit -m 'Add some AmazingFeature'
) - Push to the branch (
git push origin feature/AmazingFeature
) - Create a Pull Request
License
This project is licensed under the Apache License 2.0. See the file for details.
Related Links
- BootstrapBlazor Official Website
- BootstrapBlazor GitHub Repository
- Model Context Protocol Specification
- .NET Aspire Documentation
Version History
v1.1.0
- Update the component model, add example file and documentation file attributes
- Correct the file search logic to look for example code only in the Samples directory
- Update the MCP server version number and the way to access configuration items
- Adjust the ServerUrl configuration in the development environment to use HTTP protocol
v1.0.0
- Initial release
- Basic MCP tool implementation
- Git repository auto-sync
- Component documentation service
Note: This project is currently in development, and APIs may change. Thorough testing is recommended before production use.