MODULE 10 · LESSON 10.6
Authenticate Microsoft-facing MCP tools
Authenticate HTTP MCP with the same connection ownership model.
Lesson 58 of 86 · FabrCore 2.0
Overview
MCP tools can use a configured Connection and Resource instead of embedding credentials in server configuration. The resource determines token audience/scopes. Tool availability still depends on the external server and the selected principal's authorization.
The remote tool and token audience must match
An HTTP MCP tool source can name a Connection and Resource for trusted token resolution. The resource determines the intended downstream audience/scopes. A token that works for Graph is not automatically valid for a different MCP service. Keep the MCP server URL and the resource definition aligned with that server's contract.
Discovery can succeed while execution fails
Some servers expose metadata more broadly than their data operations. Therefore, a visible tool list is not proof the user can run every tool. The Host must resolve credentials for the intended principal, and the remote service still enforces its own policy. Preserve a meaningful unavailable/consent error instead of substituting a different user's token.
The work alias and mcp resource must already be bound to an authorized connection profile. Use the remote service’s actual URL/audience. After replacing or reauthorizing the connection, explicitly reconfigure the agent to establish a new MCP session.
Bind MCP to a connection resource
- Create and authorize the connection profile with the MCP server's documented audience/resource scopes.
- Set McpServerConfig.Connection and Resource, resolve the advertised tools and select only the needed functions.
- Test token renewal and a denied request. Keep external server endpoint/auth details versioned and verify its supported OAuth contract.
{
"McpServers": [
{
"Name": "microsoft-tools",
"TransportType": "Http",
"Url": "https://tools.example.com/mcp",
"Connection": "work",
"Resource": "mcp"
}
]
}
var tools = await ResolveConfiguredToolsAsync();
// Use these tools when creating the AI agent.
// Verify that the intended MCP tools are actually present.
Test the configured audience
- Configure the MCP entry with its supported Connection and Resource fields and initialize a disposable agent. Inspect the discovered tool list.
- Call a read-only tool with the intended test user. Verify the server accepts the token audience and returns only that user's authorized data.
- Select an unavailable resource or remove consent in a test. Expect token resolution/invocation to fail clearly while ordinary unrelated tools remain distinguishable.
This establishes authenticated invocation, not merely tool discovery. The model should never need a credential argument to repair a connection configuration problem.
If the result is different
A generic Microsoft token is not valid for every Microsoft-facing MCP server. Check audience and server requirements before broadening permissions.
Go deeper
Explore the related documentation.