Medical RAG with Asset-Aware MCP - Precise PDF asset retrieval (tables, figures, sections) for AI Agents
Project description
asset-aware-mcp
๐ฅ Medical RAG with Asset-Aware MCP - Precise PDF asset retrieval (tables, figures, sections) and Knowledge Graph for AI Agents.
๐ ็น้ซไธญๆ
๐ฏ Why Asset-Aware MCP?
AI cannot directly read image files on your computer. This is a common misconception.
| Method | Can AI analyze image content? | Description |
|---|---|---|
| โ Provide PNG path | No | AI cannot access the local file system |
| โ Asset-Aware MCP | Yes | Retrieves Base64 via MCP, allowing AI vision to understand directly |
Real-world Effect
# After retrieving the image via MCP, the AI can analyze it directly:
User: What is this figure about?
AI: This is the architecture diagram for Scaled Dot-Product Attention:
1. Inputs: Q (Query), K (Key), V (Value)
2. MatMul of Q and K
3. Scale (1/โdโ)
4. Optional Mask (for decoder)
5. SoftMax normalization
6. Final MatMul with V to get the output
This is the value of Asset-Aware MCP - enabling AI Agents to truly "see" and understand charts and tables in your PDF literature.
โจ Features
- ๐ Asset-Aware ETL - PDF โ Markdown with dual-engine PDF parsing:
- PyMuPDF (default) - Fast extraction (~50MB)
- Marker (optional,
use_marker=True) - High-precision structured parsing withblocks.json(bbox/coordinates)
- ๐งญ Section Navigation - Dynamic hierarchy section tree with 5 tools: browse, search, detail, content reading, and block extraction for any depth of headings.
- ๐ Async Job Pipeline - Supports asynchronous task processing and progress tracking for large documents.
- ๐บ๏ธ Document Manifest - Provides a structured "map" of the document for precise data access by Agents.
- ๐ง LightRAG Integration - Knowledge Graph + Vector Index, supporting cross-document comparison and reasoning.
- ๐ Docx Editing (DFM) - Edit .docx files in Markdown via Docx-Flavored Markdown format. Supports legacy
.docfiles (auto-converts via LibreOffice). 12 tools: ingest, read, save, list, delete, strict round-trip validation, DOCXโPDF, DOCXโDOC, and Docx โ A2T bridges. - ๐ก๏ธ DFM Integrity Checker - Automatic validation and auto-repair at every pipeline stage (post-ingest, pre-save, post-save). Catches orphan markers, column mismatches, and format inconsistencies.
- ๐ A2T (Anything to Table) - 7 operation-based tools for building professional tables from any source (PDF assets, Knowledge Graph, URLs, user input). Features: Citations (AssetRef), Audit Trail, Schema Evolution, Templates, Drafting, and Token-efficient resumption.
- ๐ฅ๏ธ VS Code Management Extension - Graphical interface for monitoring server status, ingested documents, and A2T tables/drafts with one-click Excel export.
- ๐ MCP Server - Exposes tools and resources to Copilot/Claude via FastMCP.
- ๐ฅ Medical Research Focus - Optimized for medical literature, supporting Base64 image transmission for Vision AI analysis.
๐๏ธ Architecture
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ AI Agent (Copilot) โ
โโโโโโโโโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ MCP Protocol (Tools & Resources)
โโโโโโโโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ MCP Server (Modular Presentation) โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ tools/: 43 tools in 7 modules โ โ
โ โ document (8) โ docx (13) โ section (5) โ โ
โ โ job (3) โ knowledge (2) โ table (7) โ profile (5) โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ resources/: 12 resources in 2 modules โ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โโโโโโโโโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ
โโโโโโโโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ ETL Pipeline (DDD) โ
โ โโโโโโโโโโโโ โโโโโโโโโโโโ โโโโโโโโโโโโ โ
โ โ PyMuPDF โ โ Asset โ โ LightRAG โ โ
โ โ Adapter โโ โ Parser โโ โ Index โ โ
โ โโโโโโโโโโโโ โโโโโโโโโโโโ โโโโโโโโโโโโ โ
โโโโโโโโโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ
โโโโโโโโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Local Storage โ
โ ./data/ โ
โ โโโ doc_{id}/ # Document Assets โ
โ โโโ docx_{id}/ # Docx IR + DFM + Assets โ
โ โโโ tables/ # A2T Tables (JSON/MD/XLSX) โ
โ โ โโโ drafts/ # Table Drafts (Persistence) โ
โ โโโ lightrag_db/ # Knowledge Graph โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
๐ Project Structure (DDD)
asset-aware-mcp/
โโโ src/
โ โโโ domain/ # ๐ต Domain: Entities, Value Objects, Interfaces
โ โโโ application/ # ๐ข Application: Doc Service, Table Service (A2T), Asset Service
โ โโโ infrastructure/ # ๐ Infrastructure: PyMuPDF, LightRAG, Excel Renderer
โ โโโ presentation/ # ๐ด Presentation: MCP Server (FastMCP)
โโโ data/ # Document and Asset Storage
โโโ docs/
โ โโโ spec.md # Technical Specification
โโโ tests/ # Unit and Integration Tests
โโโ vscode-extension/ # VS Code Management Extension
โโโ pyproject.toml # uv Project Config
๐ Quick Start
# Install dependencies (using uv)
uv sync
# Run MCP Server
uv run python -m src.presentation.server
# Or use the VS Code extension for graphical management
๐ MCP Tools
Document & Asset Tools
| Tool | Purpose |
|---|---|
ingest_documents |
Process PDF files with optional Marker backend (use_marker=True for blocks.json) |
list_documents |
List all ingested documents and their asset counts |
inspect_document_manifest |
Inspect document structure before fetching specific assets |
fetch_document_asset |
Precisely retrieve tables (MD) / figures (B64) / sections |
parse_pdf_structure |
Run high-precision Marker parsing and emit structured blocks |
search_source_location |
Search exact source locations with page + bbox for verification |
Job Management Tools
| Tool | Purpose |
|---|---|
get_job_status |
Get async ingestion job progress and final result |
list_jobs |
List active or historical ETL jobs |
cancel_job |
Cancel a running ETL job |
Knowledge Graph Tools
| Tool | Purpose |
|---|---|
consult_knowledge_graph |
Knowledge graph query, cross-document comparison |
export_knowledge_graph |
Export graph summary / JSON / Mermaid for inspection |
Section Navigation Tools (Dynamic Hierarchy)
| Tool | Purpose |
|---|---|
list_section_tree |
Display complete section hierarchy tree (supports any depth) |
get_section_detail |
Get detailed info for a specific section |
get_section_blocks |
Extract all blocks from a section with page + bbox |
search_sections |
Search section titles |
get_section_content |
Read section content via asset service |
Docx Editing Tools (DFM โ Docx-Flavored Markdown)
Edit .docx files as Markdown. Preserves formatting, tables, media on round-trip.
| Tool | Purpose |
|---|---|
ingest_docx |
Import .docx and decompose into DFM blocks |
get_docx_content |
Read DFM content of specific blocks |
save_docx |
Write DFM edits back to .docx |
list_docx_blocks |
List document block structure |
docx_validate_roundtrip |
6-dimension round-trip fidelity validation + file-level comparison (SHA-256, ZIP diff) |
docx_table_to_context |
Bridge: Docx table โ A2T context |
docx_table_from_context |
Bridge: A2T table โ Docx table |
docx_chart_data |
Extract chart data from Docx |
A2T (Anything to Table) Tools โ 7 Operation-Based Tools
Agent-friendly design: each tool handles multiple operations via
operationparameter. Tables accept any source โ PDF assets, KG entities, external URLs, or user input.
| Tool | Operations | Purpose |
|---|---|---|
plan_table |
schema / templates / from_template |
Schema planning, browse 4 built-in templates, create from template |
table_manage |
create / delete / list / preview / resume / render / add_column / remove_column / rename_column |
Table lifecycle + Schema evolution |
table_data |
add_rows / get_row / update_row / delete_row / get_cell / update_cell / clear_cell |
Row & cell CRUD |
table_cite |
add / get / remove / cell_history |
Citation management with AssetRef (7 source types) |
table_history |
changes / tokens |
Audit trail & token estimation |
table_draft |
create / update / add_rows / resume / commit / list / delete |
Draft workflow with persistence |
discover_sources |
โ | Cross-document source discovery (sections, tables, figures, KG) |
ETL Profile Tools
Different journals/formats need different extraction settings. Use these tools to switch profiles.
| Tool | Purpose |
|---|---|
list_etl_profiles |
List all available profiles (default, arxiv, nature, ieee, elsevier) |
get_etl_profile |
Get detailed configuration of a specific profile |
get_current_etl_profile |
Show currently active profile |
set_etl_profile |
Switch profile for subsequent document ingestion |
load_etl_profile_from_json |
Load custom profile from JSON file |
๐ง Tech Stack
| Category | Technology |
|---|---|
| Language | Python 3.10+ |
| Package Manager | uv (all pip/setup-python removed) |
| ETL | PyMuPDF (fitz) + Marker (optional, high-precision) |
| RAG | LightRAG (lightrag-hku) |
| MCP | FastMCP |
| Storage | Local filesystem (JSON/Markdown/PNG) |
๐ Documentation
- Technical Spec - Detailed technical specification
- Architecture - System architecture
- Constitution - Project principles
- Competitive Analysis - MCP + DOCX ecosystem landscape
๐ License
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file asset_aware_mcp-0.5.0.tar.gz.
File metadata
- Download URL: asset_aware_mcp-0.5.0.tar.gz
- Upload date:
- Size: 721.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
36139939bbfd7a55e2be8f068e5503ae614f2b801a35b02d156346ae994db108
|
|
| MD5 |
75ebe381757a1c9b777df47f38a85f26
|
|
| BLAKE2b-256 |
5430b86833afded57afabccc49bd7df231255b3083503ce4b258a9eb1f3fac2e
|
Provenance
The following attestation bundles were made for asset_aware_mcp-0.5.0.tar.gz:
Publisher:
release.yml on u9401066/asset-aware-mcp
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
asset_aware_mcp-0.5.0.tar.gz -
Subject digest:
36139939bbfd7a55e2be8f068e5503ae614f2b801a35b02d156346ae994db108 - Sigstore transparency entry: 1100914842
- Sigstore integration time:
-
Permalink:
u9401066/asset-aware-mcp@487ffe2ed9a904e5b17b13af630e26850ff1987a -
Branch / Tag:
refs/tags/v0.5.0 - Owner: https://github.com/u9401066
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@487ffe2ed9a904e5b17b13af630e26850ff1987a -
Trigger Event:
push
-
Statement type:
File details
Details for the file asset_aware_mcp-0.5.0-py3-none-any.whl.
File metadata
- Download URL: asset_aware_mcp-0.5.0-py3-none-any.whl
- Upload date:
- Size: 193.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
98aa25f6fd087a1edfd1ce224d9e2730b20bdc3af298487870e1fe84c83205e6
|
|
| MD5 |
c9e65272307151d85235b34e492db64a
|
|
| BLAKE2b-256 |
0fc69fef297eb8b272c1c6a89fcde03c7f63764c13f21a3ca176524ee79228b6
|
Provenance
The following attestation bundles were made for asset_aware_mcp-0.5.0-py3-none-any.whl:
Publisher:
release.yml on u9401066/asset-aware-mcp
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
asset_aware_mcp-0.5.0-py3-none-any.whl -
Subject digest:
98aa25f6fd087a1edfd1ce224d9e2730b20bdc3af298487870e1fe84c83205e6 - Sigstore transparency entry: 1100914875
- Sigstore integration time:
-
Permalink:
u9401066/asset-aware-mcp@487ffe2ed9a904e5b17b13af630e26850ff1987a -
Branch / Tag:
refs/tags/v0.5.0 - Owner: https://github.com/u9401066
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@487ffe2ed9a904e5b17b13af630e26850ff1987a -
Trigger Event:
push
-
Statement type: