Skip to content

Commit 3e9462c

Browse files
committed
HTTP for local testing
1 parent 53c1151 commit 3e9462c

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

samples/AuthorizationServerExample/Program.cs

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
1-
using Microsoft.AspNetCore.Builder;
21
using ModelContextProtocol;
32
using ModelContextProtocol.AspNetCore;
43
using ModelContextProtocol.Protocol.Auth;
54
using ModelContextProtocol.Protocol.Types;
65
using ModelContextProtocol.Server.Auth;
7-
using System.Text.Json;
86

97
namespace AuthorizationServerExample;
108

@@ -25,7 +23,7 @@ public static async Task Main(string[] args)
2523
// This is the information that will be provided to clients when they need to authenticate
2624
var prm = new ProtectedResourceMetadata
2725
{
28-
Resource = "https://localhost:7071", // The resource identifier (typically your server's base URL)
26+
Resource = "http://localhost:7071", // Changed from HTTPS to HTTP for local development
2927
AuthorizationServers = ["https://auth.example.com"], // Auth servers that can issue tokens for this resource
3028
BearerMethodsSupported = ["header"], // We support the Authorization header
3129
ScopesSupported = ["mcp.tools", "mcp.prompts", "mcp.resources"], // Scopes supported by this resource
@@ -122,10 +120,11 @@ async Task<bool> ValidateToken(string token)
122120
app.MapMcp();
123121

124122
// Configure the server URL
125-
app.Urls.Add("https://localhost:7071");
123+
app.Urls.Add("http://localhost:7071");
124+
125+
Console.WriteLine("Starting MCP server with authorization at http://localhost:7071");
126+
Console.WriteLine("PRM Document URL: http://localhost:7071/.well-known/oauth-protected-resource");
126127

127-
Console.WriteLine("Starting MCP server with authorization at https://localhost:7071");
128-
Console.WriteLine("PRM Document URL: https://localhost:7071/.well-known/oauth-protected-resource");
129128
Console.WriteLine();
130129
Console.WriteLine("To test the server:");
131130
Console.WriteLine("1. Use an MCP client that supports authorization");

0 commit comments

Comments
 (0)