Motivation
Retrieval is most useful when an agent can reach it. AskMyDocs exposes its knowledge base as MCP (Model Context Protocol) tools, so Claude Desktop, Claude Code, Cursor, or any custom agent can search, navigate the graph, and surface promotion candidates — over the same retrieval stack the chat UI uses.The enterprise-kb server
The MCP server (app/Mcp/Servers/KnowledgeBaseServer.php, registered name
enterprise-kb) exposes 25 tools across four categories:
- Read-only retrieval (hybrid search, document/chunk reads, recent changes, project-scoped search).
- Graph navigation (neighbours, subgraph, canonical lookups by slug/type,
the multi-hop
KbWikiNavigateTool— primary agentic surface, see Auto-Wiki). - Write surfaces for auto-wiki operations: evidence tier (
KbSetEvidenceTierTool), graph link rebuild (KbRebuildWikiLinksTool), concept synthesis (KbSynthesizeConceptsTool), index build (KbBuildWikiIndexTool), page review (KbWikiReviewTool), suggestion apply (KbApplySuggestionTool), wiki maintenance (KbWikiMaintainTool), and auto→human-vouched tier promotion (KbWikiPromoteTool). - Write-nothing propose/suggest tools that surface candidate artifacts for
human review — the canonical promotion pipeline (suggest → candidates →
promote via
CanonicalWriter) stays human-gated (see canonical & promotion).
Connecting a client
Expose the server and point your MCP client at it. The host ships anaskmydocs:mcp:connect Artisan helper that prints the bootstrap snippet for a
consumer client. Access is token-gated — mint a personal access token (Sanctum) or an
MCP token in the admin (/app/admin/mcp/tokens) and the per-tool authorizer
enforces the caller’s RBAC on every invocation.
The MCP pack
The transport, multi-turn tool-calling orchestrator, hash-only audit, and RBAC hooks are factored into the standalonepadosoft/askmydocs-mcp-pack package
(framework-agnostic; AskMyDocs pins ^1.5). The host binds three adapters
(McpHostBridge, server registry, tool authorizer) so the pack drives the real
AskMyDocs retrieval + Spatie RBAC + Eloquent audit. The host admin SPA
(/app/admin/mcp-tools) surfaces server CRUD, the tool catalogue, and the audit
log; the optional standalone padosoft/askmydocs-mcp-pack-admin panel (default
/admin/mcp-pack) adds the circuit-breaker dashboard and the OpenAPI explorer.
Gotchas & operations
- The canonical promotion pipeline (suggest → candidates → promote via
CanonicalWriter) is human-gated and no MCP tool triggers it. Auto-wiki write tools (evidence tier, graph rebuild, concept synthesis, etc.) DO write to storage — they are RBAC-authorized and audited. - Every tool invocation is RBAC-authorized + audited (hash-only) — bypassing the authorizer is a defect.
- Adding a new MCP tool: extend
Laravel\Mcp\Server\Tool, register it onKnowledgeBaseServer::$tools, and bump the registration-count test.
Auto-Wiki
The agentic navigation surface MCP exposes.
Sister packages
The padosoft/* ecosystem, including the MCP pack.