Skip to main content
Glama

lnm-writer

Agent Skills and an MCP server for writing, refereeing, and illustrating papers in the lesion network mapping literature — the family of studies that localize a symptom or a therapeutic effect to a brain network using causal evidence and a normative connectome.

Covers six designs: lesion network mapping, voxel-based lesion-symptom mapping, DBS sweet-spot and probabilistic stimulation mapping, DBS network mapping, convergent causal mapping, and coordinate or atrophy network mapping.

The knowledge base was distilled from a close structural reading of fourteen published papers in this literature. It encodes the section skeletons, the reporting obligations each design carries, the statistics and their failure modes, the figure conventions, the limitations bank, and the sentence frames the genre uses. It contains no text from those papers.

What it does

Capability

Skill

MCP tool

Decide which design a study is

lnm-paper

lnm_classify_design

Plan the sections, and find the analyses that are missing

lnm-paper

lnm_outline_paper

Get the reporting checklist for a design

lnm-paper

lnm_methods_checklist

Read the guidance on methods, statistics, argument, figures

all

lnm_list_guidance, lnm_get_guidance

Get sentence frames for a section

lnm-paper

lnm_phrasebook

Get the limitations that actually apply to this study

lnm-paper

lnm_limitations

Audit a draft for missing reporting elements and overstatement

lnm-review

lnm_audit_manuscript

Plan the figure set, sized to a journal's column

lnm-figures

lnm_figure_plan

Check a caption for the elements the genre requires

lnm-figures

lnm_caption_check

Render brain figures, and audit a finished figure file

lnm-figures

lnmfig command

The server holds no model and writes no prose. It serves the structure of the genre; the calling agent does the writing. Pixels are a separate concern: lnmfig, the Python package in this repository, does the rendering.

Related MCP server: memory-garden

lnmfig: the figure toolkit

pip install -e '.[all]'

