Skip to content

fix(server): honor exclude on the mcp kb_export tool - #618

Merged
plind-junior merged 2 commits into
vouchdev:testfrom
Yurii214:fix/kb-export-mcp-exclude
Jul 30, 2026
Merged

fix(server): honor exclude on the mcp kb_export tool#618
plind-junior merged 2 commits into
vouchdev:testfrom
Yurii214:fix/kb-export-mcp-exclude

Conversation

@Yurii214

@Yurii214 Yurii214 commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

summary

the mcp kb_export tool (server.py) is the only one of the three export surfaces that ignores exclude. the jsonl rpc _h_export and the vouch export --exclude cli both accept it and thread it into bundle.export, returning excluded in the result; the mcp tool takes only out_path, always writes a full bundle, and omits excluded.

exclude is load-bearing — it drives the knowledge-only preset (KNOWLEDGE_EXCLUDE = ("decided", "sessions")). the mcp surface is the primary agent transport (claude code / cursor / codex), so an agent currently cannot produce a filtered bundle over mcp.

this is surface drift from fdf1520 (which added exclude to the cli and jsonl rpc but missed server.py); the later path-fencing rework of kb_export didn't restore it.

fix

add the optional exclude: list[str] | None param and thread it to bundle.export(..., exclude=tuple(exclude or ())), and return excluded — identical to _h_export. unknown/traversal names still raise via _check_exclude, matching the other surfaces.

test

test_kb_export_mcp_honors_exclude calls the mcp tool with exclude=["decided", "sessions"] and asserts result["excluded"] plus an absent sessions/ subdir in the tarball. it fails on the current code (TypeError: unexpected keyword argument 'exclude') and passes with the fix.

validation

make check green: ruff check src tests, mypy src (116 files, no issues), full pytest tests/ --ignore=tests/embeddings. test_capabilities still passes (the method list is unchanged; only the tool signature gains an optional param).

Summary by CodeRabbit

  • New Features

    • Knowledge base exports now support excluding selected content categories.
    • Export results include a list of excluded categories for improved visibility.
  • Bug Fixes

    • Exclusions are consistently honored in generated export archives, while retaining included content such as claims.

the kb.export mcp tool dropped the `exclude` filter that the jsonl rpc and
`vouch export --exclude` cli both accept (added in fdf1520, which missed
server.py), so an mcp agent — the primary vouch client — could never produce
a knowledge-only bundle and got no `excluded` in the response. thread it
through to bundle.export, matching the sibling surfaces.
@Yurii214
Yurii214 requested a review from plind-junior as a code owner July 30, 2026 04:30
@coderabbitai

coderabbitai Bot commented Jul 30, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 94a078b9-2e63-4a35-ac10-8f718adbc174

📥 Commits

Reviewing files that changed from the base of the PR and between 647c34d and 33a6326.

📒 Files selected for processing (2)
  • src/vouch/server.py
  • tests/test_bundle.py

Walkthrough

kb_export now accepts optional exclusions, forwards them to bundle export, returns excluded sections, and has regression coverage for filtered tarball contents.

Changes

MCP export exclusions

Layer / File(s) Summary
Propagate exclusions through MCP export
src/vouch/server.py, tests/test_bundle.py
kb_export forwards exclude to bundle.export, returns the manifest’s excluded list, and tests omission of sessions/ while retaining claims/.

Estimated code review effort: 2 (Simple) | ~10 minutes

Suggested reviewers: plind-junior

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: making the MCP kb_export tool honor exclude.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches 💡 1
🛠️ Fix failing CI checks 💡
  • Fix failing CI checks
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions github-actions Bot added mcp mcp, jsonl, and http surfaces storage kb storage, migrations, schemas, and proposals tests tests and fixtures size: XS less than 50 changed non-doc lines labels Jul 30, 2026
@github-actions
github-actions Bot disabled auto-merge July 30, 2026 13:00

@plind-junior plind-junior left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@plind-junior
plind-junior enabled auto-merge July 30, 2026 13:04
@plind-junior
plind-junior merged commit 43e2edd into vouchdev:test Jul 30, 2026
16 checks passed
@plind-junior

Copy link
Copy Markdown
Member

Eagle eye, nice catch!

@github-actions github-actions Bot added the ci: passing ci is green label Jul 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci: passing ci is green mcp mcp, jsonl, and http surfaces size: XS less than 50 changed non-doc lines storage kb storage, migrations, schemas, and proposals tests tests and fixtures

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants