You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Fix manifest/gateway parsing and add local dev per-server token support
- Normalize "default" audience → None and "null" scope → None in both
_parse_manifest_server_config() and _parse_gateway_server_config() so
Dataverse-style servers are correctly treated as V1 (shared ATG token)
instead of triggering a bogus V2 token exchange
- Add "default" guard to resolve_token_scope_for_server() as defense-in-depth
- Fall back to mcpServerName when mcpServerUniqueName is absent from the
manifest or gateway response
- Add _attach_dev_tokens() — reads BEARER_TOKEN_<SERVER_UNIQUE_NAME> and
BEARER_TOKEN env vars written by `a365 develop get-token` and attaches
per-server Authorization headers during local dev manifest loading;
no-op in production where OBO via _attach_per_audience_tokens() is used
Copy file name to clipboardExpand all lines: libraries/microsoft-agents-a365-tooling/CHANGELOG.md
+7-1Lines changed: 7 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -9,21 +9,27 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
9
9
10
10
### Added
11
11
12
-
- Added V1/V2 per-audience token acquisition support in `McpToolServerConfigurationService.list_tool_servers()`. When `authorization`, `auth_handler_name`, and `turn_context` are provided, each MCP server receives its own OAuth token scoped to its audience — V1 servers (no audience, or shared ATG AppId) share a single ATG-scoped token; V2 servers (unique non-ATG audience GUID or `api://` URI) each receive a token scoped to `{audience}/{scope}` (or `{audience}/.default` when scope is absent and pre-consented)
12
+
- Added MCP V1/V2 per-audience token acquisition support in `McpToolServerConfigurationService.list_tool_servers()`. When `authorization`, `auth_handler_name`, and `turn_context` are provided, each MCP server receives its own OAuth token scoped to its audience — V1 servers (no audience, or shared ATG AppId) share a single ATG-scoped token; V2 servers (unique non-ATG audience GUID or `api://` URI) each receive a token scoped to `{audience}/{scope}` (or `{audience}/.default` when scope is absent and pre-consented)
13
13
- Added `_attach_per_audience_tokens()` private method to `McpToolServerConfigurationService` — acquires one token per unique scope, caches within the call to avoid redundant exchanges, and attaches `Authorization: Bearer` headers to each server config
14
14
- Added `resolve_token_scope_for_server()` utility function to derive the correct OAuth scope for a given `MCPServerConfig` based on its `audience` and `scope` fields
15
15
- Added `audience`, `scope`, `publisher`, and `headers` fields to `MCPServerConfig`
16
16
- Gateway discovery endpoint bumped to `/agents/v2/{id}/mcpServers`
17
17
-`_parse_gateway_server_config()` and `_parse_manifest_server_config()` now map `audience`, `scope`, and `publisher` fields from gateway/manifest responses into `MCPServerConfig`
18
18
19
+
- Added `_attach_dev_tokens()` private method to `McpToolServerConfigurationService` — reads `BEARER_TOKEN_<SERVER_UNIQUE_NAME>` and `BEARER_TOKEN` environment variables written by the `a365 develop get-token` CLI and attaches per-server `Authorization: Bearer` headers during local dev manifest loading; no-op in production
20
+
19
21
### Changed
20
22
21
23
- OpenAI, Semantic Kernel, and Google ADK extensions now pass auth context to `list_tool_servers()` and merge per-server headers (`{**base_headers, **server.headers}`) instead of injecting a single shared ATG token for all servers — fully backward compatible, V1 agents continue to receive the same shared ATG token
24
+
-`_extract_server_unique_name()` now falls back to `mcpServerName` when `mcpServerUniqueName` is absent from the manifest or gateway response
25
+
-`_parse_manifest_server_config()` and `_parse_gateway_server_config()` now normalize `"null"` scope strings and `"default"` audience strings to `None` to prevent incorrect V2 token scope resolution
26
+
-`resolve_token_scope_for_server()` now treats `"default"` audience as V1 (shared ATG token) as a defense-in-depth guard
22
27
23
28
### Notes
24
29
25
30
-**Backward compatible**: agents with V1 manifests (null audience or shared ATG AppId) work identically with the new SDK — no token exchange behaviour changes
26
31
-**Migration required for V2**: agents upgraded to V2 blueprint permissions (per-audience MCP servers) require this SDK version. Running a V2 blueprint with the old SDK will result in MCP tool auth failures (401/403)
32
+
-**Local dev token flow**: run `a365 develop get-token` before starting the agent locally; the CLI writes `BEARER_TOKEN` (V1 shared) and `BEARER_TOKEN_<SERVER_NAME>` (V2 per-server) to the environment, which the SDK reads automatically from the manifest path
27
33
28
34
- Added `send_chat_history` method to `McpToolServerConfigurationService` for sending chat conversation history to the MCP platform for real-time threat protection analysis
29
35
- Added `ChatHistoryMessage` Pydantic model for representing individual messages in chat history
Copy file name to clipboardExpand all lines: libraries/microsoft-agents-a365-tooling/microsoft_agents_a365/tooling/services/mcp_tool_server_configuration_service.py
0 commit comments