Skip to content

Comments

feat: Add MCP server with JWT authentication#876

Draft
BenjaminMichaelis wants to merge 1 commit intomainfrom
bmichaelis/MCPServer
Draft

feat: Add MCP server with JWT authentication#876
BenjaminMichaelis wants to merge 1 commit intomainfrom
bmichaelis/MCPServer

Conversation

@BenjaminMichaelis
Copy link
Member

  • Add McpTokenService with JWT token generation/validation
  • Add McpTokenController for token management UI
  • Add MCP Access page to account management
  • Configure MCP server with BookSearchTool
  • Update ModelContextProtocol packages to 0.9.0-preview.2
  • Add Microsoft.AspNetCore.Authentication.JwtBearer
  • Fix MCP client API: use concrete McpClient type
  • Add toolCallDepth guard to prevent infinite recursion

- Add McpTokenService with JWT token generation/validation
- Add McpTokenController for token management UI
- Add MCP Access page to account management
- Configure MCP server with BookSearchTool
- Update ModelContextProtocol packages to 0.9.0-preview.2
- Add Microsoft.AspNetCore.Authentication.JwtBearer
- Fix MCP client API: use concrete McpClient type
- Add toolCallDepth guard to prevent infinite recursion

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Comment on lines +62 to +67
var listToolsRequest = new HttpRequestMessage(HttpMethod.Post, "/mcp")
{
Content = new StringContent(
"""{"jsonrpc":"2.0","id":2,"method":"tools/list","params":{}}""",
Encoding.UTF8, "application/json")
};
string? line;
while ((line = await reader.ReadLineAsync(cts.Token)) is not null)
{
body += line + "\n";
Comment on lines +361 to +376
if (kvp.Value is System.Text.Json.JsonElement jsonElement)
{
arguments[kvp.Key] = jsonElement.ValueKind switch
{
System.Text.Json.JsonValueKind.String => jsonElement.GetString(),
System.Text.Json.JsonValueKind.Number => jsonElement.GetDecimal(),
System.Text.Json.JsonValueKind.True => true,
System.Text.Json.JsonValueKind.False => false,
System.Text.Json.JsonValueKind.Null => null,
_ => jsonElement.ToString()
};
}
else
{
arguments[kvp.Key] = kvp.Value;
}
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.

1 participant