ProtectedMcpServer sample doesn't work with VSCode auth flow

Open
#689 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
48/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Quiet
Tech stack
csharp, vscode

Research direction

Start by running tests/ModelContextProtocol.TestOAuthServer with net9.0, then run samples/ProtectedMcpServer and reproduce the VSCode MCP authentication flow. Compare its behavior with samples/ProtectedMcpClient, which works correctly, and trace the client registration and authorization requests. Done means VSCode can complete authentication against the protected sample server.

Written by the indexing model from the issue text.

Description

area-auth bug help wanted needs confirmation P3

Steps to reproduce the behavior:

  1. cd .\tests\ModelContextProtocol.TestOAuthServer\
  2. dotnet run --framework net9.0
  3. cd samples\ProtectedMcpServer\
  4. dotnet run
  5. Add MCP Server http://localhost:7071/ on VsCode
  6. Click proceed on DCR not supported:
Image
  1. When prompted for Client registration details (Client Id) enter "demo-client"
  2. VsCode tries to authenticate
Image

but when doing so fails with

Image

Expected behavior
Auth flow should work from VsCode MCP client.

Additional context
Testing the same MCP server from samples\ProtectedMcpClient works correctly.

Dominant language
C#
Stars
4.5k
Forks
814
Avg merge
9d 19h
Merged PRs (30d)
4

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from modelcontextprotocol/csharp-sdk

All issues in modelcontextprotocol/csharp-sdk

Similar issues

More C# issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.