fix(mcp): preserve structured file asset identifiers
Preserve curated source-registry identifiers when rebuilding the file asset index so part-number queries such as 101049 can match drawings even when the filename omits the part number. Raise ranking for structured identifier matches above incidental substrings like timestamps, expose safe part-number fields through the MCP result payload, and allow customer-shareable engineering deliverables in the source-file MCP profile path while keeping blocked doc types enforced. Validation: python3 -m unittest discover -v; python3 -m py_compile obsidian_wiki/file_assets.py obsidian_wiki/mcp_assets.py tests/test_file_assets.py tests/test_mcp_assets.py; git diff --check; rebuilt the configured bjd vault file index; verified HTTP MCP search_file_assets and asset resource read for 101049 图纸.
This commit is contained in:
@@ -251,7 +251,7 @@ Modes: `by-tag` (default — top 10 tags), `by-category` (the seven vault folder
|
||||
|
||||
- **Source archive and catalog.** When `WIKI_ARCHIVE_SOURCES=true`, file-based ingest copies original sources into `_sources/archive/` inside the vault and records them in `_meta/source-registry.jsonl`. When `WIKI_SOURCE_CATALOG=true`, it also maintains `_sources/catalog/` pages organized by document type, product line, customer, competitor, standard, and market. Page citations can then point at vault-relative archived files instead of machine-local paths, while catalog pages provide clean business navigation without duplicating files.
|
||||
|
||||
- **SQLite file asset lookup.** `_meta/file-assets.sqlite` indexes archived and staged source files for low-latency file search. Use `obsidian-wiki file-index search "part/report/customer"` when the answer should be an original drawing, 3D/CAD file, spreadsheet, PDF, or test report path instead of a synthesized wiki answer. The database lives inside the vault and can be rebuilt from `_meta/source-registry.jsonl`.
|
||||
- **SQLite file asset lookup.** `_meta/file-assets.sqlite` indexes archived and staged source files for low-latency file search. Use `obsidian-wiki file-index search "part/report/customer"` when the answer should be an original drawing, 3D/CAD file, spreadsheet, PDF, or test report path instead of a synthesized wiki answer. The database lives inside the vault and can be rebuilt from `_meta/source-registry.jsonl`; rebuilds preserve structured registry fields such as part numbers, series, pitch, pin count, product lines, customers, standards, related pages, and catalog paths.
|
||||
|
||||
- **Multimodal sources.** Screenshots, whiteboard photos, slide captures, and diagrams ingest the same way as text — the agent transcribes any visible text verbatim and tags interpreted content as inferred. Requires a vision-capable model.
|
||||
|
||||
@@ -305,7 +305,7 @@ obsidian-wiki file-index search "Mini FAKRA 高频测试" --doc-type test_report
|
||||
obsidian-wiki file-index search "X4104 STEP" --source-type cad -n 10
|
||||
```
|
||||
|
||||
The database is stored at `<vault>/_meta/file-assets.sqlite`. It is rebuilt from `<vault>/_meta/source-registry.jsonl`, so deleting the database is safe as long as the registry and `_sources/archive/` remain. To queue a new file for later ingest, copy it into the vault inbox and add a staged index row:
|
||||
The database is stored at `<vault>/_meta/file-assets.sqlite`. It is rebuilt from `<vault>/_meta/source-registry.jsonl`, so deleting the database is safe as long as the registry and `_sources/archive/` remain. Registry metadata is treated as durable index input: `bjd_part_numbers`, `competitor_part_numbers`, `series`, `pitch`, `pin_count`, `product_lines`, `customers`, `competitors`, `standards`, `business_categories`, `related_pages`, and `catalog_paths` are preserved and merged with automatic extraction on every rebuild. To queue a new file for later ingest, copy it into the vault inbox and add a staged index row:
|
||||
|
||||
```bash
|
||||
obsidian-wiki file-index stage ./drawing.step --project bjd --doc-type drawing
|
||||
@@ -326,11 +326,12 @@ obsidian-wiki-mcp
|
||||
Configure your agent to run `obsidian-wiki-mcp` as a stdio MCP server. The server exposes:
|
||||
|
||||
- `search_file_assets` — finds safe source files by product code, series, customer, doc type, or file type.
|
||||
- `list_file_assets` — browses safe source files with optional filters.
|
||||
- `get_file_asset_metadata` — returns one file's safe metadata and `asset://source/sha256/...` URI.
|
||||
- `file_index_status` — shows vault/index/profile status.
|
||||
- `asset://source/sha256/{digest}` — binary resource for an allowed archived file.
|
||||
|
||||
By default the MCP layer is stricter than local CLI lookup: it only serves engineering files such as drawings, 3D/STEP models, specifications, product parameters, and test reports. It blocks raw orders, prices, email correspondence, complaint evidence, claims, personal data, and files missing from `_meta/source-registry.jsonl`. Use `OBSIDIAN_MCP_BOT_PROFILE`, `OBSIDIAN_MCP_MAX_FILE_BYTES`, and `OBSIDIAN_MCP_EXPOSE_PATHS` to tune the runtime behavior.
|
||||
By default the MCP layer is stricter than local CLI lookup: it only serves engineering files such as drawings, 3D/STEP models, specifications, product parameters, and test reports. Customer-shareable engineering deliverables, such as PDF customer drawings, are allowed for source-file lookup when the active profile already allows technical engineering data. It blocks raw orders, prices, email correspondence, complaint evidence, claims, personal data, and files missing from `_meta/source-registry.jsonl`. Use `OBSIDIAN_MCP_BOT_PROFILE`, `OBSIDIAN_MCP_MAX_FILE_BYTES`, and `OBSIDIAN_MCP_EXPOSE_PATHS` to tune the runtime behavior.
|
||||
|
||||
Optional: run the same MCP server over Streamable HTTP for a remote MCP client:
|
||||
|
||||
|
||||
Reference in New Issue
Block a user