fix(agentcore-mcp): don't crash startup when llms.txt docs index is unreachable#4279
Open
sergioperezcheco wants to merge 1 commit into
Open
fix(agentcore-mcp): don't crash startup when llms.txt docs index is unreachable#4279sergioperezcheco wants to merge 1 commit into
sergioperezcheco wants to merge 1 commit into
Conversation
sergioperezcheco
requested review from
a team,
Bhavik-T,
jesseturner21,
kevin-orellana,
scottschreckengaust,
sundargthb,
theagenticguy and
theumbrella1
as code owners
July 18, 2026 05:50
sergioperezcheco
force-pushed
the
fix/agentcore-ensure-ready-404
branch
6 times, most recently
from
July 22, 2026 10:20
9c0a24b to
0f05c62
Compare
…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
force-pushed
the
fix/agentcore-ensure-ready-404
branch
from
July 23, 2026 00:51
0f05c62 to
943ae22
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.