Install
$ agentstack add mcp-patst-entraid-mcp-server ✓ scanned · ✓ verified — works with Claude Code, Cursor, and more.
Security review
✓ PassedNo issues found. Passed automated security review. · v0.1.0 How review works →
- ✓ Prompt-injection patterns
- ✓ Secret / credential exfiltration
- ✓ Dangerous shell & filesystem operations
- ✓ Untrusted network calls
- ✓ Known-malicious package signatures
What it can access
- ✓ Network access No
- ✓ Filesystem access No
- ✓ Shell / process execution No
- ● Environment & secrets Used
- ✓ Dynamic code execution No
From automated source analysis of v0.1.0. “Used” means the capability is present in the source — more access means more to trust, not that it’s unsafe.
About
EntraID secured MCP-Server demo
This demo shows how to secure an MCP-Server using EntraID (Azure AD). It uses the ModelContextProtocol SDK to create a Streamable HTTP server that implements the MCP-Server API.
The server can be accessed in an unauthenticated mode by adding the header x-use-anonymous: true to the request. This will provide only the tools that do not require authentication.
Could be an example to provide read-only access to some tools, while other tools require authentication.
For more details see the medium article at https://medium.com/@pat-st/securing-a-model-context-protocol-server-with-entraid-47a0fea72a76
Prerequisites
- Node.js v18 or later
EntraID Setup
Create an EntraID App Registration:
az ad app create --display-name "MCP-Server Demo" --requested-access-token-version "2" --sign-in-audience "AzureADMyOrg"
Create a .env file in the root of the project with the following content:
AZURE_TENANT_ID=
AZURE_CLIENT_ID=
BASE_URL=http://localhost:3001
Use your tenantId and the clientId of the app registration you just created.
- Under
Expose an API, expose a scope nameduser_impersonationfor the app registration - Under
Expose an API, add the ClientIds as preauthorized client applications:
aebc6443-996d-45c2-90f0-388ff96faa56- default Client ID for VSCode04b07795-8ddb-461a-bbee-02f9e1bf7b46- Default Client ID for Azure CLI, allows fetching of token for test purposes
Run the server
Just execute npm run dev to start the server. It will be available at http://localhost:3001/mcp.
The .vscode/mcp.json file already contains the required configuration to connect to the server using VSCode.
If everything is set up correctly, you should be able to connect to the server using VSCode and will be prompted to authenticate using EntraID.
Then two tools will appear.
If you are starting the server in unauthenticated mode with this mcp.json file, you will only see one tool being presented:
{
"servers": {
"local-mcp-server": {
"url": "http://localhost:3001/mcp",
"type": "http",
"headers": {
"x-use-anonymous": "true"
}
}
},
"inputs": []
}
Source & license
This open-source MCP server is cataloged on AgentStack and links to its original source — we do not rehost the code.
- Author: patst
- Source: patst/entraid-mcp-server
- License: Apache-2.0
Install and usage instructions live in the source repository linked above.
Reviews
No reviews yet — be the first.
Write a review
Versions
- v0.1.0 Imported from the upstream source.