Skip to content

Conversation

Copilot
Copy link

@Copilot Copilot AI commented Jul 23, 2025

This PR adds a new "Getting Started (ASP.NET Core Server)" section to the main README to demonstrate how to create HTTP-based MCP servers using the ModelContextProtocol.AspNetCore package.

Changes Made

  • Added a comprehensive new section following the same format as the existing "Getting Started (Server)" section
  • Includes clear installation instructions using dotnet new web and the AspNetCore package
  • Provides two working examples:
    1. Basic example with an echo tool (similar to the existing server example)
    2. Advanced example showing dependency injection with IHttpClientFactory
  • References the detailed AspNetCore package documentation for additional information

Sample Code

The basic example shows how to set up an ASP.NET Core MCP server:

using ModelContextProtocol.Server;
using System.ComponentModel;

var builder = WebApplication.CreateBuilder(args);
builder.Services.AddMcpServer()
    .WithHttpTransport()
    .WithToolsFromAssembly();
var app = builder.Build();

app.MapMcp();
app.Run("http://localhost:3001");

[McpServerToolType]
public static class EchoTool
{
    [McpServerTool, Description("Echoes the message back to the client.")]
    public static string Echo(string message) => $"hello {message}";
}

The advanced example demonstrates how to leverage ASP.NET Core's dependency injection system with MCP tools.

Testing

  • All sample code has been validated and compiles successfully
  • Created test projects to verify the examples work as documented
  • Maintained consistency with existing documentation style and formatting

Fixes #14.


💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.

@Copilot Copilot AI changed the title [WIP] Add a sample for an ASP.NET Core based MCP server to the main README Add ASP.NET Core MCP server sample to main README Jul 23, 2025
Copilot finished work on behalf of halter73 July 23, 2025 23:20
@Copilot Copilot AI requested a review from halter73 July 23, 2025 23:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add a sample for an ASP.NET Core based MCP server to the main README

2 participants