Skip to content

fix(agentcore-mcp): don't crash startup when llms.txt docs index is unreachable#4279

Open
sergioperezcheco wants to merge 1 commit into
awslabs:mainfrom
sergioperezcheco:fix/agentcore-ensure-ready-404
Open

fix(agentcore-mcp): don't crash startup when llms.txt docs index is unreachable#4279
sergioperezcheco wants to merge 1 commit into
awslabs:mainfrom
sergioperezcheco:fix/agentcore-ensure-ready-404

Conversation

@sergioperezcheco

@sergioperezcheco sergioperezcheco commented Jul 18, 2026

Copy link
Copy Markdown

The amazon-bedrock-agentcore-mcp-server crashes on startup and never completes MCP initialization because main() calls cache.ensure_ready(), which fetches the hardcoded docs index at https://aws.github.io/bedrock-agentcore-starter-toolkit/llms.txt. That URL now returns HTTP 404 (the upstream docs site is deprecated and the llmstxt plugin was removed), and the fetch has no error handling, so the urllib HTTPError escapes main() and the process exits. Every tool group registers fine; only the docs index fetch kills it.

This wraps the per-source llms.txt fetch in load_links_only() in a try/except that logs a warning and continues, and still marks the index loaded so ensure_ready() does not retry on every call. The documentation search tools degrade to returning empty results while the runtime, memory, identity, gateway, policy, browser, and code interpreter tools keep working.

I also fixed test_docs_tool_invocation, whose len(result.content) > 0 assertion only passed because the 404 turned the call into an error response with text content; it now checks the tool stays callable and returns a well-formed (possibly empty) result set. Added a unit test for the graceful-skip path. Full server test suite (813 tests) passes and ruff is clean.

Fixes #4138

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of the project license.

…nreachable

cache.load_links_only() called doc_fetcher.parse_llms_txt(src) with no
error handling, so a transient or permanent failure to fetch a configured
llms.txt (e.g. HTTP 404 now that the bedrock-agentcore-starter-toolkit
docs site is deprecated and llms.txt is gone) raised out of main()'s
cache.ensure_ready() and killed the server before MCP initialization.
Every other tool group had already registered successfully.

Wrap the per-source fetch in try/except: log a warning and continue, and
still mark _LINKS_LOADED so ensure_ready() does not retry on every call.
The documentation search tools degrade to returning empty results while
the rest of the server keeps working.

Also fixes test_docs_tool_invocation, whose `len(result.content) > 0`
assertion only held because the 404 turned the call into an error
response with text content; it now checks the tool stays callable and
returns a well-formed (possibly empty) result set.

Fixes awslabs#4138
@sergioperezcheco
sergioperezcheco force-pushed the fix/agentcore-ensure-ready-404 branch from 0f05c62 to 943ae22 Compare July 23, 2026 00:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: To triage

Development

Successfully merging this pull request may close these issues.

amazon-bedrock-agentcore-mcp-server : ensure_ready() crashes with HTTP Error 404 fetching llms.txt (docs source deprecated)

1 participant