-
Notifications
You must be signed in to change notification settings - Fork 43
Add V2 per-audience MCP token support to .NET samples #272
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,33 @@ | ||||||
| { | ||||||
| "profiles": { | ||||||
| "Sample Agent": { | ||||||
| "commandName": "Project", | ||||||
| "launchBrowser": false, | ||||||
| "environmentVariables": { | ||||||
| "ASPNETCORE_ENVIRONMENT": "Development", | ||||||
| "SKIP_TOOLING_ON_ERRORS": "true" | ||||||
| }, | ||||||
| "applicationUrl": "http://localhost:3978" | ||||||
| }, | ||||||
| "Sample Agent with Bearer Token Support": { | ||||||
| "commandName": "Project", | ||||||
| "launchBrowser": false, | ||||||
| "environmentVariables": { | ||||||
| "ASPNETCORE_ENVIRONMENT": "Development", | ||||||
| "BEARER_TOKEN": "", | ||||||
| "SKIP_TOOLING_ON_ERRORS": "true" | ||||||
| }, | ||||||
| "applicationUrl": "http://localhost:3978" | ||||||
| }, | ||||||
| "Sample Agent with V2 Bearer Token Support": { | ||||||
| "commandName": "Project", | ||||||
| "launchBrowser": false, | ||||||
| "environmentVariables": { | ||||||
| "ASPNETCORE_ENVIRONMENT": "Development", | ||||||
| "BEARER_TOKEN": "", | ||||||
|
||||||
| "BEARER_TOKEN": "", | |
| "BEARER_TOKEN_YOUR_SERVER_NAME": "", |
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -1,4 +1,9 @@ | ||||||
| { | ||||||
| // V2 MCP per-server dev tokens: set BEARER_TOKEN_<UPPERCASE_SERVER_NAME> environment variables. | ||||||
| // Run: a365 develop get-token (writes these automatically for all configured servers) | ||||||
| // The SDK reads BEARER_TOKEN_<SERVER_NAME> for each V2 server and falls back to BEARER_TOKEN for V1. | ||||||
|
||||||
| // The SDK reads BEARER_TOKEN_<SERVER_NAME> for each V2 server and falls back to BEARER_TOKEN for V1. | |
| // The SDK reads BEARER_TOKEN_<UPPERCASE_SERVER_NAME> for each V2 server, using the server name normalized to uppercase, and falls back to BEARER_TOKEN for V1. |
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -18,6 +18,16 @@ | |||||||||
| "SKIP_TOOLING_ON_ERRORS": "true" | ||||||||||
| }, | ||||||||||
| "applicationUrl": "https://localhost:64896;http://localhost:64897" | ||||||||||
| }, | ||||||||||
| "Sample Agent with V2 Bearer Token Support": { | ||||||||||
| "commandName": "Project", | ||||||||||
| "launchBrowser": true, | ||||||||||
| "environmentVariables": { | ||||||||||
| "ASPNETCORE_ENVIRONMENT": "Development", | ||||||||||
| "BEARER_TOKEN": "", | ||||||||||
|
||||||||||
| "BEARER_TOKEN": "", | |
| "BEARER_TOKEN": "", | |
| "BEARER_TOKEN_GITHUB": "", | |
| "BEARER_TOKEN_AZURE": "", |
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -14,6 +14,11 @@ | |||||
| "TenantId": "{{TenantId}}" | ||||||
| }, | ||||||
|
|
||||||
| // V2 MCP per-server dev tokens: set BEARER_TOKEN_<UPPERCASE_SERVER_NAME> environment variables. | ||||||
| // Run: a365 develop get-token (writes these automatically for all configured servers) | ||||||
| // The SDK reads BEARER_TOKEN_<SERVER_NAME> for each V2 server and falls back to BEARER_TOKEN for V1. | ||||||
|
||||||
| // The SDK reads BEARER_TOKEN_<SERVER_NAME> for each V2 server and falls back to BEARER_TOKEN for V1. | |
| // For each V2 server, the SDK uppercases the configured server name and reads BEARER_TOKEN_<UPPERCASE_SERVER_NAME>; it falls back to BEARER_TOKEN for V1. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now that
tokenOverridewas removed fromGetMcpToolsAsync(...), MCP tool loading depends onagentIdbeing non-null. ButagentIdis still only resolved viaauthHandlerNameorBEARER_TOKEN, so a dev setup that only provides V2BEARER_TOKEN_<SERVER_NAME>values will never reach this call. Consider resolvingagentIdfrom agentic context when available (e.g.,IsAgenticRequest()/GetAgenticInstanceId()), or otherwise handle/document the token requirement for agentId.