MCP tools return "Internal MCP tool error." when OpenCRE is unreachable or times out
Los mantenedores suelen responder en 1 día
Evaluación
- Dificultad
- 2/5
- Tiempo estimado
- 1-3 horas
- Aptitud para principiantes
- 78/100
- Tipo de issue
- Error
- Claridad
- Bien especificado
- Estado de actividad
- Activo
- Stack tecnológico
- python
- Área
- backend-api-design
Línea de trabajo
Empieza por RestClient._send() y call_spec() en application/mcp/rest_client.py y luego revisa el tratamiento de RestClientError en application/mcp/server.py. Reproduce el error de conexión y el timeout con los comandos del issue, y comprueba cómo se depuran los textos de error de REST. El trabajo estará terminado cuando ambas excepciones de las solicitudes lleguen al cliente como errores útiles, mientras que los errores inesperados sigan devolviendo «Internal MCP tool error.»
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
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.
- Lenguaje dominante
- Python
- Estrellas
- 210
- Forks
- 167
- Merge medio
- 4 d 12 h
- PR fusionados (30 d)
- 28
Preparar el entorno
Inicia el contenedor de desarrollo del proyecto en tu navegador, con tu propia cuenta de GitHub.
- Incluye un Dockerfile o un archivo de Docker Compose
- Sin plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de OWASP/OpenCRE
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
OWASP/OpenCRE#1215 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
Map Analysis continues polling after a background job failsPosiblemente ocupada @amantebriwal4321 la tomó hace 4 días. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 84/100
OWASP/OpenCRE#1211 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
OSCAL Compass adopterAbierto
Dificultad 1/5 Menos de una hora Aptitud para principiantes 66/100
Los mantenedores suelen responder en 1 día
-
find_node_by_name endpoint does not enforce MAX_ITEMS_PER_PAGE, allowing unbounded pagination queries`Posiblemente ocupada @Jeffy123-zhu la tomó hace 26 días. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 88/100
OWASP/OpenCRE#1149 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
Information disclosure via filesystem existence oracle in web_main.py catch-all routePosiblemente ocupada @0x5t4l1n la tomó hace 39 días. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
OWASP/OpenCRE#1112 · 2 comentarios ·
Los mantenedores suelen responder en 1 día
Todos los issues de OWASP/OpenCRE
Issues similares
-
Unknown stop ID in slow zone data crashes post formatting and skips the rest of that day's postsAbiertobackend bug tm-new-volunteer
Dificultad 2/5 1-3 horas Aptitud para principiantes 84/100
transitmatters/mbta-slow-zone-bot#81 · 1 comentario ·
-
area:schema documentation
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
Los mantenedores suelen responder en 1 día
-
risk:high type:ci
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 64/100
spacetelescope/rdmt-spire#49 ·
Los mantenedores suelen responder en 1 día