lnmfig whole-brain map.nii.gz -o fig3 --threshold 2.5 --journal nature --column double
lnmfig montage     map.nii.gz -o fig2 --plane axial --cuts=-26,-14,2,18,34 --threshold 2.5
lnmfig overlap     lesions/*.nii.gz -o fig1a --save-counts overlap.nii.gz
lnmfig convergence mapA.nii.gz mapB.nii.gz -o fig4 --threshold 2.5 --similarity
lnmfig audit       fig3.pdf --journal nature --column double --caption caption.txt

Renders the field's visual grammar: the inflated cortex, the SUIT cerebellar flatmap, slice montages on an anatomical underlay, glass-brain overlap maps, the convergence overlay, predicted-against-empirical scatters with their confidence band, permutation nulls, and JAMA-style forest tables. Reads Lead-DBS atlases and electrode reconstructions without MATLAB.

Three properties it enforces that a bare plotting call does not:

  • One scale, resolved once. A cortex panel and a cerebellum panel of the same map share limits, threshold, and colormap, because a reader compares them and they are only comparable if the scale is identical.

  • True printed size. Figures are authored at the journal's column width in inches and exported without cropping to content, so the declared canvas is the delivered canvas and nothing silently drops below the minimum legible font size.

  • Provenance. Every render carries the scale that produced it, so lnmfig caption builds a caption stub from the render, with a bracketed placeholder for every fact it does not have.

lnmfig audit checks a finished file against a journal's rules: resolution at the printed size, canvas width against the column, colour mode, greyscale legibility, Type 3 fonts, and whether the caption carries the threshold, correction, template, test, and sample size.

Install

As a Claude Code plugin (skills and MCP server together)

git clone https://github.com/nielspac177/lnm-writer.git ~/.claude/skills/lnm-writer && cd ~/.claude/skills/lnm-writer && npm install

The repository carries a .claude-plugin/plugin.json, so any folder under a skills directory containing that manifest loads as a plugin on the next session — with no marketplace and no install step. Restart Claude Code, approve the MCP server when prompted, and all three skills plus the nine tools are available.

Skills only, on any agent CLI

npx skills add nielspac177/lnm-writer

Installs to Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, opencode, Zed, and the rest of the agents that CLI supports. Add -g for a global install, or --skill lnm-paper to take just one. The skills are self-contained: each carries its own copy of the references it reads, so they work with no MCP server present.

MCP server only, on any MCP client

git clone https://github.com/nielspac177/lnm-writer.git && cd lnm-writer && npm install

npm install builds dist/. Then register the server with your client.

Claude Code:

claude mcp add lnm-writer -- node /absolute/path/to/lnm-writer/dist/index.js

Codex, in ~/.codex/config.toml:

[mcp_servers.lnm-writer]
command = "node"
args = ["/absolute/path/to/lnm-writer/dist/index.js"]

Any client that reads an mcpServers block, including Cursor, Gemini CLI, and Claude Desktop:

{
  "mcpServers": {
    "lnm-writer": {
      "command": "node",
      "args": ["/absolute/path/to/lnm-writer/dist/index.js"]
    }
  }
}

Transport is stdio. The knowledge base is bundled and local, so there is no remote state, no credential, and no network call at runtime.

Tools

All nine are read-only and annotated as such.

  • lnm_list_designs — the six designs, with the claim each one can establish.

  • lnm_classify_design — scores a free-text study description against every design and returns a ranked list with the signals it matched, plus the analyses reviewers of the winner expect. Declines to guess when nothing matches, and says which facts to add.

  • lnm_outline_paper — a section-by-section plan: subsections in the literature's order, word budgets, per-section reporting obligations, and sentence frames. Leads with the gaps: analyses the design normally has to defend that nothing in the described study covers.

  • lnm_list_guidance / lnm_get_guidance — the five long-form documents, whole or sliced to one heading.

  • lnm_methods_checklist — 66 reporting items graded required, expected, or optional, each with the reason it matters, filterable by design and section.

  • lnm_phrasebook — 59 sentence frames across 12 groups, by section and purpose.

  • lnm_limitations — the limitations bank filtered by what the study actually did. Each entry pairs the concession with the counter published papers use. Entries the study already answers come back separately as retired, so they are reported as strengths rather than conceded.

  • lnm_audit_manuscript — 36 deterministic checks over a draft, graded blocking, address-before-submission, and consider. Half look for missing reporting elements; the rest look for phrasings that overstate what the design supports, and quote the text that triggered them.

Resources are exposed at lnm://guidance/{id}. Two prompts, write_lnm_paper and review_lnm_manuscript, drive the full workflow.

What the audit is and is not

It is a text search for required reporting elements. It tells you whether a manuscript says an analysis was done; it cannot tell you whether the analysis was done well. A clean audit is a floor, not a verdict.

Repository layout

knowledge/          single source of truth: 5 markdown documents + 8 JSON data files
skills/             three Agent Skills, each with a committed copy of the references it reads
src/                MCP server (TypeScript, stdio, @modelcontextprotocol/sdk)
lnmfig/             the figure toolkit (Python, nilearn + SUITPy + matplotlib)
scripts/            sync-knowledge.mjs keeps the skill copies identical to knowledge/
test/               smoke.mjs drives the server over a real MCP client session
tests/              test_lnmfig.py covers the toolkit, skipping renderers when extras are absent

Edit files in knowledge/, then npm run sync. npm run build fails if the copies drift.

Development

npm install          # installs and builds the MCP server
npm run build        # compile, then verify the skill copies are in sync
npm run sync         # propagate knowledge/ into skills/*/references/
node test/smoke.mjs  # 51 end-to-end checks over a real MCP client session
npm run inspect      # open the MCP Inspector against the server

uv venv .venv && uv pip install --python .venv/bin/python -e '.[all]' pytest scikit-image
.venv/bin/python -m pytest tests/         # 39 checks over the figure toolkit

knowledge/journals.json is a copy of lnmfig/data/journals.json, which is the source: the Python package has to install standalone, and the MCP server has to serve the same numbers without importing Python. npm run sync propagates it and npm run build fails if it drifts.

Scope and limits

This encodes the conventions of a specific literature. It will make a manuscript conform to that literature's expectations; it will not make a study sound, and it cannot see your data.

The tools never generate numbers. Where a value is missing, the skills write an explicit placeholder and collect them for you to fill in. A fabricated coordinate or p-value in a neuroimaging manuscript is a research-integrity problem, so this is a hard rule rather than a preference.

License

