Skip to content

Commit 29edf15

Browse files
docs(azure-apim): post-deploy updates (Settings tab, smoke test, etc.) (#2699)
* docs(azure-apim): reflect Settings tab + cascade-delete + audience-uniqueness Three updates after merging the per-user identity feature to production: 1. Dashboard navigation: Entra cards moved from the Overview tab to a conditional Settings tab (only visible for enterprise teamspaces or active trials). Update Part 4 and the troubleshooting section. 2. Cascade-delete: clicking Remove on the Microsoft Entra ID card now removes both the tenant configuration AND all provisioned users in a single step. Add a note so admins know not to use Remove for single-user revocation. 3. Audience uniqueness: each MCP API app (audience GUID) can be claimed by one teamspace at a time. Document the failure mode and how to resolve it, since hitting it from a fresh setup is easy. * docs(azure-apim): add Part 6 — smoke test the gateway from CLI Walks through pre-authorizing Azure CLI on the Gateway app's scope and running an `az account get-access-token` + curl against APIM end-to-end. Lets admins validate the full OBO flow before pointing real MCP clients at the gateway. Renumber the original "Connect an MCP client" to Part 7.
1 parent 801e112 commit 29edf15

1 file changed

Lines changed: 52 additions & 6 deletions

File tree

docs/enterprise/azure-apim.mdx

Lines changed: 52 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -337,10 +337,10 @@ An owner or admin of the teamspace configures both from the dashboard.
337337
### Step 1: Configure the tenant
338338

339339
1. Sign in to [context7.com/dashboard](https://context7.com/dashboard) and select the teamspace that will own the integration.
340-
2. **Overview** tab → **Microsoft Entra ID** card → **Configure**.
340+
2. **Settings** tab → **Microsoft Entra ID** card → **Configure**.
341341

342342
<Note>
343-
The card is visible only for enterprise teamspaces and active enterprise trials.
343+
The Settings tab itself is visible only for enterprise teamspaces and active enterprise trials. If you don't see it, confirm the selected teamspace is on an enterprise plan.
344344
</Note>
345345

346346
3. Fill in:
@@ -354,7 +354,7 @@ An owner or admin of the teamspace configures both from the dashboard.
354354

355355
### Step 2: Pre-provision your developers
356356

357-
After saving the tenant configuration, scroll down to the **Microsoft Entra ID users** card on the same Overview tab. This is where you list every Entra user who should be able to authenticate to the teamspace through APIM.
357+
After saving the tenant configuration, scroll down to the **Microsoft Entra ID users** card on the same Settings tab. This is where you list every Entra user who should be able to authenticate to the teamspace through APIM.
358358

359359
1. Click **Add user**.
360360
2. Enter the user's:
@@ -364,6 +364,14 @@ After saving the tenant configuration, scroll down to the **Microsoft Entra ID u
364364

365365
Context7 creates a Clerk user record for the developer, adds them as a `developer` member of the teamspace, and inserts a `(tenant, oid, teamspace)` mapping. The same email can be added to multiple teamspaces — the Clerk user is reused and a separate mapping row is created per teamspace.
366366

367+
<Note>
368+
Clicking **Remove** on the Microsoft Entra ID card removes both the tenant configuration **and** all provisioned users for the teamspace in a single step. If you only need to revoke a single user, remove them from the Microsoft Entra ID users card instead.
369+
</Note>
370+
371+
<Note>
372+
Each MCP API app (audience) can be configured for **one** teamspace at a time. If you reuse an audience already claimed by a different teamspace you will see "This audience is already configured for another teamspace" — open the other teamspace's Settings tab and remove the Entra configuration there first, or register a new MCP API app for this teamspace.
373+
</Note>
374+
367375
<Note>
368376
For large rollouts (tens or hundreds of developers), CSV bulk-import and Entra SCIM provisioning are on the roadmap. Reach out to [context7@upstash.com](mailto:context7@upstash.com) if your scale needs either ahead of general availability.
369377
</Note>
@@ -518,7 +526,45 @@ Expected:
518526
- `/authorize` returns `302 Found` with a `Location` header pointing at Entra's authorize endpoint.
519527
- An unauthorised POST to `/context7/mcp` returns `401` with `WWW-Authenticate: Bearer resource_metadata="https://<your-apim-host>/.well-known/oauth-protected-resource"`.
520528

521-
## Part 6: Connect an MCP client
529+
## Part 6: Smoke test the gateway from CLI
530+
531+
Before pointing real MCP clients at the gateway, validate the full OBO flow from your terminal. This catches misconfigurations (wrong audience, missing scope, unmapped user) without involving an MCP client.
532+
533+
### Step 1: Authorize the Azure CLI on the Gateway app
534+
535+
Azure CLI's well-known client ID is `04b07795-8ddb-461a-bbee-02f9e1bf7b46`. Pre-authorize it on the Gateway app's scope so `az account get-access-token` can mint tokens:
536+
537+
1. Entra admin center → **App registrations****Context7 APIM Gateway****Expose an API**.
538+
2. Under **Authorized client applications**, click **+ Add a client application**.
539+
3. **Client ID:** `04b07795-8ddb-461a-bbee-02f9e1bf7b46`.
540+
4. Tick the `api://<gateway-app-id>/Mcp.Gateway.Access` scope. **Add**.
541+
542+
<Note>
543+
This pre-authorization is only required for the CLI smoke test described here. End users connecting via VS Code with GitHub Copilot use Microsoft's first-party VS Code client ID, which you already pre-authorized in [Part 2 Step 3](#step-3-wire-the-permission-chain).
544+
</Note>
545+
546+
### Step 2: Acquire a token and call the gateway
547+
548+
```bash
549+
GATEWAY_APP_ID=<gateway-app-client-id>
550+
APIM_HOST=<your-apim-host>
551+
552+
az login --tenant <your-tenant-id> --scope api://$GATEWAY_APP_ID/.default
553+
554+
TOKEN=$(az account get-access-token --resource api://$GATEWAY_APP_ID --query accessToken -o tsv)
555+
556+
curl -i -X POST "https://$APIM_HOST/context7/mcp" \
557+
-H "Authorization: Bearer $TOKEN" \
558+
-H "Content-Type: application/json" \
559+
-H "Accept: application/json, text/event-stream" \
560+
-d '{"jsonrpc":"2.0","method":"initialize","id":1,"params":{"protocolVersion":"2024-11-05","capabilities":{},"clientInfo":{"name":"smoke","version":"0.0.1"}}}'
561+
```
562+
563+
Expected: `200 OK`, an `mcp-session-id` response header, and a Server-Sent Events body with the Context7 server info. That confirms APIM validated your inbound token, performed the OBO exchange, forwarded the new token to `mcp.context7.com`, the MCP server validated it against your tenant configuration, and the request was attributed to your provisioned user.
564+
565+
If you get a non-200 status, decode `$TOKEN` at [jwt.io](https://jwt.io) and confirm `aud` is the Gateway app's client ID, `scp` is `Mcp.Gateway.Access`, and `oid` matches the value you added under **Microsoft Entra ID users**. See [Troubleshooting](#troubleshooting) for specific error codes.
566+
567+
## Part 7: Connect an MCP client
522568

523569
Configure your MCP client to talk to the APIM endpoint. Example for VS Code with GitHub Copilot:
524570

@@ -587,15 +633,15 @@ The `scope` parameter in the OBO request is malformed. Verify that the `mcp-api-
587633

588634
Either the token does not match the teamspace's tenant configuration, or the user is not on the teamspace's pre-provisioned list.
589635

590-
First open **Overview → Microsoft Entra ID** in the dashboard and verify:
636+
First open **Settings → Microsoft Entra ID** in the dashboard and verify:
591637

592638
- **Tenant ID** matches the OBO token's `tid` claim.
593639
- **Audience** matches the OBO token's `aud` claim exactly (case-sensitive, GUID form for v2 tokens).
594640
- **Required scope** matches a value in the token's `scp` claim.
595641

596642
Use **Test connection** to confirm the tenant is reachable.
597643

598-
If the tenant config is correct, the user's `oid` is probably not in the teamspace's provisioned users list. Decode the OBO token at [jwt.io](https://jwt.io) and copy the `oid` claim, then check that exact value appears in **Overview → Microsoft Entra ID users**. If it's missing, add the user (see Part 4 Step 2).
644+
If the tenant config is correct, the user's `oid` is probably not in the teamspace's provisioned users list. Decode the OBO token at [jwt.io](https://jwt.io) and copy the `oid` claim, then check that exact value appears in **Settings → Microsoft Entra ID users**. If it's missing, add the user (see Part 4 Step 2).
599645

600646
### Streaming responses get cut off
601647

0 commit comments

Comments
 (0)