list_topics, search, read_section return empty due to directory name mismatch; recommend fails on \r in llms.txt
Two bugs in mcp/src/index.ts:
Bug 1: Chapter regex doesn't match actual directory names
// Current (line 11)
const CHAPTER_RE = /^chapter (\d{2}): (.+)$/;Directories in the repo use - not :, e.g. chapter 01 - vectors, not chapter 01: vectors. This causes getChapters() to return an empty array, making list_topics, read_section, and search all return no results.
Fix:
const CHAPTER_RE = /^chapter (\d{2}) [-:] (.+)$/;Bug 2: recommend fails because llms.txt has \r\n line endings
parseLlmsTxt() splits on \n but doesn't strip \r, so chapter names contain trailing \r characters. This breaks the section regex matching for lines under each chapter header, resulting in an empty metadata list and "No relevant sections found" for any query.
Fix (line 59):
// Before
const content = await readFile(join(ROOT, "llms.txt"), "utf-8");// After
const content = (await readFile(join(ROOT, "llms.txt"), "utf-8")).replace(/\r/g, "");Both fixes are single-line changes. Happy to open a PR if helpful.
Environment: Windows 11, Node v24, mcp/src/index.ts on main.
Source: HenryNdubuaku/maths-cs-ai-compendium