MIT. See LICENSE.

Available Tools

9 tools
lnm_audit_manuscriptAudit a draft against the reporting checklistA
Read-onlyIdempotent

Search a draft for the reporting elements this design requires, and for phrasings that overstate what the design supports.

Findings come in three grades: blocking (a reviewer will reject or major-revise on it), address before submission, and consider. Each finding names the section, the problem, and the fix. Overstatement findings quote the text that triggered them.

This is a text search, not a review. It tells you whether the manuscript says an analysis was done; it cannot tell you whether the analysis was done well. A clean audit is a floor, not a verdict.

Args:

  • manuscript: the full text, or at minimum one complete section (120+ words)

  • design: optional design id; supplying it adds that design's specific checks

Returns: counts, then findings grouped by severity.

Inputs: manuscript (required), design, response_format.

lnm_classify_designClassify a study into a designA
Read-onlyIdempotent

Decide which lesion/stimulation mapping design a described study belongs to.

Pass a free-text description of the data: the cohorts you have, where they came from, what the outcome variable is, and whether a second cohort exists for validation. The tool scores every design against that description and returns a ranked list with the signals it matched, plus the analyses reviewers of the winning design expect before they will believe the central claim.

Example input: "We traced 21 published lesion cases causing acute-onset vertigo, compared them against 30 control lesions causing other brainstem syndromes, and seeded connectivity in the GSP1000 connectome."

Returns: best match, a confidence flag, a ranked table, and the mandatory analyses. Error handling: when nothing matches, the response says which facts to add to the description rather than guessing a design.

Inputs: description (required), response_format.

lnm_get_guidanceRead a guidance documentA
Read-onlyIdempotent

Fetch one guidance document, or one heading within it.

Documents run to several thousand words. Pass 'section' with part of a heading to pull just that heading and its subheadings; without it you get the whole document, truncated at 25,000 characters with a note saying so.

Args:

  • id: a document id from lnm_list_guidance

  • section: optional, substring of a heading, e.g. 'specificity' or 'permutation'

Error handling: an unknown id lists the valid ids; a heading that matches nothing lists the headings that document actually has.

Inputs: id (required), section.

lnm_limitationsLimitations that apply to this studyA
Read-onlyIdempotent

Return the limitations a reviewer of this design will raise, filtered to the ones that are actually yours.

Every entry pairs the concession with the counter that published papers use, because a bare concession invites the reviewer to finish the sentence. Entries your study already answers are listed separately as 'retired', so you report them as strengths in the Methods instead of conceding them in the Discussion.

Args:

  • design: design id

  • study_features: what your study did, one string per feature, e.g. ['prospective cohort', 'lesions traced from 3D MRI', 'out-of-sample validation cohort', 'age-matched connectome']. These both trigger and retire entries.

Returns: an ordered list to write as one Discussion paragraph, plus the retired set.

Inputs: design, study_features, response_format.

lnm_list_designsList lesion network mapping study designsA
Read-onlyIdempotent

List every study design this server can plan, check, and audit.

Use this first when you do not yet know which design a study is, or to show a user the options. Each row names the design, an id you pass to the other tools, and the claim that design is able to establish.

Designs covered: lesion network mapping, voxel-based lesion-symptom mapping, DBS sweet-spot/probabilistic stimulation mapping, DBS network mapping (connectivity to the stimulation volume), convergent multi-modal mapping, and coordinate network mapping of published findings.

Returns: a table of id, name, and what the design establishes. Don't use when: you already know the design id — call lnm_outline_paper directly.

Inputs: response_format.

lnm_list_guidanceList guidance documentsA
Read-onlyIdempotent

List the long-form guidance documents bundled with this server.

These are the prose references behind the other tools: how each design works, how the Methods are written, which statistics the genre uses and what they are for, figure conventions, and how the Discussion is argued. Filter by design or topic.

Returns: id, title, what it covers, and the resource URI for each document. Fetch one with lnm_get_guidance.

Inputs: topic, design, response_format.

lnm_methods_checklistReporting checklist for a designA
Read-onlyIdempotent

Return the reporting checklist for a design as a tickable table.

