codeant-ai-for-open-source[bot] commented on code in PR #43637:
URL: https://github.com/apache/superset/pull/43637#discussion_r3877837715


##########
docs/admin_docs/configuration/mcp-server.mdx:
##########
@@ -253,6 +253,49 @@ def my_custom_auth_factory(app):
 MCP_AUTH_FACTORY = my_custom_auth_factory
 ```
 
+### Embedded Guest Authentication
+
+Superset's [embedded dashboards](/user-docs/using-superset/embedding) feature 
mints short-lived **guest tokens** for anonymous/embedded viewers. The MCP 
server can accept these same guest tokens, so an embedded guest (e.g. an in-app 
chatbot next to an embedded dashboard) can call MCP tools scoped to the 
dashboards/resources named in its token.
+
+This is opt-in and reuses the existing core guest-token configuration -- there 
is no MCP-specific guest secret or audience.
+
+```python
+# superset_config.py
+FEATURE_FLAGS = {"EMBEDDED_SUPERSET": True}   # required -- guest tokens only 
exist when this is on
+MCP_EMBEDDED_GUEST_AUTH_ENABLED = True        # opt-in for the MCP transport 
(default False)
+```
+
+Present the guest token the same way as any other bearer token:
+
+```bash
+curl -X POST http://localhost:5008/mcp \
+  -H 'Content-Type: application/json' \
+  -H 'Authorization: Bearer YOUR_GUEST_TOKEN' \
+  -d '{"jsonrpc": "2.0", "method": "tools/list", "id": 1}'
+```
+
+**How it works**
+
+- A dedicated guest-token verifier validates the token against the same 
`GUEST_TOKEN_JWT_SECRET` / `GUEST_TOKEN_JWT_ALGO` / `GUEST_TOKEN_JWT_AUDIENCE` 
config used by embedded dashboards, replays the embedded structural checks, and 
enforces revocation (global version bumps and per-dashboard 
`guest_token_revoked_before` cutoffs). It runs *before* the JWT verifier 
described above, since guest tokens are signed with a different key/algorithm 
and would otherwise be rejected at the transport.
+- A verified guest resolves to a Superset guest user as the highest-priority 
identity, so it's never downgraded to API-key / `MCP_DEV_USERNAME` / dev-mode 
resolution. Data access is scoped by the same checks (dataset allowlist, 
dashboard access, row-level security) that apply to embedded dashboard views.
+- Sensitive enumeration tools (`find_users`, `get_instance_info` by default) 
are hidden and denied to guests via `MCP_GUEST_DENIED_TOOLS`, regardless of 
`MCP_RBAC_ENABLED`.
+
+```python
+# superset_config.py
+MCP_GUEST_DENIED_TOOLS = {"find_users", "get_instance_info"}  # default

Review Comment:
   **Suggestion:** The documented `MCP_GUEST_DENIED_TOOLS` setting is not read 
by the MCP implementation. Guest authorization uses the default-deny 
`MCP_GUEST_ALLOWED_TOOLS` allow-list instead, so an operator setting this 
variable will receive no configuration error and will not change which tools 
guests can call. Document `MCP_GUEST_ALLOWED_TOOLS` and its allow-list 
semantics instead. [api mismatch]
   
   <details>
   <summary><b>Severity Level:</b> Major ⚠️</summary>
   
   ```mdx
   - ⚠️ Guest tool authorization customization is silently ignored.
   - ⚠️ Operators cannot apply the documented deny-list policy.
   - ⚠️ Guest restrictions remain controlled by the undocumented allow-list.
   ```
   </details>
   
   [![Use CodeAnt 
Skill](https://new-codeant-butcket.s3.us-west-1.amazonaws.com/badges/use-codeant-skill-flat-v2.svg)](https://docs.codeant.ai/cli/resolve-pr-comments-skill)
 [![Fix in 
Cursor](https://new-codeant-butcket.s3.us-west-1.amazonaws.com/badges/fix-in-cursor-flat.svg)](https://app.codeant.ai/fix-in-ide?tool=cursor&prompt_id=bc708229f7494b989745f9823730b113&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset)
 [![Fix in VSCode 
Claude](https://new-codeant-butcket.s3.us-west-1.amazonaws.com/badges/fix-in-vscode-claude-flat.svg)](https://app.codeant.ai/fix-in-ide?tool=vscode-claude&prompt_id=bc708229f7494b989745f9823730b113&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset)
   <details>
   <summary><b>Prompt for AI Agent 🤖 </b></summary>
   
   ```mdx
   This is a comment left during a code review.
   
   **Path:** docs/admin_docs/configuration/mcp-server.mdx
   **Line:** 285:285
   **Comment:**
        *Api Mismatch: The documented `MCP_GUEST_DENIED_TOOLS` setting is not 
read by the MCP implementation. Guest authorization uses the default-deny 
`MCP_GUEST_ALLOWED_TOOLS` allow-list instead, so an operator setting this 
variable will receive no configuration error and will not change which tools 
guests can call. Document `MCP_GUEST_ALLOWED_TOOLS` and its allow-list 
semantics instead.
   
   Validate the correctness of the flagged issue. If correct, How can I resolve 
this? If you propose a fix, implement it and please make it concise.
   Once fix is implemented, also check other comments on the same PR, and ask 
user if the user wants to fix the rest of the comments as well. if said yes, 
then fetch all the comments validate the correctness and implement a minimal fix
   ```
   </details>
   <a 
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F43637&comment_hash=c5c46cf236c6d30a180f753360b85af213157d77ff2c60f3c81bca3761c5f0ad&reaction=like'>👍</a>
 | <a 
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F43637&comment_hash=c5c46cf236c6d30a180f753360b85af213157d77ff2c60f3c81bca3761c5f0ad&reaction=dislike'>👎</a>



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to