Document the HTTP shared-secret and trusted-hosts options of mcp_server(type = "http"), or add arguments for them

Aperta Adatta ai principianti
#139 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
73/100
Tipo di issue
Documentazione
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
r
Ambito
documentation

Direzione di ricerca

Leggi la pagina di aiuto di mcp_server, la vignetta del server, il README e NEWS; l’issue dice che attualmente nessuna di queste fonti documenta queste opzioni. Controlla i test esistenti in test-server.R per mcptools.http_shared_secret per confermare il comportamento e il nome dell’header. Documenta le opzioni supportate, incluso il confronto esatto di Host con la porta, e chiarisci quali impostazioni sono supportate.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Hi, and thanks for mcptools.

putior is on CRAN; its development version (to be released as 0.2.0) adds putior_mcp_server(), which can serve putior's tools over HTTP with mcptools::mcp_server(type = "http"). putior sets one of two options before calling it:

  • With a token (putior requires one when the server listens on a non-loopback address), putior sets mcptools.http_shared_secret; handle_http_request() then requires the header Plumber-Shared-Secret.
  • Without a token (loopback only): putior adds the loopback names to mcptools.http_trusted_hosts, which handle_http_request() compares with the Host header as written, in addition to your Origin check.

Both options came with the Posit Connect engine (#106). The code that reads them is unchanged from 1.0.0 to 1.0.3 and on main (714803b), and test-server.R covers mcptools.http_shared_secret as an override of plumber2.sharedSecret. But none of ?mcp_server, the server vignette, the README or NEWS mentions them; ?mcp_server documents MCPTOOLS_PORT and MCPTOOLS_SOCKET_DIR, but not these.

If a later release read other settings, a putior server started with a token would answer requests that lack it, without an error. putior therefore sends mcptools' internal handle_http_request() test requests at start-up, and does not start unless the requests without the right secret or from an untrusted Host get 401/403 and a valid one does not. We would rather depend on a documented interface.

Would you consider one of these?

  1. Documenting mcptools.http_shared_secret and mcptools.http_trusted_hosts in ?mcp_server, with the header name and the exact Host match (port included). MCPTOOLS_HTTP_TRUSTED_HOSTS, mcptools.http_allowed_origins and MCPTOOLS_HTTP_ALLOWED_ORIGINS could go there too, if you want them supported.
  2. Or arguments such as mcp_server(..., shared_secret = NULL, trusted_hosts = NULL).
  3. If these options are likely to change, a NEWS entry when they do would already help.

Happy to send a PR for the documentation.

Lingua principale
R
Stelle
207
Fork
24
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

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di posit-dev/mcptools

Tutte le issue di posit-dev/mcptools

Issue simili

Altre issue su R

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.