Items are graded: 'required' means a reviewer of this design will ask for it by name, 'expected' means its absence reads as carelessness, 'optional' means it strengthens the paper. Each item carries the reason it matters, so you can decide rather than comply.

Use while drafting the Methods, and again before submission. For a check against finished text instead of a list to work from, use lnm_audit_manuscript.

Args:

  • design: optional design id; omitted returns items common to every design

  • section: optional, e.g. 'Methods', 'Results', 'Discussion'

  • include_optional: default false

Inputs: design, section, response_format, include_optional.

lnm_outline_paperPlan the sections of a paperA
Read-onlyIdempotent

Produce a section-by-section plan for a paper of a given design.

The plan gives, per section: the subsections in the order the literature uses them, a word budget, what the section has to accomplish, the reporting elements that must appear in it, and sentence frames to start from. Before the skeleton it lists the gaps: analyses this design normally has to defend that nothing in the study you described covers.

Call lnm_classify_design first if you do not know the design id.

Args:

  • design: a design id or name, e.g. 'lnm', 'dbs-network', 'convergent'

  • topic: the symptom, syndrome, or effect being localized, e.g. 'freezing of gait'

  • cohorts: one string per cohort, e.g. ['14 published lesion cases', '36 ET patients, VIM-DBS']

  • connectome: the normative connectome, e.g. 'GSP1000 rs-fMRI, n=1000'

  • analyses_done: analyses already run, e.g. ['leave-one-out cross-validation']

  • target_journal: used only to remind you to check word and figure limits

Returns: gaps, a skeleton table, and per-section obligations.

Inputs: topic (required), design (required), cohorts, connectome, +3 more.

lnm_phrasebookSentence frames for a sectionA
Read-onlyIdempotent

Return the sentence frames this literature uses, grouped by section and purpose.

These are the recurring moves: how a lesion cohort is introduced, how a sensitivity result is stated, how a specificity contrast is phrased, how a cross-validated prediction is reported, how a limitation is conceded. They exist to get the register right, not to be pasted in — a paper built from unedited frames reads like a form.

Args:

  • section: optional, e.g. 'Abstract', 'Methods', 'Results', 'Discussion'

Inputs: section, response_format.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A4.4/5.0

    Scored across 9 tools

    Disambiguation5/5

    Each tool has a distinct role: design listing/classification, paper outlining, guidance retrieval, checklist generation, phrasebook lookup, limitations, and manuscript audit. Even the closely related checklist and audit tools are clearly differentiated by drafting versus finished-text use.

    Naming Consistency4/5

    All tools share the lnm_ prefix and snake_case convention, and most follow verb_noun naming (list_designs, classify_design, outline_paper, get_guidance, audit_manuscript). A few noun-only names (methods_checklist, phrasebook, limitations) are minor deviations from the pattern.

    Tool Count5/5

    Nine tools is well within the ideal range and each tool earns its place by supporting a distinct stage of the study-design-to-manuscript workflow. The count feels neither sparse nor bloated.

    Completeness5/5

    The toolset covers the full workflow this server promises: design identification, paper outlining, guidance retrieval, methods checklisting, phrase support, limitations handling, and final manuscript audit. There are no obvious dead ends or missing stages within its stated purpose.

    Maintenance

    ActivityInactive
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      B
      quality
      C
      maintenance
      Enables read-only cognitive retrospect over Obsidian notes, surfacing stance changes, verifying claims with citable evidence, and avoiding unfounded causal stories via hybrid retrieval and eight read-only MCP tools.
      9
      10
      MIT
    • F
      license
      A
      quality
      B
      maintenance
      Exposes NeuroGraph's scientific API to AI models as MCP tools, enabling them to query, analyze, and visualize brain networks — regions, tracts, connectivity, literature, and cross-species homologies — drawn from a portable SSD-based neuroimaging data library. Lets models read real atlas data, load datasets, compute graph metrics, and produce visualization scene descriptors without acting as the scientific engine itself.
      12
      3
      -
    • A
      license
      B
      quality
      B
      maintenance
      Enables read-only analysis of intracortical spike-level brain-computer-interface recordings, including signal quality, spike detection, firing rates, and cursor-velocity decoding from local or streamed datasets.
      24
      33 PyPI
      1
      Creative Commons Zero v1.0 Universal