Repository navigation
Closed
Description
Context
MCP clients have no way to read ProPR's own documentation. When a user asks "what can ProPR do?" or "how does ultrafix decide to stop?", the agent guesses from tool names. The published documentation site lives in the repository under docs/ (Docusaurus): pages in docs/docs/** (.md and .mdx), navigation in docs/sidebars.ts. Some operator-facing MCP guides also live at docs/mcp.md, docs/mcp-coverage.md, docs/mcp-operator-surface.md.
Requirements
- New read-only tools (scope
read, no repository argument, no GitHub access):list_docs—{ section?: string, offset, limit ≤ 100 }→{ docsVersion, pages: [{ path, title, section, summary, words }], nextOffset }.pathis a stable slug likefeatures/pr-commands(relative todocs/docs, no extension); extra MCP guides appear undermcp/…(mcp/guide,mcp/coverage,mcp/operator-surface).sectionis the first path segment (features,operations,architecture,tutorials,mcp, …).summaryis the first paragraph after the title, max 240 chars.get_doc—{ path, offset = 0, maxChars = 8000 (1000..16000), section?: heading }→{ path, title, docsVersion, outline: [{ level, heading, offset }], content, offset, nextOffset, totalChars }.sectionreturns only the content under the given heading (case-insensitive exact heading match) so a client can jump to a subsection without paging. Chunks break at a paragraph boundary when possible.search_docs—{ query (2..200 chars), limit ≤ 20 }→{ results: [{ path, title, heading, snippet, score }] }: case-insensitive term scoring over titles (×5), headings (×3) and body (×1), results grouped per (page, heading) so the caller can callget_docwithsection. Snippets ≤ 300 chars around the first match.
- Content normalisation: strip front matter, strip MDX comments
{/* ... */}(used for screenshot placeholders), stripimport ... fromlines, keep code fences and tables as-is. Docusaurus admonitions (:::warning[...]) are kept as text. - Safety: only files discovered under the configured docs roots are served.
pathis looked up in the in-memory index; it is never joined onto a filesystem path, so traversal (../) is impossible by construction. Files over 512 KiB are skipped. Symlinks are not followed. - Index: built lazily on first use and cached; rebuilt when the docs root's newest mtime changes (checked at most once per 60 s). Order pages by
docs/sidebars.tsorder when the manifest from the packaging issue is present; otherwise bysidebar_positionfront matter then path. - Docs root resolution:
PROPR_DOCS_DIRenv →<cwd>/docs→/app/docs(the image path added in the packaging issue). If none exists, the tools fail withDOCS_UNAVAILABLE(stageinternal, not retryable, message explains the operator must run an image that bundles docs or setPROPR_DOCS_DIR). docsVersionis the@propr/apipackage version unless a docs manifest supplies{ version, sourceRevision }(next issue).- Resource
propr://instances/{instance_id}/docs/{path}serving the first chunk, and prompt text inoperator_briefingmentionssearch_docsfor "how does X work" questions.
Implementation Specification
- New
packages/api/mcp/docsIndex.ts(discovery, parsing, caching, chunking, search — no MCP types). - New
packages/api/mcp/toolsDocs.tsregistering the three tools; wireaddDocsTools(tools, deps)increateToolCatalog. - Register the resource in
packages/api/mcp/server.ts. - Tests
packages/api/test/mcpDocs.test.tsusing a temporary docs directory viaPROPR_DOCS_DIR.
Acceptance Criteria
-
list_docs({ section: 'features' })includesfeatures/pr-commandswith title "PR Comment Commands". -
get_doc({ path: 'features/pr-commands', section: '/ultrafix' })returns only that subsection. - Paging
get_docwithnextOffsetreconstructs the full normalised page exactly, and no chunk exceedsmaxChars. -
search_docs({ query: 'ultrafix goal' })ranksfeatures/pr-commandsfirst. -
get_doc({ path: '../../etc/passwd' })returnsDOC_NOT_FOUND. - MDX comments and front matter never appear in
content.
Created by ProPR AI Planner
Activity
propr-dev commentedon Sep 28, 2026
Suggested Implementation:
Implementation Approach
The docs are plain Markdown already versioned with the code, so we serve them directly from disk via an in-memory index rather than scraping the rendered Docusaurus site (which would need the docs container running and HTML-to-text conversion) or embedding them in a vector store (heavy, and unnecessary for a few hundred pages — term scoring over headings is good enough to route a client to the right
get_docsection).Lookups are by index key, never by joining user input onto a path, which makes traversal impossible by construction. Output is chunked with explicit
nextOffsetso a large page cannot flood a client's context.File:
packages/api/mcp/docsIndex.ts(new file)Why this file: Pure docs indexing/search logic, testable without the MCP server.
File:
packages/api/mcp/toolsDocs.ts(new file)Why this file: MCP-facing wrappers (schemas, errors, bounds) around the pure index.
Register in
packages/api/mcp/tools.ts:File:
packages/api/mcp/server.tsWhy this file: Adds the
docs/{path}resource next to existing resources, reading throughget_docso bounds and errors are identical.// propr://instances/{instance_id}/docs/{+path} -> executeTool('get_doc', { path }) and return content as text/markdownFile:
packages/api/test/mcpDocs.test.ts(new file)Why this file: Exercises discovery, normalisation, chunking, section selection, search ranking and traversal safety against a temp docs tree.
propr-dev commentedon Sep 29, 2026
🤖 AI processing has started for this issue using codex agent with gpt-5.6-sol model.
I'll analyze the problem and work on a solution. This may take a few minutes.
Processing Details:
codexgpt-5.6-sol2601/gpt-5.6-sol-mcp-documentation-tools-l-20260929-1902-7rp2593-epic-mcp-observability-cf6issue-2601-20260929-1902-gpt-5.6-sol-7rp🔍 Track Task Execution
fix(ai): Resolve issue #2601 - MCP documentation tools: list_docs, ge…
fix(ai): Resolve issue #2601 - MCP documentation tools: list_docs, ge…