feat: update Node.js samples to MCP V2 per-audience token model#271
feat: update Node.js samples to MCP V2 per-audience token model#271
Conversation
biswapm
commented
Apr 12, 2026
- Update ToolingManifest.json for openai, claude, langchain samples:
- V2 URLs (test.agent365.svc.cloud.dev.microsoft)
- Unified scope: Tools.ListInvoke.All
- Per-server audience GUIDs (Mail: 24b71c94, Calendar: 19ec8e8a)
- Add publisher field
- Replace mcp_WordServer with mcp_CalendarTools (claude)
- Add mcp_CalendarTools entry (langchain)
- Add BEARER_TOKEN_MCP_MAILTOOLS and BEARER_TOKEN_MCP_CALENDARTOOLS to all three .env.template/.env.example files for V2 dev-mode token acquisition
- Add app_logs.zip, app_logs/, manifest/ to .gitignore
- Update ToolingManifest.json for openai, claude, langchain samples: - V2 URLs (test.agent365.svc.cloud.dev.microsoft) - Unified scope: Tools.ListInvoke.All - Per-server audience GUIDs (Mail: 24b71c94, Calendar: 19ec8e8a) - Add publisher field - Replace mcp_WordServer with mcp_CalendarTools (claude) - Add mcp_CalendarTools entry (langchain) - Add BEARER_TOKEN_MCP_MAILTOOLS and BEARER_TOKEN_MCP_CALENDARTOOLS to all three .env.template/.env.example files for V2 dev-mode token acquisition - Add app_logs.zip, app_logs/, manifest/ to .gitignore Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Dependency Review✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.Scanned FilesNone |
There was a problem hiding this comment.
Pull request overview
This PR updates the Node.js sample agents’ MCP configuration to align with an MCP V2 per-audience token model by adjusting tooling manifests, environment templates, and repo ignore rules.
Changes:
- Update MCP
ToolingManifest.jsonentries in the OpenAI/Claude/LangChain Node.js samples (scope/audience/publisher/server selection). - Add per-server bearer token environment variables to the samples’
.env.template/.env.examplefiles. - Ignore generated logs/artifacts (
app_logs*,manifest/) in.gitignore.
Reviewed changes
Copilot reviewed 6 out of 7 changed files in this pull request and generated 9 comments.
Show a summary per file
| File | Description |
|---|---|
| nodejs/openai/sample-agent/ToolingManifest.json | Updates MCP server configuration (now only CalendarTools, new scope/audience/publisher). |
| nodejs/openai/sample-agent/.env.template | Adds per-server bearer token env vars for V2 dev-mode. |
| nodejs/langchain/sample-agent/ToolingManifest.json | Updates MCP server configuration (now only CalendarTools, new scope/audience/publisher). |
| nodejs/langchain/sample-agent/.env.example | Adds per-server bearer token env vars for V2 dev-mode. |
| nodejs/claude/sample-agent/ToolingManifest.json | Updates MCP server configuration (now only CalendarTools, new scope/audience/publisher). |
| nodejs/claude/sample-agent/.env.template | Adds per-server bearer token env vars for V2 dev-mode. |
| .gitignore | Ignores generated logs and manifest output folders/zips. |
| "url": "https://agent365.svc.cloud.microsoft/agents/servers/mcp_CalendarTools", | ||
| "scope": "McpServers.Calendar.All", | ||
| "audience": "ea9ffc3e-8a23-4a7d-836d-234d7c7565c1" | ||
| "scope": "Tools.ListInvoke.All", | ||
| "audience": "910333d2-47e9-43ca-981f-6df2f4531ef4", |
There was a problem hiding this comment.
The URL/audience values here don’t match the PR description (“V2 URLs” under test.agent365.svc.cloud.dev.microsoft and per-server audiences for Mail vs Calendar). Update the url to the V2 hostname and set the audience to the Calendar audience GUID intended for mcp_CalendarTools.
| "mcpServers": [ | ||
| { | ||
| "mcpServerName": "mcp_MailTools", | ||
| "mcpServerUniqueName": "mcp_MailTools", | ||
| "url": "https://agent365.svc.cloud.microsoft/agents/servers/mcp_MailTools", | ||
| "scope": "McpServers.Mail.All", | ||
| "audience": "ea9ffc3e-8a23-4a7d-836d-234d7c7565c1" | ||
| "mcpServerName": "mcp_CalendarTools", | ||
| "mcpServerUniqueName": "mcp_CalendarTools", | ||
| "url": "https://agent365.svc.cloud.microsoft/agents/servers/mcp_CalendarTools", |
There was a problem hiding this comment.
ToolingManifest.json now defines only mcp_CalendarTools. This sample’s agent handles EmailNotification and attempts to retrieve message content, which depends on mcp_MailTools; with MailTools removed, that scenario will fail. Re-add mcp_MailTools alongside CalendarTools (with the appropriate V2 scope/audience).
| "url": "https://agent365.svc.cloud.microsoft/agents/servers/mcp_CalendarTools", | ||
| "scope": "Tools.ListInvoke.All", | ||
| "audience": "910333d2-47e9-43ca-981f-6df2f4531ef4", | ||
| "publisher": "Microsoft" |
There was a problem hiding this comment.
The url/audience values shown here don’t align with the PR description’s V2 hostname and per-server audience GUIDs. Please update the CalendarTools entry to use the V2 endpoint and the Calendar audience GUID (and apply the Mail audience GUID on the MailTools entry once it’s restored).
| BEARER_TOKEN= | ||
| # V2 per-server bearer tokens (dev mode — SDK reads BEARER_TOKEN_<SERVER_NAME_UPPER>) | ||
| BEARER_TOKEN_MCP_MAILTOOLS= |
There was a problem hiding this comment.
This template adds per-server tokens for both MCP_MAILTOOLS and MCP_CALENDARTOOLS, but the updated ToolingManifest.json only defines CalendarTools. Either restore the MailTools server in the manifest or remove the MailTools token variable so the template matches the configured servers. Also consider clarifying that BEARER_TOKEN should be left empty when using per-server tokens for the V2 per-audience model.
| BEARER_TOKEN= | |
| # V2 per-server bearer tokens (dev mode — SDK reads BEARER_TOKEN_<SERVER_NAME_UPPER>) | |
| BEARER_TOKEN_MCP_MAILTOOLS= | |
| # Leave BEARER_TOKEN empty when using V2 per-server bearer tokens. | |
| BEARER_TOKEN= | |
| # V2 per-server bearer tokens (dev mode — SDK reads BEARER_TOKEN_<SERVER_NAME_UPPER>) |
| BEARER_TOKEN= | ||
| # V2 per-server bearer tokens (dev mode — SDK reads BEARER_TOKEN_<SERVER_NAME_UPPER>) | ||
| BEARER_TOKEN_MCP_MAILTOOLS= |
There was a problem hiding this comment.
This file introduces per-server bearer tokens for MailTools and CalendarTools, but the sample’s ToolingManifest.json currently only contains CalendarTools. Please align the env template with the manifest (restore MailTools in the manifest or drop the unused MailTools token variable), and clarify whether BEARER_TOKEN is legacy vs. the preferred per-server tokens in the V2 per-audience model.
| BEARER_TOKEN= | |
| # V2 per-server bearer tokens (dev mode — SDK reads BEARER_TOKEN_<SERVER_NAME_UPPER>) | |
| BEARER_TOKEN_MCP_MAILTOOLS= | |
| # Legacy/global fallback token. Prefer per-server bearer tokens in the V2 per-audience model. | |
| BEARER_TOKEN= | |
| # Preferred V2 per-server bearer tokens (dev mode — SDK reads BEARER_TOKEN_<SERVER_NAME_UPPER>) |
| BEARER_TOKEN= | ||
| # V2 per-server bearer tokens (dev mode — SDK reads BEARER_TOKEN_<SERVER_NAME_UPPER>) | ||
| BEARER_TOKEN_MCP_MAILTOOLS= |
There was a problem hiding this comment.
Per-server bearer tokens were added for MailTools and CalendarTools, but the updated ToolingManifest.json only lists CalendarTools. Please either add MailTools back to the manifest or remove the unused BEARER_TOKEN_MCP_MAILTOOLS variable. It would also help to document whether BEARER_TOKEN should be unset when using per-server tokens in the V2 per-audience model.
| BEARER_TOKEN= | |
| # V2 per-server bearer tokens (dev mode — SDK reads BEARER_TOKEN_<SERVER_NAME_UPPER>) | |
| BEARER_TOKEN_MCP_MAILTOOLS= | |
| # Shared/default bearer token. Leave unset when using V2 per-server bearer tokens below. | |
| BEARER_TOKEN= | |
| # V2 per-server bearer tokens (dev mode — SDK reads BEARER_TOKEN_<SERVER_NAME_UPPER>) | |
| # For the V2 per-audience model, prefer server-specific tokens and leave BEARER_TOKEN unset. |
| "scope": "McpServers.Mail.All", | ||
| "audience": "ea9ffc3e-8a23-4a7d-836d-234d7c7565c1" | ||
| }, | ||
| { |
There was a problem hiding this comment.
ToolingManifest.json now only includes mcp_CalendarTools. The Node.js samples’ agents handle EmailNotification and prompt the model to “retrieve this message”, which relies on mcp_MailTools; removing it will break that flow. Add back an mcp_MailTools entry (and keep mcp_CalendarTools) so email retrieval works again.
| { | |
| { | |
| "mcpServerName": "mcp_MailTools", | |
| "mcpServerUniqueName": "mcp_MailTools", | |
| "url": "https://agent365.svc.cloud.microsoft/agents/servers/mcp_MailTools", | |
| "scope": "Tools.ListInvoke.All", | |
| "audience": "910333d2-47e9-43ca-981f-6df2f4531ef4", | |
| "publisher": "Microsoft" | |
| }, | |
| { |
| "mcpServers": [ | ||
| { | ||
| "mcpServerName": "mcp_MailTools", | ||
| "mcpServerUniqueName": "mcp_MailTools", | ||
| "url": "https://agent365.svc.cloud.microsoft/agents/servers/mcp_MailTools", | ||
| "scope": "McpServers.Mail.All", | ||
| "audience": "ea9ffc3e-8a23-4a7d-836d-234d7c7565c1" | ||
| }, | ||
| { | ||
| "mcpServerName": "mcp_WordServer", | ||
| "mcpServerUniqueName": "mcp_WordServer", | ||
| "url": "https://agent365.svc.cloud.microsoft/agents/servers/mcp_WordServer", | ||
| "scope": "McpServers.Word.All", | ||
| "audience": "ea9ffc3e-8a23-4a7d-836d-234d7c7565c1" | ||
| "mcpServerName": "mcp_CalendarTools", | ||
| "mcpServerUniqueName": "mcp_CalendarTools", | ||
| "url": "https://agent365.svc.cloud.microsoft/agents/servers/mcp_CalendarTools", |
There was a problem hiding this comment.
This manifest drops mcp_MailTools (and other servers) and leaves only mcp_CalendarTools. The Claude Node.js sample still processes EmailNotification and asks the model to retrieve message content, which requires mcp_MailTools; without it, email notifications can’t be handled correctly. Add back mcp_MailTools (and any other required servers) with the new V2 scope/audience settings.
| "url": "https://agent365.svc.cloud.microsoft/agents/servers/mcp_CalendarTools", | ||
| "scope": "Tools.ListInvoke.All", | ||
| "audience": "910333d2-47e9-43ca-981f-6df2f4531ef4", | ||
| "publisher": "Microsoft" |
There was a problem hiding this comment.
Per the PR description, these entries should be updated to the V2 service hostname and to per-server audiences (Mail vs Calendar). The current url is still on the legacy hostname and the audience is a single GUID; update the CalendarTools entry accordingly (and apply the Mail audience on the MailTools entry once restored).