MCP tools return "Internal MCP tool error." when OpenCRE is unreachable or times out
I maintainer di solito rispondono entro 1 giorno
Valutazione
- Difficoltà
- 2/5
- Tempo stimato
- 1-3 ore
- Idoneità per principianti
- 78/100
- Tipo di issue
- Bug
- Chiarezza
- Specificata chiaramente
- Stato di attività
- Attiva
- Stack tecnologico
- python
- Ambito
- backend-api-design
Direzione di ricerca
Inizia da RestClient._send() e call_spec() in application/mcp/rest_client.py, poi esamina la gestione di RestClientError in application/mcp/server.py. Riproduci l’errore di connessione e il timeout usando i comandi dell’issue, quindi controlla come vengono ripuliti i testi degli errori REST. Il lavoro è completato quando entrambe le eccezioni delle richieste arrivano al client come errori utili, mentre i bug imprevisti continuano a restituire «Internal MCP tool error.»
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Issue
What is the issue?
I hit this while trying the MCP server against opencre.org. When the server can't connect to OpenCRE, or a REST call takes longer than the 30 s timeout, the tool result is just Internal MCP tool error.. The actual error is only in the server's stderr, which MCP clients usually don't show. So from the client side you can't tell a server that isn't running, a wrong OPENCRE_BASE_URL or a slow endpoint apart from a real bug in the MCP server.
It looks like RestClient._send() in application/mcp/rest_client.py doesn't catch requests exceptions, so a ConnectionError or ReadTimeout skips the RestClientError handlers in on_call_tool (application/mcp/server.py) and ends up in the last except Exception, which is meant for unexpected errors.
Expected Behaviour
A tool error that says what went wrong, something like:
Could not reach OpenCRE at http://127.0.0.1:5999 (ConnectionError)OpenCRE at https://opencre.org timed out after 30s
and Internal MCP tool error. only for actual bugs.
Actual Behaviour
is_error: true with Internal MCP tool error. in both cases. The real exceptions are in the server log:
requests.exceptions.ConnectionError: HTTPConnectionPool(host='127.0.0.1', port=5999): Max retries exceeded with url: /rest/v1/standards (Caused by NewConnectionError(... Failed to establish a new connection: [Errno 61] Connection refused"))
requests.exceptions.ReadTimeout: HTTPSConnectionPool(host='opencre.org', port=443): Read timed out. (read timeout=30.0)
Steps to reproduce
- With nothing running on port 5999, start the server:
OPENCRE_BASE_URL=http://127.0.0.1:5999 python -m application.mcp - Call
list_standardswith{}. You getInternal MCP tool error.right away. - For the timeout, start it with
OPENCRE_BASE_URL=https://opencre.organd callget_documents_by_tagwith{"tag": ["family:standard"]}. Same message after about 30 s. (That query is slow on opencre.org right now because of #1087, so it's an easy way to trigger the timeout.)
Tested on main (06f2c56) with Python 3.11. I called the tools from a small script using the MCP SDK's stdio_client.
Possible fix: catch requests.Timeout / requests.RequestException around the _send() call in call_spec() and raise a RestClientError with a message like the ones above, passed through _scrub() like the REST error text. server.py already returns RestClientError messages to the client and logs the traceback, so nothing needs to change there. I have this working locally with tests and can open a PR if that sounds good.
- Lingua principale
- Python
- Stelle
- 210
- Fork
- 167
- Merge medio
- 4g 12h
- PR unite (30g)
- 28
Preparare l'ambiente
Avvia il container di sviluppo del progetto nel browser, con il tuo account GitHub.
- Include un Dockerfile o un file Docker Compose
- Nessun modello di pull request
- Leggi la guida per i contributori
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 OWASP/OpenCRE
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
OWASP/OpenCRE#1215 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
Map Analysis continues polling after a background job failsForse già presa @amantebriwal4321 l’ha presa 4 giorni fa. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 84/100
OWASP/OpenCRE#1211 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
OSCAL Compass adopterAperta
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 66/100
I maintainer di solito rispondono entro 1 giorno
-
find_node_by_name endpoint does not enforce MAX_ITEMS_PER_PAGE, allowing unbounded pagination queries`Forse già presa @Jeffy123-zhu l’ha presa 26 giorni fa. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
OWASP/OpenCRE#1149 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
Information disclosure via filesystem existence oracle in web_main.py catch-all routeForse già presa @0x5t4l1n l’ha presa 39 giorni fa. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
OWASP/OpenCRE#1112 · 2 commenti ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di OWASP/OpenCRE
Issue simili
-
Unknown stop ID in slow zone data crashes post formatting and skips the rest of that day's postsApertabackend bug tm-new-volunteer
Difficoltà 2/5 1-3 ore Idoneità per principianti 84/100
transitmatters/mbta-slow-zone-bot#81 · 1 commento ·
-
area:schema documentation
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
I maintainer di solito rispondono entro 1 giorno
-
risk:high type:ci
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 64/100
spacetelescope/rdmt-spire#49 ·
I maintainer di solito rispondono entro 1 giorno