-
Notifications
You must be signed in to change notification settings - Fork 460
Users/aclerbois/dev v5/add mcp #4387
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: dev-v5
Are you sure you want to change the base?
Users/aclerbois/dev v5/add mcp #4387
Conversation
- Implemented EnumInfoFactory for creating enum information from types. - Developed FluentUIDocumentationService to extract documentation from Fluent UI components. - Created TypeHelper for type-related operations, including friendly type names and enum value retrieval. - Added XmlDocumentationReader for reading XML documentation comments. - Introduced ComponentDetailTools for detailed component documentation retrieval. - Created ComponentListTools for listing and searching Fluent UI components. - Developed EnumTools for accessing enum documentation and values. - Implemented GuideTools for accessing documentation guides. - Added ToolOutputHelper for formatting tool output. - Created XmlDocumentationFinder to locate XML documentation files.
- Added FluentUI.Mcp.Shared project to the solution. - Integrated MCP capabilities into the FluentUI.Demo.Client project. - Updated solution and project files to include new references. - Removed McpReflectionService.cs from the server project and moved it to the shared project. - Created McpCapabilitiesData class to provide static data for MCP tools, prompts, and resources. - Implemented MCP server documentation in McpServer.md. - Added a new example page (McpCapabilities.razor) to demonstrate MCP capabilities. - Removed obsolete McpReflectionService.cs file from the server project.
- Removed the C# MCP Server Expert agent documentation. - Added NSubstitute package for mocking in tests. - Updated solution file to include new MCP project and test projects. - Created new test projects for FluentUI MCP Server and its services. - Implemented unit tests for DocumentationGuideService, FluentUIDocumentationService, and MCP capabilities. - Added tests for component detail and list tools, including search and filtering functionalities. - Introduced tests for enum tools and guide tools, ensuring coverage for known and unknown cases. - Configured xUnit runner settings for test execution.
| !type.Name.Contains('<') && | ||
| !type.Name.Contains('>') && | ||
| !type.Name.EndsWith("_g") && | ||
| typeof(ComponentBase).IsAssignableFrom(type); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this check use typeof(IComponent).IsAssignableFrom(type) instead?
Just wondering because components can implement IComponent directly without inheriting from ComponentBase, so I wanted to confirm whether the intent here is to include only ComponentBase-derived components or all valid component types.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After a discussion with @dvoituron, we found you're right about the ComponentBase, but the IComponent is not the best choice.
In the library each component must be inherit from FluentComponentBase and ````FluentInputBase, both as interfaced through IFluentComponentBase```.
This is the best choice to enforce the security then
| .Select(c => c.Category) | ||
| .Where(c => !string.IsNullOrEmpty(c)) | ||
| .Distinct() | ||
| .OrderBy(c => c) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit / Question:
Noticed that Distinct and OrderBy don’t specify a comparer here.
Is the case-sensitivity or ordering intended to follow the default culture-aware behavior?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point, I will fix it in my next commit. Ty
- Implement tests for DocumentationGuideService to verify guide retrieval and content. - Add tests for FluentUIDocumentationService to ensure component details and categories are correctly returned. - Create tests for various prompts including CreateComponentPrompt, CreateFormPrompt, and ExplainComponentPrompt to validate prompt generation. - Introduce tests for McpCapabilitiesData and McpReflectionService to check data integrity and resource availability. - Develop tests for tools such as ComponentDetailTools, ComponentListTools, EnumTools, and GuideTools to ensure functionality and correctness. - Establish a global usings file for test projects to streamline code. - Set up project file for the test suite with necessary dependencies and configurations. Update namespaces to new McpServer structure and Blazor APIs Migrated all FluentUI.Mcp.Server.* and FluentUI.Mcp.Shared.* references to Microsoft.FluentUI.AspNetCore.Components.McpServer.* and related namespaces across the codebase. Updated Blazor components in McpCapabilities.razor to use new FluentTabs/FluentTab APIs (Label, ActiveTabIdChanged) and added type parameters to FluentDataGrid. Adjusted service initialization and test setup to use the correct assemblies. Added "peer": true to several dev dependencies in package-lock.json. These changes align with the new package structure and resolve naming conflicts. Refine component type filtering and category sorting Expanded IsValidComponentType docs to clarify FluentUI focus and rationale for IFluentComponentBase usage. Updated filtering to require IFluentComponentBase implementation. Improved GetCategories to use case-insensitive distinct and sorting. Added explicit System.Linq import.
21de7f6 to
103238c
Compare
Major refactor: replace XML-based documentation with build-time generated JSON file for all component and enum info. Remove LoxSmoke.DocXml dependency and all runtime XML parsing. Embed JSON as resource for fast, reliable access. Update DI, services, tests, and README. Add new generator, models, and MSBuild targets for auto-generation and embedding.
Enhance SetupProjectPrompt to include explicit version info and NuGet guidance. Expose documented component and MCP Server versions in FluentUIDocumentationService. Add CheckVersionCompatibilityPrompt for semantic version checks and actionable recommendations. Introduce VersionTools for programmatic version info and compatibility checks. Register new prompt in service collection. Improves user guidance and reduces documentation mismatches.
Added new test classes for MCP Server prompts, resources, and tools, including coverage for prompt generation, resource access, and version/tooling features. Updated CreateFormPromptTests for v5 component naming. Enhanced McpCapabilitiesDataTests with cache and initialization checks. All new tests include MIT license headers and XML documentation. These changes greatly improve test coverage and reliability. Add comprehensive unit tests for MCP Server and prompts Expanded test coverage for MCP Server, Prompts, Resources, Tools, and Shared models. Added dedicated test classes for each prompt and resource, including edge case and error handling tests. Improved robustness of existing tests, especially for v5 component name changes. Ensured all new tests include MIT license headers and XML documentation. This enhances reliability and maintainability across the codebase.
Refactored codebase to use C# collection expressions (e.g., [.. collection], []) instead of .ToList(), new[], or Array.Empty<T>(). This modernizes and simplifies list and array creation throughout both implementation and test files, improving readability without changing behavior. Also includes minor formatting cleanups for consistency.
| <packageSources> | ||
| <clear /> | ||
| <add key="dotnet-public" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-public/nuget/v3/index.json" /> | ||
| <add key="dotnet9" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet9/nuget/v3/index.json" /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Microsoft ADO refues to have multiple feeds. We can use only the dotnet-public
| app.UseRequestLocalization(new RequestLocalizationOptions().AddSupportedUICultures(["en", "fr"])); | ||
|
|
||
| // API endpoint to expose MCP capabilities for WebAssembly clients | ||
| app.MapGet("/api/mcp/capabilities", () => McpCapabilitiesData.GetSummary()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why did you add this API? The Blazor Demo project can be published using Server but also WASM mode to be hosted on a static website.
| - **Resources**: User-selected static content (component lists, guides) | ||
| - **Prompts**: Pre-defined templates for common tasks (create component, migrate code) | ||
|
|
||
| {{ McpCapabilities }} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think we need to display the source code of this component. You can add SourceCode="false" to hide the source tab.
| </FluentTabs> | ||
| } | ||
|
|
||
| @code { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we don't display the source code in the .md file, can you move this code to a .cs file ?
| else | ||
| { | ||
| // Fetch from API (for WebAssembly mode) | ||
| _summary = await Http.GetFromJsonAsync<McpSummary>("/api/mcp/capabilities"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The final hosting will be on a static web site. So not API available :-(
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can have an API with SWA
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why did you change this file ?
|
@vnbaaij @Tyme-Bleyaert FYI : After a code review today with @dvoituron, We decided to stop this PR and split it into several smaller prs, following the plan :
|
Pull Request
📖 Description
Following the issue #4386, I create the MCP Server.
The MCP is documented in the demo doc examples via reflexion.
You can find all MCP ressources via the documentation.
If you run it via VS Code, you can get the follow behavior.
Prompts :

Tools :

Ressources :

🎫 Issues
👩💻 Reviewer Notes
You should follow the Examples/Mcp/Readme.md file to isntall locally the MCP and test it.
📑 Test Plan
✅ Checklist
General
Component-specific
After that, you should publish the new NuGet generated package to NuGet.org
⏭ Next Steps