Medical Paper Assistant
π¬ An Integrated AI Toolkit for Medical Paper Writing
3 MCP Servers Β· ~107 Tools Β· 26 Skills Β· 14 Prompt Workflows β All in VS Code
π ηΉι«δΈζη
π¦ What's in the Box
This is a monorepo toolkit that bundles everything a medical researcher needs β from literature search to Word/LaTeX export β into one integrated VS Code environment.
| Component | Type | Tools | Description |
|---|---|---|---|
| mdpaper | Core MCP Server | 57 | Paper writing: projects, references, drafts, analysis, validation, export |
| pubmed-search | MCP Server (submodule) | 37 | PubMed/Europe PMC/CORE search, PICO, citation metrics, session mgmt |
| CGU | MCP Server (submodule) | 13 | Creative generation: brainstorm, deep think, spark collision |
| VS Code Extension | Extension | 3 cmds | MCP server lifecycle, @mdpaper chat participant |
| Dashboard | Next.js Web App | β | Project management UI, diagram editor |
| Foam | VS Code Extension | β | [[wikilink]] citation linking, hover preview, graph view |
| Skills | Agent Workflows | 26 | Guided multi-tool workflows (literature review, draft writing...) |
| Prompts | Prompt Files | 14 | /mdpaper.search, /mdpaper.draft, etc. |
External MCP Servers (optional, installed via uvx):
- drawio β CONSORT/PRISMA flowchart generation
- zotero-keeper β Import references from Zotero library
How the Pieces Fit Together
flowchart LR
subgraph IDE["VS Code"]
Agent["Copilot Agent<br/>26 Skills Β· 14 Prompts"]
Foam[Foam Plugin]
Ext[MedPaper Extension]
Dash[Dashboard]
end
subgraph MCP["MCP Servers (~107 tools)"]
mdpaper["mdpaper<br/>57 tools<br/>Draft Β· Export Β· Validate"]
pubmed["pubmed-search<br/>37 tools<br/>Search Β· Metrics"]
cgu["CGU<br/>13 tools<br/>Deep Think Β· Ideas"]
end
subgraph Data["Project Data"]
proj[("projects/{slug}/<br/>Β· .memory/<br/>Β· references/<br/>Β· drafts/")]
end
Agent <-->|MCP| mdpaper
Agent <-->|MCP| pubmed
Agent <-->|MCP| cgu
mdpaper -->|HTTP API| pubmed
Foam <-->|Wikilinks| proj
mdpaper <--> proj
Ext --> mdpaper
Dash --> proj
π― Why This Tool?
Traditional paper writing tools require you to know exactly what you want before you start. But research is rarely that linear.
Medical Paper Assistant is different:
- π Explore First, Decide Later β Browse literature freely, save interesting papers, then decide your research direction
- π¬ Conversational Workflow β Chat naturally with AI to refine your ideas, not fight with forms
- π§ Guided Process β Step-by-step prompts guide you from concept to publication-ready manuscript
- π All-in-One β Search, write, cite, analyze, export β all integrated inside VS Code
| Traditional Tools | Medical Paper Assistant |
|---|---|
| Fixed templates, rigid workflow | Flexible, exploratory approach |
| Separate apps for search/write/cite | All-in-one: ~107 tools in VS Code |
| Manual reference management | Auto-save with verified PubMed data |
| Export then format | Direct Word export with journal styles |
| Learn complex UI | Natural language conversation |
π Quick Start
Prerequisites
| Requirement | Version | Check |
|---|---|---|
| Python | 3.12+ | python3 --version |
| Git | Any recent | git --version |
| VS Code | Latest | Help β About |
| GitHub Copilot | Extension | Extensions panel |
Install
# Clone with submodules
git clone --recursive https://github.com/u9401066/med-paper-assistant.git
cd med-paper-assistant
# Run setup script
./scripts/setup.sh # Linux/macOS
.\scripts\setup.ps1 # Windows PowerShell
The script will:
- β
Create Python virtual environment (
.venv/) - β
Install all dependencies (via
uv) - β
Create
.vscode/mcp.jsonconfiguration - β Verify installation
Verify: In Copilot Chat, type /mcp β you should see mdpaper listed π
Optional Integrations
# Foam for reference linking (highly recommended)
code --install-extension foam.foam-vscode
# Draw.io for diagram generation
./scripts/setup-integrations.sh && ./scripts/start-drawio.sh
π¬ MCP Prompts β Just Type and Go
In Copilot Chat, type these prompts to trigger guided workflows:
| Prompt | Description |
|---|---|
/mdpaper.search | π Start here! Explore literature, save papers |
/mdpaper.concept | π Develop research concept with novelty validation |
/mdpaper.draft | βοΈ Write manuscript with auto-citations |
/mdpaper.analysis | π Analyze CSV data, generate figures & Table 1 |
/mdpaper.format | π Export to Word with journal formatting |
/mdpaper.clarify | π Refine specific sections through conversation |
/mdpaper.project | π Create or switch research projects |
/mdpaper.strategy | βοΈ Configure search strategy (dates, filters) |
/mdpaper.help | β Show all available commands |
π‘ Recommended Workflow:
/mdpaper.searchβ/mdpaper.conceptβ/mdpaper.draftβ/mdpaper.format
π§ Skill System + Project Memory
Our core differentiator: We don't just provide tools β we provide guided workflows that know how to combine tools effectively, AND project memory that remembers your research journey across sessions.
What is a Skill?
Tool = Single capability (search, save, analyze...)
Skill = Complete knowledge (how to combine tools to accomplish tasks)
26 Skills covering the full research lifecycle:
| Category | Skills | Triggers |
|---|---|---|
| π¬ Research | literature-review, concept-development, concept-validation, parallel-search | "ζΎθ«ζ", "search", "concept", "validate" |
| βοΈ Writing | draft-writing, reference-management, word-export | "ε―«θη¨Ώ", "draft", "citation", "export" |
| π Management | project-management, memory-updater, memory-checkpoint | "ζ°ε°ζ‘", "εζ", "εζͺ" |
| π οΈ Development | git-precommit, code-refactor, test-generator, code-reviewer | "commit", "refactor", "test" |
Project Memory
Each project maintains its own .memory/ folder, so the AI continues previous research coherently:
projects/{slug}/
βββ .memory/
β βββ activeContext.md β Agent's working memory
β βββ progress.md β Research milestones
βββ concept.md β Research concept (with π protected sections)
βββ references/ β Foam-compatible literature library
βββ drafts/ β Markdown drafts with [[citations]]
βββ data/ β CSV data files
βββ results/ β Figures, .docx exports
β¨ Key Features
Literature & References
- PubMed + Europe PMC + CORE search (37 search tools)
- PICO parsing for clinical questions
- MCP-to-MCP verified data β PMID sent directly, no agent hallucination
- Layered trust: π VERIFIED (PubMed) Β· π€ AGENT (AI notes) Β· βοΈ USER (your notes)
- Foam wikilinks:
[[author2024_12345678]]with hover preview & backlinks
Writing & Editing
- AI draft generation per section (Introduction, Methods, Results, Discussion)
- Citation-Aware Editing β
patch_draftvalidates all[[wikilinks]]before saving - Auto-fix citation format β
[[12345678]]β[[author2024_12345678]] - Novelty validation β 3-round independent scoring (threshold: 75/100)
- Anti-AI writing rules β Evidence funnel structure, no clichΓ©s
Data Analysis
- CSV dataset analysis with descriptive statistics
- Statistical tests (t-test, ANOVA, chiΒ², correlation, Mann-Whitney, Fisher's)
- Table 1 generator β Baseline characteristics with automatic variable detection
- Publication-ready figures (matplotlib/seaborn)
Export & Submission
- Word export with journal template support
- Cover letter + highlights generation
- Manuscript consistency checker
- Reviewer response generator (point-by-point format)
- Submission checklist (word count, figure format, etc.)
Infrastructure
- DDD Architecture (Domain-Driven Design) with clean layer separation
- 15 pre-commit hooks (ruff, mypy, bandit, pytest, prettier, doc-update...)
- Workspace State recovery for cross-session continuity
- uv for all Python package management
ποΈ Architecture
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β π€ User Layer β
β βββββββββββββββββββ ββββββββββββββββββββββββββββββββ ββββββββββββ β
β β VS Code β β Foam Extension β βDashboard β β
β β Editor β β [[wikilinks]] autocomplete β β(Next.js) β β
β β β β hover preview Β· backlinks β β β β
β βββββββββββββββββββ ββββββββββββββββββββββββββββββββ ββββββββββββ β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β
βΌ
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β π€ Copilot Agent (Orchestrator) β
β 26 Skills + 14 Prompt Workflows + Agent Customization β
β /mdpaper.search β /mdpaper.concept β /mdpaper.draft β export β
βββββββββ¬βββββββββββββββββββ¬βββββββββββββββββββ¬βββββββββββββββββββ¬ββββββββββ
β β β β
βΌ βΌ βΌ βΌ
βββββββββββββββββ βββββββββββββββββ βββββββββββββββββ βββββββββββββββββ
β π mdpaper β βπ pubmed- β βπ‘ cgu β βπ External β
β 57 tools β β search β β 13 tools β β MCPs (uvx) β
β β β 37 tools β β β β β
β β’ projects β β β’ PubMed β β β’ brainstorm β β π¨ drawio β
β β’ references β β β’ Europe PMC β β β’ deep_think β β β’ diagrams β
β β’ drafts β β β’ CORE β β β’ spark β β β
β β’ validation β β β’ PICO β β β’ methods β β π zotero β
β β’ analysis β β β’ Gene/Chem β β β β β’ import refs β
β β’ export β β β’ Session β β β β β
βββββββββ¬ββββββββ βββββββββββββββββ βββββββββββββββββ βββββββββββββββββ
β
βΌ
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β πΎ Local Storage β
β projects/{slug}/ β
β βββ concept.md β Research concept with π protected sections β
β βββ references/{pmid}/ β Foam-compatible .md + metadata.json β
β βββ drafts/ β Markdown drafts with [[citations]] β
β βββ data/ β CSV data files β
β βββ results/ β Figures, .docx exports β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
MCP-to-MCP Direct Communication
When saving references, data flows directly between MCP servers β the Agent only passes a PMID, never full metadata:
Agent: "save PMID:24891204"
β
βΌ
mdpaper.save_reference_mcp(pmid="24891204")
β Direct HTTP call (not through Agent)
βΌ
pubmed-search: GET /api/cached_article/24891204
β Returns verified PubMed data
βΌ
Saved with layered trust:
π VERIFIED: PubMed data (immutable)
π€ AGENT: AI notes (marked source)
βοΈ USER: Your notes (editable)
π οΈ mdpaper MCP Tools
57 active tools organized into 7 groups:
π Project Management (15 tools)
Projects, exploration mode, workspace state recovery, diagram management.
| Key Tools | Description |
|---|---|
create_project / switch_project / delete_project | Project lifecycle |
start_exploration / convert_exploration_to_project | Explore-first workflow |
get_workspace_state / sync_workspace_state | Cross-session recovery |
save_diagram / list_diagrams | Draw.io integration |
setup_project_interactive | Interactive paper type configuration |
π Reference Management (10 tools)
Save, search, format, and manage references with Foam integration.
| Key Tools | Description |
|---|---|
save_reference_mcp | Recommended β Save by PMID via MCP-to-MCP (verified data) |
list_saved_references / search_local_references | Browse & search library |
format_references / set_citation_style | Vancouver / APA / Nature |
sync_references | Sync [[wikilinks]] to numbered references |
βοΈ Draft & Editing (13 tools)
Write, edit, cite β with built-in validation.
| Key Tools | Description |
|---|---|
write_draft / draft_section | Create and write sections |
get_available_citations | List all valid [[citation_key]] before editing |
patch_draft | Citation-aware partial edit with wikilink validation |
insert_citation / suggest_citations | Smart citation insertion |
scan_draft_citations / sync_references | Citation management |
get_section_template | Section-specific writing guidelines |
β Validation (3 tools)
| Tool | Description |
|---|---|
validate_concept | Full novelty scoring (3 rounds, threshold 75/100) |
validate_concept_quick | Quick structural check |
validate_wikilinks | Auto-fix [[12345678]] β [[author2024_12345678]] |
validate_for_section | Check concept before writing specific section |
π Data Analysis (9 tools)
| Tool | Description |
|---|---|
analyze_dataset | Descriptive statistics for CSV |
run_statistical_test | t-test, ANOVA, chiΒ², correlation, etc. |
generate_table_one | Baseline characteristics with auto variable detection |
create_plot | Publication-ready figures |
insert_figure | Insert figure into draft with archive validation |
insert_table | Insert table into draft with archive validation |
list_assets | List figures and tables in project results |
π Export & Submission (6 + 1 tools)
| Category | Key Tools |
|---|---|
| Word Export | export_word, list_templates, start_document_session, verify_document |
| Submission | generate_cover_letter, check_formatting, generate_highlights |
| Review | create_reviewer_response, format_revision_changes |
π pubmed-search MCP Tools (37 tools)
| Category | Key Tools |
|---|---|
| Search | search_literature, generate_search_queries, parse_pico |
| Databases | PubMed, Europe PMC (fulltext + text mining), CORE (200M+ open access) |
| Gene/Chem | search_gene, get_gene_details, search_compound, search_clinvar |
| Exploration | find_related_articles, find_citing_articles, get_article_references |
| Export | prepare_export (RIS/BibTeX/CSV), get_citation_metrics (iCite RCR) |
| Session | get_session_pmids, list_search_history (survives AI memory limits) |
π‘ CGU Creative Tools (13 tools)
| Category | Key Tools |
|---|---|
| Ideation | generate_ideas, spark_collision, spark_collision_deep |
| Analysis | deep_think, multi_agent_brainstorm |
| Methods | list_methods, select_method, apply_method |
π Foam Integration
| Feature | How to Use | Benefit |
|---|---|---|
| Wikilinks | [[greer2017_27345583]] | Link references in drafts |
| Hover Preview | Mouse over any [[link]] | See abstract without opening file |
| Backlinks Panel | Open reference file | See which drafts cite this paper |
| Graph View | Ctrl+Shift+P β Foam: Show Graph | Visualize paper connections |
| Project Isolation | Auto-switches on switch_project | Only see current project's references |
Citation Autocomplete
Type [[ in any draft to trigger the autocomplete menu:
According to previous studies [[ β Type [[ here
βββββββββββββββββββββββββββββββ
β π greer2017_27345583 β
β smith2020_12345678 β
β chen2019_87654321 β
βββββββββββββββββββββββββββββββ
Search by author ([[greer), year ([[2017), PMID ([[27345583), or keyword ([[sedation).
π Reference File Structure
References are stored with Foam-optimized, layered-trust structure:
references/{pmid}/
βββ {citation_key}.md β YAML frontmatter + abstract (human-readable)
βββ metadata.json β Full metadata (programmatic access)
---
# π VERIFIED (from PubMed, immutable)
title: "Complications of airway management"
author:
- { family: Pacheco-Lopez, given: Paulette C }
year: 2014
journal: Respiratory Care
pmid: "24891204"
_source:
mcp: pubmed-search
verified: true
# π€ AGENT (AI-generated, marked)
_agent:
notes: "Key review on airway complications"
relevance: high
# Foam
aliases: [pachecolopez2014, "PMID:24891204"]
tags: [reference, airway, review]
---
π Project Structure
med-paper-assistant/
βββ src/med_paper_assistant/ # Core MCP server (DDD architecture)
β βββ domain/ # Business logic, entities, value objects
β βββ application/ # Use cases, services
β βββ infrastructure/ # DAL, external services
β βββ interfaces/mcp/ # MCP server, 57 tools in 7 groups
β
βββ integrations/ # Bundled MCP servers
β βββ pubmed-search-mcp/ # PubMed/PMC/CORE search (37 tools)
β βββ cgu/ # Creative generation (13 tools)
β
βββ vscode-extension/ # VS Code Extension
β βββ src/ # Extension source
β βββ skills/ # Agent skill definitions
β βββ prompts/ # Quick-action prompts
β
βββ dashboard/ # Next.js project management UI
β βββ src/
β
βββ projects/ # Research projects (isolated workspaces)
β βββ {slug}/
β βββ .memory/ # Cross-session AI memory
β βββ concept.md # Research concept
β βββ references/ # Local reference library
β βββ drafts/ # Markdown drafts
β βββ results/ # Figures, exports
β
βββ .claude/skills/ # 26 Agent skill definitions
βββ .github/prompts/ # 14 Prompt workflow files
βββ templates/ # Journal Word templates
βββ memory-bank/ # Global project memory
βββ tests/ # pytest test suite
πΊοΈ Roadmap
| Status | Feature | Description |
|---|---|---|
| β | 3 MCP Servers | mdpaper (57) + pubmed-search (37) + CGU (13) |
| β | Foam Integration | Wikilinks, hover preview, backlinks, project isolation |
| β | Project Memory | .memory/ for cross-session AI context |
| β | Table 1 Generator | Auto-generate baseline characteristics |
| β | Novelty Validation | 3-round scoring with 75/100 threshold |
| β | Citation-Aware Editing | patch_draft with wikilink validation |
| β | MCP-to-MCP Trust | Verified PubMed data via direct HTTP |
| β | Pre-commit Hooks | 15 hooks (ruff, mypy, bandit, pytest, prettier...) |
| π | Full VSX Extension | TreeView, CodeLens, Diagnostics (Direction C) |
| π | Pandoc Export | Word + LaTeX dual export with CSL citations |
| π | Systematic Review | PRISMA flow, Risk of Bias, meta-analysis |
| π | AI Writing Intelligence | Citation intelligence, coherence engine |
| π | REST API Mode | Expose tools as REST API |
Architecture Direction: Direction C β Full VSX + Foam + Pandoc
Legend: β Complete | π In Progress | π Planned
π€ Contributing
We welcome contributions! See CONTRIBUTING.md for guidelines.
- π Report bugs β Open an issue
- π‘ Suggest features β Share your ideas
- π§ Submit code β Fork β Branch β PR
π License
Apache License 2.0 β See LICENSE