Expose HTTP request headers (e.g. Posit Connect user session token) to tools
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 48/100
Direzione di ricerca
Start by reading the mcptools server request handling and tool invocation code to see where incoming HTTP headers can be passed into a tool call. The issue suggests either an injected reserved argument or a request-scoped accessor, with concurrent calls and clear behavior outside a request as key constraints. Done means tools can read the triggering request headers safely, including the Posit Connect session token.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
When an mcptools server is deployed to Posit Connect, tools have no way to read the incoming HTTP request. In particular, they can't read the HTTP_POSIT_CONNECT_USER_SESSION_TOKEN within the request header. Connect uses the token for viewer-based credentials, so without it a tool can't make downstream requests, such as database queries, as the calling user. It can only use the credentials of the deployed process.
Feature request:
Could mcptools provide a supported way for a tool to read the headers of the request that triggered it? This would make viewer-based credentials usable in tools deployed to Connect.
Implementation thoughts:
- A reserved argument (e.g. .request) that mcptools injects and omits from the JSON schema seems the safest option. The value is passed directly into one call, so it can't leak between calls and doesn't depend on which mcptools version is loaded.
- An accessor such as mcptools::mcp_request_headers(), valid only during tool execution, would also work. It would need to be stable across versions and fail clearly when called outside a request.
- I would avoid a global option or env var. Both are process-wide, so concurrent or async tool calls could see each other's tokens. Env vars are also inherited by child processes.
I'm happy to help test and might also be able to contribute a PR.
- Lingua principale
- R
- Stelle
- 204
- Fork
- 23
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Preparare l'ambiente
Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di posit-dev/mcptools
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
-
Difficoltà 5/5 Più di una settimana Idoneità per principianti 35/100
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 48/100
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 55/100
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 35/100
Tutte le issue di posit-dev/mcptools
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 71/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
OHDSI/PatientLevelPrediction#688 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
rfordatascience/tidytuesday#1098 ·