Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions .github/copilot-instructions.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,14 +57,14 @@ The SDK consists of three main packages:

### Naming Conventions
- Use `McpClient`, `McpServer`, `McpSession` for MCP-related classes (capitalize MCP)
- Prefix MCP-specific types with `Mcp` (e.g., `McpException`, `McpEndpoint`)
- Prefix MCP-specific types with `Mcp` (e.g., `McpException`, `McpServerOptions`)
- Use descriptive names for parameters with `[Description("...")]` attributes when exposing to MCP

## Architecture Patterns

### Dependency Injection
- Use Microsoft.Extensions.DependencyInjection patterns
- Register services with `.AddMcpServer()` and `.AddMcpClient()` extension methods
- Register the server with the `.AddMcpServer()` extension method
- Support both builder patterns and options configuration

### JSON Serialization
Expand All @@ -74,7 +74,7 @@ The SDK consists of three main packages:
- Set `JsonIgnoreCondition.WhenWritingNull` for optional properties to minimize payload size
- Use `JsonSerializerDefaults.Web` for camelCase property naming
- Protocol types are decorated with `[JsonSerializable]` attributes for AOT support
- Custom converters: `CustomizableJsonStringEnumConverter` for flexible enum serialization
- When reflection-based serialization is enabled, user-defined enums are serialized as strings with the built-in `JsonStringEnumConverter`; Native AOT enums require source-generated converter metadata such as `JsonStringEnumConverter<TEnum>`.

### Async Patterns
- All I/O operations should be async
Expand Down Expand Up @@ -246,7 +246,7 @@ Two primary transport implementations with different invariants:
- Default to `McpJsonUtilities.DefaultOptions` if not specified
- Can use reflection-based serialization or custom source generators

- **Enum handling**: `CustomizableJsonStringEnumConverter` for flexible enum serialization
- **Enum handling**: reflection-based serialization uses the built-in `JsonStringEnumConverter`; Native AOT enums require source-generated converter metadata such as `JsonStringEnumConverter<TEnum>`

## Architecture and Design Patterns

Expand All @@ -255,7 +255,7 @@ Two primary transport implementations with different invariants:
- **IMcpServerBuilder** pattern provides fluent API for configuring servers via DI
- Server primitives (tools, prompts, resources) are discovered via reflection using attributes
- Support both attribute-based registration (`WithTools<T>()`) and instance-based (`WithTools(target)`)
- Use `McpServerFactory` to create server instances with configured options
- Use `McpServer.Create` to create server instances with configured options

### Tool/Prompt/Resource Discovery
- Tools, prompts, and resources use attribute-based discovery: `[McpServerTool]`, `[McpServerPrompt]`, `[McpServerResource]`
Expand Down
Loading