Contributing to AvaloniaUI MCP Server

Thank you for your interest in contributing to the AvaloniaUI MCP Server! This document provides guidelines and information for contributors.

🀝 How to Contribute

Reporting Issues

  1. Check existing issues first to avoid duplicates
  2. Use the issue templates when available
  3. Provide detailed information:
    • Clear description of the problem
    • Steps to reproduce
    • Expected vs actual behavior
    • Environment details (.NET version, OS, MCP client)
    • Relevant logs or error messages

Suggesting Enhancements

  1. Open an issue with the enhancement request
  2. Describe the use case and why it would be valuable
  3. Provide examples of how it would work
  4. Consider backward compatibility implications

Pull Requests

  1. Fork the repository and create a feature branch
  2. Follow the coding standards outlined below
  3. Write tests for new functionality
  4. Update documentation as needed
  5. Ensure all CI checks pass before requesting review

πŸ—οΈ Development Setup

Prerequisites

Local Development

  1. Clone the repository:
    1
    2
    
    git clone https://github.com/your-username/AvaloniaUI.MCP.git
    cd AvaloniaUI.MCP
    
  2. Restore dependencies:
    1
    
    dotnet restore
    
  3. Build the project:
    1
    
    dotnet build
    
  4. Run tests:
    1
    
    dotnet test
    
  5. Run the MCP server:
    1
    
    dotnet run --project src/AvaloniaUI.MCP/AvaloniaUI.MCP.csproj
    

πŸ“ Coding Standards

Code Style

Project Structure

1
2
3
4
5
src/AvaloniaUI.MCP/
β”œβ”€β”€ Tools/          # MCP tools (actions that can be performed)
β”œβ”€β”€ Resources/      # MCP resources (knowledge base providers)
β”œβ”€β”€ Prompts/        # MCP prompts (template generators)
└── Data/           # JSON knowledge base files

Adding New Features

Adding a New Tool

  1. Create a new class in src/AvaloniaUI.MCP/Tools/
  2. Use the [McpServerToolType] attribute on the class
  3. Use the [McpServerTool] attribute on methods
  4. Add [Description] attributes for documentation
  5. Write unit tests in tests/AvaloniaUI.MCP.Tests/

Example:

1
2
3
4
5
6
7
8
9
10
11
[McpServerToolType]
public static class MyNewTool
{
    [McpServerTool, Description("Description of what this tool does")]
    public static string MyToolMethod(
        [Description("Parameter description")] string parameter)
    {
        // Implementation
        return "Result";
    }
}

Adding a New Resource

  1. Create a new class in src/AvaloniaUI.MCP/Resources/
  2. Use the [McpServerResourceType] attribute on the class
  3. Use the [McpServerResource] attribute on methods
  4. Return Task<string> for async resource loading
  5. Add corresponding JSON data files if needed

Adding a New Prompt

  1. Create or extend a class in src/AvaloniaUI.MCP/Prompts/
  2. Use the [McpServerPromptType] attribute on the class
  3. Use the [McpServerPrompt] attribute on methods
  4. Return Task<string> with the generated prompt

Testing Guidelines

Example test:

1
2
3
4
5
6
7
8
9
10
11
12
[Fact]
public void MyTool_WithValidInput_ReturnsExpectedResult()
{
    // Arrange
    var input = "test input";

    // Act
    var result = MyNewTool.MyToolMethod(input);

    // Assert
    Assert.Contains("expected content", result);
}

Documentation

πŸ”„ Pull Request Process

Before Submitting

  1. Ensure all tests pass:
    1
    
    dotnet test
    
  2. Check code formatting:
    1
    
    dotnet format --verify-no-changes
    
  3. Build in release mode:
    1
    
    dotnet build --configuration Release
    
  4. Update documentation if needed

PR Requirements

Review Process

  1. Automated checks must pass (CI, tests, formatting)
  2. Code review by maintainers
  3. Testing of the functionality
  4. Documentation review if applicable
  5. Merge after approval

🌟 Areas for Contribution

High Priority

Medium Priority

Ideas for New Features

πŸ› Bug Reports

When reporting bugs, please include:

  1. Clear title summarizing the issue
  2. Steps to reproduce the problem
  3. Expected behavior vs actual behavior
  4. Environment information:
    • Operating system and version
    • .NET version
    • MCP client being used
    • AvaloniaUI MCP Server version
  5. Logs or error messages (if applicable)
  6. Minimal reproduction case (if possible)

πŸ“š Knowledge Base Contributions

The AvaloniaUI MCP Server’s knowledge base is stored in JSON files in src/AvaloniaUI.MCP/Data/. Contributions to improve or expand this knowledge base are highly valued:

Controls Reference (controls.json)

XAML Patterns (xaml-patterns.json)

Migration Guide (migration-guide.json)

🏷️ Issue Labels

πŸ“„ License

By contributing to this project, you agree that your contributions will be licensed under the same license as the project (MIT License).

πŸ†˜ Getting Help

Thank you for contributing to make AvaloniaUI development better for everyone! πŸŽ‰