Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 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
6 changes: 3 additions & 3 deletions ModelContextProtocol.slnx
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@
<File Path=".github/workflows/release.yml" />
</Folder>
<Folder Name="/samples/">
<Project Path="samples/AspNetCoreSseServer/AspNetCoreSseServer.csproj" />
<Project Path="samples/AspNetCoreMcpServer/AspNetCoreMcpServer.csproj" />
<Project Path="samples/ChatWithTools/ChatWithTools.csproj" />
<Project Path="samples/EverythingServer/EverythingServer.csproj" />
<Project Path="samples/ProtectedMCPClient/ProtectedMCPClient.csproj" />
<Project Path="samples/ProtectedMCPServer/ProtectedMCPServer.csproj" />
<Project Path="samples/ProtectedMcpClient/ProtectedMcpClient.csproj" />
<Project Path="samples/ProtectedMcpServer/ProtectedMcpServer.csproj" />
<Project Path="samples/QuickstartClient/QuickstartClient.csproj" />
<Project Path="samples/QuickstartWeatherServer/QuickstartWeatherServer.csproj" />
<Project Path="samples/TestServerWithHosting/TestServerWithHosting.csproj" />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
using OpenTelemetry;
using OpenTelemetry.Metrics;
using OpenTelemetry.Trace;
using TestServerWithHosting.Tools;
using TestServerWithHosting.Resources;
using AspNetCoreMcpServer.Tools;
using AspNetCoreMcpServer.Resources;

var builder = WebApplication.CreateBuilder(args);
builder.Services.AddMcpServer()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"applicationUrl": "http://localhost:3001",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development",
"OTEL_SERVICE_NAME": "sse-server",
"OTEL_SERVICE_NAME": "aspnetcore-mcp-server",
}
},
"https": {
Expand All @@ -16,7 +16,7 @@
"applicationUrl": "https://localhost:7133;http://localhost:3001",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development",
"OTEL_SERVICE_NAME": "sse-server",
"OTEL_SERVICE_NAME": "aspnetcore-mcp-server",
}
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
using ModelContextProtocol.Protocol;
using ModelContextProtocol.Server;
using System.ComponentModel;

namespace TestServerWithHosting.Resources;
namespace AspNetCoreMcpServer.Resources;

[McpServerResourceType]
public class SimpleResourceType
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using ModelContextProtocol.Server;
using System.ComponentModel;

namespace TestServerWithHosting.Tools;
namespace AspNetCoreMcpServer.Tools;

[McpServerToolType]
public sealed class EchoTool
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
using ModelContextProtocol.Server;
using System.ComponentModel;

namespace TestServerWithHosting.Tools;
namespace AspNetCoreMcpServer.Tools;

/// <summary>
/// This tool uses dependency injection and async method
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ The Protected MCP Client sample shows how to:

- .NET 9.0 or later
- A running TestOAuthServer (for OAuth authentication)
- A running ProtectedMCPServer (for MCP services)
- A running ProtectedMcpServer (for MCP services)

## Setup and Running

Expand All @@ -31,10 +31,10 @@ The OAuth server will start at `https://localhost:7029`

### Step 2: Start the Protected MCP Server

Next, start the ProtectedMCPServer which provides the weather tools:
Next, start the ProtectedMcpServer which provides the weather tools:

```bash
cd samples\ProtectedMCPServer
cd samples\ProtectedMcpServer
dotnet run
```

Expand All @@ -45,7 +45,7 @@ The protected server will start at `http://localhost:7071`
Finally, run this client:

```bash
cd samples\ProtectedMCPClient
cd samples\ProtectedMcpClient
dotnet run
```

Expand Down Expand Up @@ -90,4 +90,4 @@ Once authenticated, the client can access weather tools including:
## Key Files

- `Program.cs`: Main client application with OAuth flow implementation
- `ProtectedMCPClient.csproj`: Project file with dependencies
- `ProtectedMcpClient.csproj`: Project file with dependencies
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using Microsoft.AspNetCore.Authentication.JwtBearer;
using Microsoft.IdentityModel.Tokens;
using ModelContextProtocol.AspNetCore.Authentication;
using ProtectedMCPServer.Tools;
using ProtectedMcpServer.Tools;
using System.Net.Http.Headers;
using System.Security.Claims;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"profiles": {
"ProtectedMCPServer": {
"ProtectedMcpServer": {
"commandName": "Project",
"launchBrowser": true,
"environmentVariables": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,18 +34,18 @@ The OAuth server will start at `https://localhost:7029`
Run this protected server:

```bash
cd samples\ProtectedMCPServer
cd samples\ProtectedMcpServer
dotnet run
```

The protected server will start at `http://localhost:7071`

### Step 3: Test with Protected MCP Client

You can test the server using the ProtectedMCPClient sample:
You can test the server using the ProtectedMcpClient sample:

```bash
cd samples\ProtectedMCPClient
cd samples\ProtectedMcpClient
dotnet run
```

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
using System.Globalization;
using System.Text.Json;

namespace ProtectedMCPServer.Tools;
namespace ProtectedMcpServer.Tools;

[McpServerToolType]
public sealed class WeatherTools
Expand Down
2 changes: 1 addition & 1 deletion tests/ModelContextProtocol.TestOAuthServer/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public sealed class Program
private const int _port = 7029;
private static readonly string _url = $"https://localhost:{_port}";

// Port 5000 is used by tests and port 7071 is used by the ProtectedMCPServer sample
// Port 5000 is used by tests and port 7071 is used by the ProtectedMcpServer sample
private static readonly string[] ValidResources = ["http://localhost:5000/", "http://localhost:7071/"];

private readonly ConcurrentDictionary<string, AuthorizationCodeInfo> _authCodes = new();
Expand Down
Loading