π¬ An Integrated AI Toolkit for Medical Paper Writing
3 MCP Servers Β· ~135 Tools Β· 26 Skills Β· 15 Prompts Workflows β All in VS Code
π ηΉι«δΈζη
π€ Auto-Paper: Fully Autonomous Paper Writing Guide β 11-Phase Pipeline, 78 Quality Hooks, Structured Review Loop
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 | 87 | Paper writing: projects, references, drafts, analysis, validation, review, 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 | 15 | /mdpaper.search, /mdpaper.draft, etc. |
External MCP Servers (optional, installed via uvx):
- drawio β CONSORT/PRISMA flowchart generation
- zotero-keeper β Import references from Zotero library
flowchart LR
subgraph IDE["VS Code"]
Agent["Copilot Agent<br/>26 Skills Β· 15 Prompts"]
Foam[Foam Plugin]
Ext[MedPaper Extension]
Dash[Dashboard]
end
subgraph MCP["MCP Servers (~138 tools)"]
mdpaper["mdpaper<br/>88 tools<br/>Draft Β· Export Β· Validate Β· Review"]
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
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: ~136 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 |
| Requirement | Version | Check |
|---|---|---|
| Python | 3.12+ | python3 --version |
| Git | Any recent | git --version |
| VS Code | Latest | Help β About |
| GitHub Copilot | Extension | Extensions panel |
# 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 PowerShellThe 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 π
# Foam for reference linking (highly recommended)
code --install-extension foam.foam-vscode
# Draw.io for diagram generation
./scripts/setup-integrations.sh && ./scripts/start-drawio.shWindows PowerShell:
.\scripts\setup-integrations.ps1
.\scripts\start-drawio.ps1In 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
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.
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" |
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
- 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
- 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
- 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)
- 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.)
- 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
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β π€ User Layer β
β βββββββββββββββββββ ββββββββββββββββββββββββββββββββ ββββββββββββ β
β β VS Code β β Foam Extension β βDashboard β β
β β Editor β β [[wikilinks]] autocomplete β β(Next.js) β β
β β β β hover preview Β· backlinks β β β β
β βββββββββββββββββββ ββββββββββββββββββββββββββββββββ ββββββββββββ β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β
βΌ
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β π€ Copilot Agent (Orchestrator) β
β 26 Skills + 15 Prompt Workflows + Agent Customization β
β /mdpaper.search β /mdpaper.concept β /mdpaper.draft β export β
βββββββββ¬βββββββββββββββββββ¬βββββββββββββββββββ¬βββββββββββββββββββ¬ββββββββββ
β β β β
βΌ βΌ βΌ βΌ
βββββββββββββββββ βββββββββββββββββ βββββββββββββββββ βββββββββββββββββ
β π mdpaper β βπ pubmed- β βπ‘ cgu β βπ External β
β 88 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 β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
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)
81 active tools organized into 8 groups:
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 |
update_authors |
Manage structured author metadata |
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 |
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 |
| 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 |
| 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 |
| Category | Key Tools |
|---|---|
| Pipeline Gates | validate_phase_gate, pipeline_heartbeat, validate_project_structure |
| Review Loop | start_review_round, submit_review_round, request_section_rewrite |
| Pipeline Control | pause_pipeline, resume_pipeline, approve_section |
| Audit & Hooks | run_quality_audit, run_writing_hooks, record_hook_event |
| Self-Evolution | run_meta_learning, verify_evolution, apply_pending_evolutions |
| Domain Constraints | check_domain_constraints, evolve_constraint |
| Data & Health | validate_data_artifacts, diagnose_tool_health, check_formatting |
| Category | Key Tools |
|---|---|
| Word Export | export_word, list_templates, start_document_session, verify_document |
| Pandoc Export | export_docx, export_pdf, preview_citations, build_bibliography |
| Submission | generate_cover_letter, generate_highlights |
| 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) |
| Category | Key Tools |
|---|---|
| Ideation | generate_ideas, spark_collision, spark_collision_deep |
| Analysis | deep_think, multi_agent_brainstorm |
| Methods | list_methods, select_method, apply_method |
| 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 |
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).
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]
---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, 88 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/ # 15 Prompt workflow files
βββ templates/ # Journal Word templates
βββ memory-bank/ # Global project memory
βββ tests/ # pytest test suite
| Status | Feature | Description |
|---|---|---|
| β | 3 MCP Servers | mdpaper (88) + 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
We welcome contributions! See CONTRIBUTING.md for guidelines.
- π Report bugs β Open an issue
- π‘ Suggest features β Share your ideas
- π§ Submit code β Fork β Branch β PR
If you use Medical Paper Assistant in your research, please cite our paper:
@article{medpaper2025,
title = {MedPaper Assistant: A Self-Evolving, MCP-Based Framework for
AI-Assisted Medical Paper Writing with Closed-Loop Quality Assurance},
author = {[Authors]},
year = {2025},
note = {Submitted to medRxiv},
url = {https://github.com/u9401066/med-paper-assistant}
}Note: This paper was produced entirely by the MedPaper Assistant's autonomous pipeline as a self-referential demonstration. The manuscript, audit trail, and all quality metrics are available in
projects/self-evolving-ai-paper-writing-framework/. The preprint is being submitted to medRxiv β this section will be updated with the DOI once available.
Apache License 2.0 β See LICENSE