Repository navigation
feat(mcp): add the MCP server as a standalone Python service - #165
Closed
oto-macenauer-absa wants to merge 1 commit into
Closed
oto-macenauer-absa wants to merge 1 commit into
oto-macenauer-absa wants to merge 1 commit into
Conversation
This was referenced Nov 13, 2026
mcp-server/ is a self-contained uv project on the official MCP Python SDK (v2, pinned). It shares no code with the site: it reads the page manifest and the HTML under dist/ (docs/adr/0001-mcp-server.md). - `kb-mcp index` extracts every page (selectolax, an HTML5 parser) into a SQLite FTS5 index: Porter stemming, bm25 with the title weighted highest, compound-word and misspelling expansion over an unstemmed vocabulary; - `kb-mcp serve` serves it over stateless Streamable HTTP with JSON responses: search_documents, list_documents, read_document and every page as a kb:// resource, with structured output and read-only annotations; - ports and adapters as before (DocumentRepository, SearchBackend, the KnowledgeBase facade), with the layering enforced by import-linter; - quality gates: ruff, mypy --strict, pytest (unit, backend contract, in-process protocol and HTTP tests, 90% branch coverage), a CI job that also indexes the real fixture build, and Dependabot for uv. Part of #117 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
oto-macenauer-absa
added a commit
that referenced
this pull request
Nov 17, 2026
…fest (#164) ## What First of three PRs that rebuild the MCP server (#117) as a standalone Python service. The ADR comes in the next PR (`docs/adr/0001-mcp-server.md`). The TypeScript implementation (#119, #129) is closed as superseded. The Python indexer must not import the build's JavaScript. So the build no longer indexes pages; it writes a manifest of what it published. That manifest, plus the HTML under `dist/`, is the only interface between the Node build and the Python server. Stack: **#164 (this PR, page manifest)** ← #165 (Python MCP server) ← #166 (deployment). ## Changes - **New build step 3b** (`scripts/page-manifest.js`): writes `dist/_kb/pages.json`. - Its shape is `scripts/page-manifest.schema.json` (draft-07, no extra properties). - It has one entry per published route: route, dist file, manifest title, section, and the page's app. - Each app carries its name, description, tags, kind (artifact or iframe), url and source version. - `404.html` is excluded, and routes are deduplicated (`index.html` wins). - **Removed**, from the merged #128: - the TypeScript index builder (`mcp/`, `scripts/build-mcp.js`); - its in-memory adapters, tests and fixtures; - the ESLint/Prettier/tsc lint tooling that only covered that code, including the CI `lint` job and those devDependencies. - **`.dockerignore`** keeps `dist/_kb` out of the nginx image. - **Tests:** new cases in `tests/build-integrity.spec.js` check that: - the manifest validates against its schema; - it lists the expected apps, with iframe kind and url; - routes are unique and sorted, and every listed file exists; - sectioned pages carry their titles. - **CLAUDE.md:** documents the new pipeline step and file. ## Release Notes - The site build writes `dist/_kb/pages.json`, a manifest of every published page and its app. The Python MCP server's indexer reads it. - Removed the TypeScript MCP search index and the lint tooling that only covered it. ## Verification - `npm test`: all passed - `npm audit --omit=dev --audit-level=high`: clean Part of #117 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
oto-macenauer-absa
force-pushed
the
feature/117-mcp-python-server
branch
from
November 17, 2026 14:19
54ad859 to
d4a18a5
Compare
Collaborator
Author
|
Joined into #166, which now targets master and carries both commit sets for a single review. |
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.
What
Second of three PRs for #117. This one adds the MCP server as a self-contained Python project in
mcp-server/, built on the official MCP Python SDK (v2, pinned exactly). It shares no code with the site. It readsdist/_kb/pages.json(from the previous PR) and the HTML underdist/. It is not deployed yet; the next PR does that.Please review the ADR first:
docs/adr/0001-mcp-server.md. It covers:Stack: #164 (page manifest) ← #165 (this PR, Python MCP server) ← #166 (deployment).
Changes
kb-mcp index(build time only,indexerextra):difflib).kb-mcp serve: stateless Streamable HTTP with JSON responses.search_documents,list_documentsandread_document, all read-only, with structured output and cursor pagination.kb://resource.domain,ports, aservicefacade,adapters(SQLite, query, cursor),protocolandhttp.TransportSecuritySettings) and caps the body at 64 KiB./healthzreports the index's content hash.KB_MCP_*; it is the only code that reads the environment.--strict, import-linter;mcpjob runs all of the above, then indexes the real fixture build.uvecosystem for/mcp-server.docs/mcp-development.md, plus AGENTS.md and CLAUDE.md.Release Notes
mcp-server/) that lets AI agents search and read the knowledge base:search_documents,list_documents,read_document, and every page as akb://resource.Verification
uv run ruff format --check . && uv run ruff check . && uv run mypy && uv run lint-imports: cleanuv run pytest: 78 passed, 95% branch coverageuv run kb-mcp index --dist ../dist: indexes the real fixture buildPart of #117
🤖 Generated with Claude Code