brainx-skill 1.0.12 → 1.0.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +30 -0
- package/installation/lib/bundle.js +51 -13
- package/installation/lib/cli.js +16 -4
- package/installation/lib/literature-mcp.js +536 -0
- package/manifest.json +4 -0
- package/mcp-servers/codex/README.md +82 -0
- package/mcp-servers/codex/UPSTREAM.md +22 -0
- package/mcp-servers/codex/server.mjs +142 -0
- package/mcp-servers/codex/skills.json +10 -0
- package/mcp-servers/codex/system-prompt.md +73 -0
- package/mcp-servers/codex/test/fixtures/fake-codex.mjs +6 -0
- package/mcp-servers/codex/test/server.test.mjs +99 -0
- package/mcp-servers/fulltext-resolver/README.md +136 -0
- package/mcp-servers/fulltext-resolver/REUSE.md +32 -0
- package/mcp-servers/fulltext-resolver/THIRD_PARTY_NOTICES.md +57 -0
- package/mcp-servers/fulltext-resolver/server.mjs +128 -0
- package/mcp-servers/fulltext-resolver/src/document.mjs +253 -0
- package/mcp-servers/fulltext-resolver/src/http.mjs +173 -0
- package/mcp-servers/fulltext-resolver/src/identifiers.mjs +123 -0
- package/mcp-servers/fulltext-resolver/src/model.mjs +105 -0
- package/mcp-servers/fulltext-resolver/src/resolver.mjs +305 -0
- package/mcp-servers/fulltext-resolver/src/sources/biorxiv.mjs +135 -0
- package/mcp-servers/fulltext-resolver/src/sources/europe-pmc.mjs +132 -0
- package/mcp-servers/fulltext-resolver/src/sources/openalex.mjs +165 -0
- package/mcp-servers/fulltext-resolver/test/document.test.mjs +82 -0
- package/mcp-servers/fulltext-resolver/test/resolver.test.mjs +287 -0
- package/mcp-servers/fulltext-resolver/test/server.test.mjs +63 -0
- package/mcp-servers/fulltext-resolver/test/sources.test.mjs +229 -0
- package/package.json +14 -10
- package/skills/bio-neuro-lit/SKILL.md +206 -0
- package/skills/bio-neuro-lit/THIRD_PARTY_NOTICES.md +34 -0
- package/skills/bio-neuro-lit/agents/openai.yaml +4 -0
- package/skills/bio-neuro-lit/references/tool-contracts.md +73 -0
- package/skills/bio-neuro-lit/scripts/deepxiv_fetch.py +110 -0
- package/skills/bio-neuro-lit/scripts/exa_search.py +190 -0
- package/skills/brainx-acceleration/SKILL.md +459 -0
- package/skills/brainx-general-guard/SKILL.md +31 -9
- package/skills/brainx-modeling-loop/SKILL.md +281 -0
- package/skills/brainx-modeling-loop/agents/openai.yaml +4 -0
- package/skills/brainx-modeling-loop/references/monitor-experiment.md +49 -0
- package/skills/brainx-modeling-loop/references/parameter-fitting-workflow/scripts/fitting_hh_neuron.py +254 -0
- package/skills/brainx-modeling-loop/references/parameter-fitting-workflow.md +272 -0
- package/skills/brainx-modeling-loop/references/run-experiment.md +179 -0
- package/skills/brainx-modeling-loop/references/training-workflow.md +270 -0
- package/skills/brainx-visualization/SKILL.md +157 -0
- package/skills/brainx-visualization/agents/openai.yaml +4 -0
- package/skills/brainx-visualization/references/interactive-and-visualization-styling.md +155 -0
- package/skills/brainx-visualization/references/neural-data-visualization.md +141 -0
- package/skills/brainx-visualization/references/statistical-and-model-visualization.md +133 -0
- package/skills/{braincell → package-skills/braincell}/SKILL.md +17 -6
- package/skills/package-skills/braincell/references/braintools/input-current.md +200 -0
- package/skills/package-skills/braincell/references/braintools/optimizer.md +179 -0
- package/skills/{braincell → package-skills/braincell}/references/multicompartment/multicompartment-cell-workflow.md +2 -2
- package/skills/package-skills/braincell/references/scripts/fitting_hh_neuron.py +254 -0
- package/skills/{brainmass → package-skills/brainmass}/references/brainstate/parameter-constraints-regularization.md +1 -1
- package/skills/{brainmass → package-skills/brainmass}/references/coupling-network-api.md +121 -3
- package/skills/{brainmass → package-skills/brainmass}/references/modellibrary.md +79 -1
- package/skills/package-skills/brainmass/references/parameter-sweeps-and-regime-analysis.md +188 -0
- package/skills/{brainmass → package-skills/brainmass}/references/visualization-analysis-api.md +6 -6
- package/skills/{brainpy-state → package-skills/brainpy-state}/SKILL.md +4 -3
- package/skills/{brainpy-state → package-skills/brainpy-state}/references/braintools/connectivity.md +1 -1
- package/skills/{brainpy-state → package-skills/brainpy-state}/references/braintools/input-current.md +1 -1
- package/skills/package-skills/brainpy-state/references/braintools/metric.md +152 -0
- package/skills/package-skills/brainpy-state/references/perturbation-experiment-validity.md +76 -0
- package/skills/{brainpy-state → package-skills/brainpy-state}/references/projection-patterns.md +1 -1
- package/skills/{brainstate → package-skills/brainstate}/SKILL.md +1 -0
- package/skills/{brainstate → package-skills/brainstate}/references/brainstate/brainstate-transformed-diagnostics.md +1 -1
- package/skills/{brainstate → package-skills/brainstate}/references/brainstate/parameter-constraints-regularization.md +1 -1
- package/skills/{brainstate → package-skills/brainstate}/references/brainstate/randomness-and-reproducibility.md +1 -1
- package/skills/{brainstate → package-skills/brainstate}/references/brainstate/transformation-grad-expansion.md +2 -2
- package/skills/{brainstate → package-skills/brainstate}/references/brainstate/transformation-vmap-expansion.md +1 -1
- package/skills/{brainstate → package-skills/brainstate}/references/libraries/prebuilt-layer-library.md +1 -1
- package/skills/package-skills/brainstate/references/paired-perturbation-execution.md +113 -0
- package/skills/package-skills/braintrace/SKILL.md +187 -0
- package/skills/package-skills/braintrace/references/Drtrl.md +133 -0
- package/skills/{braintrace → package-skills/braintrace}/references/ETP operators.md +31 -4
- package/skills/package-skills/braintrace/references/algorithm selection.md +64 -0
- package/skills/package-skills/braintrace/references/batching.md +140 -0
- package/skills/{braintrace → package-skills/braintrace}/references/compiler_internal.md +2 -2
- package/skills/{braintrace → package-skills/braintrace}/references/custom algorithms.md +8 -10
- package/skills/package-skills/braintrace/references/pp_pprop workflow.md +179 -0
- package/skills/{braintrace → package-skills/braintrace}/references/pre-built-braintrace-layer.md +2 -2
- package/skills/brainmass/references/parameter-sweeps-and-regime-analysis.md +0 -130
- package/skills/braintrace/SKILL.md +0 -161
- package/skills/braintrace/references/Drtrl.md +0 -179
- package/skills/braintrace/references/algorithm selection.md +0 -120
- package/skills/braintrace/references/batching.md +0 -150
- package/skills/braintrace/references/pp_pprop workflow.md +0 -196
- /package/skills/{braincell → package-skills/braincell}/references/area-scaled-hh-pattern.md +0 -0
- /package/skills/{braincell → package-skills/braincell}/references/braincell-custom-ion-channel-authoring.md +0 -0
- /package/skills/{brainpy-state → package-skills/braincell}/references/braintools/metric.md +0 -0
- /package/skills/{braincell → package-skills/braincell}/references/channel-library.md +0 -0
- /package/skills/{braincell → package-skills/braincell}/references/ion-library.md +0 -0
- /package/skills/{braincell → package-skills/braincell}/references/mixions-for-adaptation.md +0 -0
- /package/skills/{braincell → package-skills/braincell}/references/multicompartment/braincell-manual-morphology-construction.md +0 -0
- /package/skills/{braincell → package-skills/braincell}/references/multicompartment/cv-policy-reference.md +0 -0
- /package/skills/{braincell → package-skills/braincell}/references/multicompartment/filter-function-library.md +0 -0
- /package/skills/{braincell → package-skills/braincell}/references/multicompartment/morphology-io-loading-validation.md +0 -0
- /package/skills/{braincell → package-skills/braincell}/references/multicompartment/probe-reference.md +0 -0
- /package/skills/{braincell → package-skills/braincell}/references/multicompartment/topology-building-and-visualization.md +0 -0
- /package/skills/{braincell → package-skills/braincell}/references/scripts/calcium_channel_gating.py +0 -0
- /package/skills/{braincell → package-skills/braincell}/references/scripts/cell_multicompartment_reference.py +0 -0
- /package/skills/{braincell → package-skills/braincell}/references/scripts/channel_ablation.py +0 -0
- /package/skills/{braincell → package-skills/braincell}/references/scripts/fi_curve.py +0 -0
- /package/skills/{braincell → package-skills/braincell}/references/scripts/hh_neuron_basics.py +0 -0
- /package/skills/{braincell → package-skills/braincell}/references/scripts/spike_frequency_adaptation.py +0 -0
- /package/skills/{braincell → package-skills/braincell}/references/scripts/t_current_rebound.py +0 -0
- /package/skills/{braincell → package-skills/braincell}/references/scripts/thalamic_neurons.py +0 -0
- /package/skills/{braincell → package-skills/braincell}/references/solver-library-with-effects.md +0 -0
- /package/skills/{brainevent → package-skills/brainevent}/SKILL.md +0 -0
- /package/skills/{brainevent → package-skills/brainevent}/references/connectivity-variants.md +0 -0
- /package/skills/{brainevent → package-skills/brainevent}/references/custom-operators-cpu.md +0 -0
- /package/skills/{brainevent → package-skills/brainevent}/references/custom-operators-gpu.md +0 -0
- /package/skills/{brainevent → package-skills/brainevent}/references/scripts/102_EI_net_1996.py +0 -0
- /package/skills/{brainevent → package-skills/brainevent}/references/scripts/204_joglekar_2018_propagation.py +0 -0
- /package/skills/{brainevent → package-skills/brainevent}/references/scripts/coba_ei_teaching.py +0 -0
- /package/skills/{brainevent → package-skills/brainevent}/references/sparse-formats.md +0 -0
- /package/skills/{brainevent → package-skills/brainevent}/references/synaptic-plasticity.md +0 -0
- /package/skills/{brainmass → package-skills/brainmass}/SKILL.md +0 -0
- /package/skills/{brainmass → package-skills/brainmass}/references/batch-transform-acceleration.md +0 -0
- /package/skills/{brainmass → package-skills/brainmass}/references/brainstate/parameter-transforms-regularizers-catalog.md +0 -0
- /package/skills/{brainmass → package-skills/brainmass}/references/braintools/cogtask.md +0 -0
- /package/skills/{brainmass → package-skills/brainmass}/references/braintools/data-preprocessing.md +0 -0
- /package/skills/{brainmass → package-skills/brainmass}/references/braintools/metric.md +0 -0
- /package/skills/{brainmass → package-skills/brainmass}/references/braintools/optimizer.md +0 -0
- /package/skills/{brainmass → package-skills/brainmass}/references/braintools/parameter-initializer.md +0 -0
- /package/skills/{brainmass → package-skills/brainmass}/references/braintools/surrogate.md +0 -0
- /package/skills/{brainmass → package-skills/brainmass}/references/datasets-api.md +0 -0
- /package/skills/{brainmass → package-skills/brainmass}/references/fitting-with-objectives-api.md +0 -0
- /package/skills/{brainmass → package-skills/brainmass}/references/forward-observation-api.md +0 -0
- /package/skills/{brainmass → package-skills/brainmass}/references/horn-task-training.md +0 -0
- /package/skills/{brainmass → package-skills/brainmass}/references/noiseprocesses.md +0 -0
- /package/skills/{brainmass → package-skills/brainmass}/references/scripts/eeg-fitting-with-gradients.py +0 -0
- /package/skills/{brainmass → package-skills/brainmass}/references/scripts/gradient-free-fitting.py +0 -0
- /package/skills/{brainmass → package-skills/brainmass}/references/scripts/hopf-bifurcation-single-node.py +0 -0
- /package/skills/{brainmass → package-skills/brainmass}/references/scripts/horn-cognitive-task-training.py +0 -0
- /package/skills/{brainmass → package-skills/brainmass}/references/scripts/jansen-rit-eeg-proxy.py +0 -0
- /package/skills/{brainmass → package-skills/brainmass}/references/scripts/kuramoto-synchronization.py +0 -0
- /package/skills/{brainmass → package-skills/brainmass}/references/scripts/linear-baseline-node.py +0 -0
- /package/skills/{brainmass → package-skills/brainmass}/references/scripts/resting-state-meg-whole-brain-pipeline.py +0 -0
- /package/skills/{brainmass → package-skills/brainmass}/references/scripts/seizure-epileptor-case-study.py +0 -0
- /package/skills/{brainmass → package-skills/brainmass}/references/scripts/wilson-cowan-ei-dynamics.py +0 -0
- /package/skills/{brainmass → package-skills/brainmass}/references/scripts/wong-wang-decision-making.py +0 -0
- /package/skills/{brainmass → package-skills/brainmass}/references/scripts/wong-wang-dmf-resting-state.py +0 -0
- /package/skills/{brainmass → package-skills/brainmass}/references/simulator-input-monitor-api.md +0 -0
- /package/skills/{brainpy-state → package-skills/brainpy-state}/references/array-creation.md +0 -0
- /package/skills/{brainpy-state → package-skills/brainpy-state}/references/brain-dynamics-delay-protocol.md +0 -0
- /package/skills/{brainpy-state → package-skills/brainpy-state}/references/brainPy(legacy)/analysis.md +0 -0
- /package/skills/{brainpy-state → package-skills/brainpy-state}/references/brainPy(legacy)/brainpy legacy workflow.md +0 -0
- /package/skills/{brainpy-state → package-skills/brainpy-state}/references/brainPy(legacy)/built-in dynamic neuron model.md +0 -0
- /package/skills/{brainpy-state → package-skills/brainpy-state}/references/brainPy(legacy)/connecting neurons.md +0 -0
- /package/skills/{brainpy-state → package-skills/brainpy-state}/references/brainPy(legacy)/customize neuron and synpase.md +0 -0
- /package/skills/{brainpy-state → package-skills/brainpy-state}/references/brainPy(legacy)/infrastructure/Input generation.md +0 -0
- /package/skills/{brainpy-state → package-skills/brainpy-state}/references/brainPy(legacy)/infrastructure/More about simulation.md +0 -0
- /package/skills/{brainpy-state → package-skills/brainpy-state}/references/brainPy(legacy)/infrastructure/Multi-device array sharding.md +0 -0
- /package/skills/{brainpy-state → package-skills/brainpy-state}/references/brainPy(legacy)/infrastructure/Parallel experiment execution.md +0 -0
- /package/skills/{brainpy-state → package-skills/brainpy-state}/references/brainPy(legacy)/infrastructure/array creation and mechanics.md +0 -0
- /package/skills/{brainpy-state → package-skills/brainpy-state}/references/brainPy(legacy)/infrastructure/brainpy math environment setting.md +0 -0
- /package/skills/{brainpy-state → package-skills/brainpy-state}/references/brainPy(legacy)/infrastructure/delays.md +0 -0
- /package/skills/{brainpy-state → package-skills/brainpy-state}/references/brainPy(legacy)/infrastructure/object oriented transformations and control flows.md +0 -0
- /package/skills/{brainpy-state → package-skills/brainpy-state}/references/brainPy(legacy)/integrators.md +0 -0
- /package/skills/{brainpy-state → package-skills/brainpy-state}/references/brainPy(legacy)/route activity through connectivity.md +0 -0
- /package/skills/{brainpy-state → package-skills/brainpy-state}/references/brainPy(legacy)/synaptic projections.md +0 -0
- /package/skills/{brainpy-state → package-skills/brainpy-state}/references/brainPy(legacy)/synpase properties.md +0 -0
- /package/skills/{brainpy-state → package-skills/brainpy-state}/references/brainPy(legacy)/training/loss library.md +0 -0
- /package/skills/{brainpy-state → package-skills/brainpy-state}/references/brainPy(legacy)/training/optimizers.md +0 -0
- /package/skills/{brainpy-state → package-skills/brainpy-state}/references/brainPy(legacy)/training/parameter initializers.md +0 -0
- /package/skills/{brainpy-state → package-skills/brainpy-state}/references/brainPy(legacy)/training/prebuilt neural network layers.md +0 -0
- /package/skills/{brainpy-state → package-skills/brainpy-state}/references/brainPy(legacy)/training/surrogate gradients.md +0 -0
- /package/skills/{brainpy-state → package-skills/brainpy-state}/references/brainPy(legacy)/training/trainer library.md +0 -0
- /package/skills/{brainpy-state → package-skills/brainpy-state}/references/brainPy(legacy)/training/trainingworkflows.md +0 -0
- /package/skills/{brainpy-state → package-skills/brainpy-state}/references/braintools/brainstate-control-flow-patterns.md +0 -0
- /package/skills/{brainpy-state → package-skills/brainpy-state}/references/braintools/data-preprocessing.md +0 -0
- /package/skills/{brainpy-state → package-skills/brainpy-state}/references/braintools/optimizer.md +0 -0
- /package/skills/{brainpy-state → package-skills/brainpy-state}/references/braintools/parameter-initializer.md +0 -0
- /package/skills/{brainpy-state → package-skills/brainpy-state}/references/braintools/surrogate.md +0 -0
- /package/skills/{brainpy-state → package-skills/brainpy-state}/references/component-selection.md +0 -0
- /package/skills/{brainpy-state → package-skills/brainpy-state}/references/nest-compatible/devices.md +0 -0
- /package/skills/{brainpy-state → package-skills/brainpy-state}/references/nest-compatible/divergence-and-parity.md +0 -0
- /package/skills/{brainpy-state → package-skills/brainpy-state}/references/nest-compatible/integration-categories.md +0 -0
- /package/skills/{brainpy-state → package-skills/brainpy-state}/references/nest-compatible/model-library.md +0 -0
- /package/skills/{brainpy-state → package-skills/brainpy-state}/references/nest-compatible/nest-workflow.md +0 -0
- /package/skills/{brainpy-state → package-skills/brainpy-state}/references/nest-compatible/network-building.md +0 -0
- /package/skills/{brainpy-state → package-skills/brainpy-state}/references/nest-compatible/scripts/brette_et_al_2007.py +0 -0
- /package/skills/{brainpy-state → package-skills/brainpy-state}/references/nest-compatible/scripts/brunel_alpha.py +0 -0
- /package/skills/{brainpy-state → package-skills/brainpy-state}/references/nest-compatible/scripts/brunel_delta.py +0 -0
- /package/skills/{brainpy-state → package-skills/brainpy-state}/references/nest-compatible/scripts/clopath_synapse_spike_pairing.py +0 -0
- /package/skills/{brainpy-state → package-skills/brainpy-state}/references/nest-compatible/scripts/evaluate_tsodyks2_synapse.py +0 -0
- /package/skills/{brainpy-state → package-skills/brainpy-state}/references/nest-compatible/scripts/spatial_gaussex.py +0 -0
- /package/skills/{brainpy-state → package-skills/brainpy-state}/references/nest-compatible/scripts/synapsecollection.py +0 -0
- /package/skills/{brainpy-state → package-skills/brainpy-state}/references/nest-compatible/synapse-and-connectivity.md +0 -0
- /package/skills/{brainpy-state → package-skills/brainpy-state}/references/scripts/103_COBA_2005.py +0 -0
- /package/skills/{brainpy-state → package-skills/brainpy-state}/references/scripts/106_COBA_HH_2007.py +0 -0
- /package/skills/{brainpy-state → package-skills/brainpy-state}/references/scripts/107_gamma_oscillation_1996.py +0 -0
- /package/skills/{brainpy-state → package-skills/brainpy-state}/references/scripts/109_fast_global_oscillation.py +0 -0
- /package/skills/{brainpy-state → package-skills/brainpy-state}/references/scripts/201_surrogate_grad_lif_fashion_mnist.py +0 -0
- /package/skills/{brainpy-state → package-skills/brainpy-state}/references/scripts/sound_localization.py +0 -0
- /package/skills/{brainpy-state → package-skills/brainpy-state}/references/scripts/training-snn.py +0 -0
- /package/skills/{brainstate → package-skills/brainstate}/agents/openai.yaml +0 -0
- /package/skills/{brainstate → package-skills/brainstate}/references/brainstate/brainstate-control-flow-patterns.md +0 -0
- /package/skills/{brainstate → package-skills/brainstate}/references/brainstate/parameter-transforms-regularizers-catalog.md +0 -0
- /package/skills/{brainstate → package-skills/brainstate}/references/brainstate/transformation-jit-expansion.md +0 -0
- /package/skills/{brainstate → package-skills/brainstate}/references/collective_model_operations.md +0 -0
- /package/skills/{brainstate → package-skills/brainstate}/references/extension_mechanisms.md +0 -0
- /package/skills/{brainstate → package-skills/brainstate}/references/libraries/prebuilt-activation-library.md +0 -0
- /package/skills/{brainstate → package-skills/brainstate}/references/model-interop-and-migration.md +0 -0
- /package/skills/{brainstate → package-skills/brainstate}/references/simulation-environment.md +0 -0
- /package/skills/{brainstate → package-skills/brainstate}/references/size-inference-variations.md +0 -0
- /package/skills/{brainstate → package-skills/brainstate}/references/state-graph-operations.md +0 -0
- /package/skills/{brainstate → package-skills/brainstate}/references/state_collections_and_utilities.md +0 -0
- /package/skills/{brainstate → package-skills/brainstate}/scripts/integrator_rnn.py +0 -0
- /package/skills/{brainstate → package-skills/brainstate}/scripts/lif_neuron_model.py +0 -0
- /package/skills/{brainstate → package-skills/brainstate}/scripts/modern_cnn.py +0 -0
- /package/skills/{brainstate → package-skills/brainstate}/scripts/resnet.py +0 -0
- /package/skills/{braintrace → package-skills/braintrace}/references/custom ETP primitives.md +0 -0
- /package/skills/{braintrace → package-skills/braintrace}/references/customizing_primitive_transforms.md +0 -0
- /package/skills/{brainunit → package-skills/brainunit}/SKILL.md +0 -0
- /package/skills/{brainunit → package-skills/brainunit}/references/array-creation.md +0 -0
- /package/skills/{brainunit → package-skills/brainunit}/references/array-mechanics/functional-structural-api.md +0 -0
- /package/skills/{brainunit → package-skills/brainunit}/references/array-mechanics.md +0 -0
- /package/skills/{brainunit → package-skills/brainunit}/references/math-function-library.md +0 -0
- /package/skills/{brainunit → package-skills/brainunit}/references/physical-constant-library.md +0 -0
- /package/skills/{brainunit → package-skills/brainunit}/references/prefix-library.md +0 -0
- /package/skills/{brainunit → package-skills/brainunit}/references/quantity-inspection-and-conversion.md +0 -0
- /package/skills/{brainunit → package-skills/brainunit}/references/typing-and-runtime-validation.md +0 -0
- /package/skills/{brainunit → package-skills/brainunit}/references/unit-structure-and-definition.md +0 -0
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
import { spawn } from 'node:child_process';
|
|
4
|
+
import { readFileSync } from 'node:fs';
|
|
5
|
+
import { dirname, resolve } from 'node:path';
|
|
6
|
+
import { createInterface } from 'node:readline';
|
|
7
|
+
import { fileURLToPath } from 'node:url';
|
|
8
|
+
|
|
9
|
+
const serverDirectory = dirname(fileURLToPath(import.meta.url));
|
|
10
|
+
const repositoryRoot = resolve(serverDirectory, '../..');
|
|
11
|
+
const systemPrompt = readFileSync(resolve(serverDirectory, 'system-prompt.md'), 'utf8').trim();
|
|
12
|
+
const skillNames = JSON.parse(
|
|
13
|
+
readFileSync(resolve(serverDirectory, 'skills.json'), 'utf8'),
|
|
14
|
+
);
|
|
15
|
+
|
|
16
|
+
function resolveSkillDirectory(name) {
|
|
17
|
+
const candidates = [
|
|
18
|
+
resolve(repositoryRoot, 'skills', name),
|
|
19
|
+
resolve(repositoryRoot, 'skills', 'package-skills', name),
|
|
20
|
+
];
|
|
21
|
+
for (const candidate of candidates) {
|
|
22
|
+
try {
|
|
23
|
+
readFileSync(resolve(candidate, 'SKILL.md'));
|
|
24
|
+
return candidate;
|
|
25
|
+
} catch {
|
|
26
|
+
// Try the next supported repository layout.
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
throw new Error(`Configured BrainX reviewer skill is missing: ${name}`);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
const exposedSkills = skillNames.map((name) => ({
|
|
33
|
+
path: resolveSkillDirectory(name),
|
|
34
|
+
enabled: true,
|
|
35
|
+
}));
|
|
36
|
+
|
|
37
|
+
const reviewReferences = {
|
|
38
|
+
training: resolve(
|
|
39
|
+
repositoryRoot,
|
|
40
|
+
'skills/brainx-modeling-loop/references/training-workflow.md',
|
|
41
|
+
),
|
|
42
|
+
fitting: resolve(
|
|
43
|
+
repositoryRoot,
|
|
44
|
+
'skills/brainx-modeling-loop/references/parameter-fitting-workflow.md',
|
|
45
|
+
),
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
for (const [name, path] of Object.entries(reviewReferences)) {
|
|
49
|
+
try {
|
|
50
|
+
readFileSync(path);
|
|
51
|
+
} catch {
|
|
52
|
+
throw new Error(`Configured BrainX ${name} review reference is missing: ${path}`);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
const skillInstructions = [
|
|
57
|
+
'Use only the BrainX skills listed below as domain guidance for this review.',
|
|
58
|
+
'Open a skill only when its scope participates in the supplied model or evidence.',
|
|
59
|
+
'Do not invoke workflow behavior from these skills; use them to verify BrainX APIs and invariants.',
|
|
60
|
+
...skillNames.map((name) => `- ${name}`),
|
|
61
|
+
`TRAINING_REVIEW_REFERENCE: ${reviewReferences.training}`,
|
|
62
|
+
`FITTING_REVIEW_REFERENCE: ${reviewReferences.fitting}`,
|
|
63
|
+
].join('\n');
|
|
64
|
+
|
|
65
|
+
function transformMessage(message) {
|
|
66
|
+
if (Array.isArray(message)) {
|
|
67
|
+
return message.map(transformMessage);
|
|
68
|
+
}
|
|
69
|
+
if (
|
|
70
|
+
message === null
|
|
71
|
+
|| typeof message !== 'object'
|
|
72
|
+
|| message.method !== 'tools/call'
|
|
73
|
+
|| message.params?.name !== 'codex'
|
|
74
|
+
) {
|
|
75
|
+
return message;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
const originalArguments = message.params.arguments;
|
|
79
|
+
const args = originalArguments && typeof originalArguments === 'object'
|
|
80
|
+
? { ...originalArguments }
|
|
81
|
+
: {};
|
|
82
|
+
const config = args.config && typeof args.config === 'object'
|
|
83
|
+
? { ...args.config }
|
|
84
|
+
: {};
|
|
85
|
+
|
|
86
|
+
config['skills.config'] = exposedSkills;
|
|
87
|
+
|
|
88
|
+
return {
|
|
89
|
+
...message,
|
|
90
|
+
params: {
|
|
91
|
+
...message.params,
|
|
92
|
+
arguments: {
|
|
93
|
+
...args,
|
|
94
|
+
config,
|
|
95
|
+
'approval-policy': 'never',
|
|
96
|
+
'base-instructions': systemPrompt,
|
|
97
|
+
'developer-instructions': skillInstructions,
|
|
98
|
+
sandbox: 'read-only',
|
|
99
|
+
},
|
|
100
|
+
},
|
|
101
|
+
};
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
const codexBinary = process.env.BRAINX_CODEX_BIN || 'codex';
|
|
105
|
+
const child = spawn(codexBinary, ['mcp-server'], {
|
|
106
|
+
env: process.env,
|
|
107
|
+
stdio: ['pipe', 'pipe', 'inherit'],
|
|
108
|
+
});
|
|
109
|
+
|
|
110
|
+
child.on('error', (error) => {
|
|
111
|
+
process.stderr.write(`Failed to start ${codexBinary} mcp-server: ${error.message}\n`);
|
|
112
|
+
process.exitCode = 1;
|
|
113
|
+
});
|
|
114
|
+
child.stdin.on('error', (error) => {
|
|
115
|
+
if (error.code !== 'EPIPE') {
|
|
116
|
+
process.stderr.write(`Codex MCP stdin failed: ${error.message}\n`);
|
|
117
|
+
}
|
|
118
|
+
});
|
|
119
|
+
|
|
120
|
+
child.stdout.pipe(process.stdout);
|
|
121
|
+
|
|
122
|
+
const input = createInterface({ input: process.stdin, crlfDelay: Infinity });
|
|
123
|
+
input.on('line', (line) => {
|
|
124
|
+
try {
|
|
125
|
+
const message = JSON.parse(line);
|
|
126
|
+
const transformed = transformMessage(message);
|
|
127
|
+
child.stdin.write(`${JSON.stringify(transformed)}\n`);
|
|
128
|
+
} catch {
|
|
129
|
+
child.stdin.write(`${line}\n`);
|
|
130
|
+
}
|
|
131
|
+
});
|
|
132
|
+
input.on('close', () => child.stdin.end());
|
|
133
|
+
|
|
134
|
+
for (const signal of ['SIGINT', 'SIGTERM']) {
|
|
135
|
+
process.on(signal, () => child.kill(signal));
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
child.on('exit', (code, signal) => {
|
|
139
|
+
input.close();
|
|
140
|
+
process.stdin.pause();
|
|
141
|
+
process.exitCode = code ?? (signal ? 1 : 0);
|
|
142
|
+
});
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
You are an independent computational-neuroscience quality reviewer for completed BrainX modeling iterations.
|
|
2
|
+
|
|
3
|
+
Do not edit files or search literature. Inspect the supplied locked specification, BrainX code, tests, raw run artifacts, and deterministic result assessment. Decide whether the completed iteration is scientifically supported and implemented with the simplest suitable BrainX abstractions under `NeuroSpecification.md`.
|
|
4
|
+
|
|
5
|
+
Before reviewing code or results:
|
|
6
|
+
|
|
7
|
+
1. Open and read `brainx-general-guard` first.
|
|
8
|
+
2. When `ACTIVE_COVERAGE` includes training, open the exact `TRAINING_REVIEW_REFERENCE` path injected in the developer instructions. When it includes fitting, open the exact `FITTING_REVIEW_REFERENCE` path. Also open the selected model skill's routed BrainTools metric, optimizer, initializer, preprocessing, and surrogate references when they affect the objective or optimization. Open BrainState's prebuilt-layer, activation, parameter-constraint, gradient, and State-lifecycle references when they affect architecture, trainability, or convergence.
|
|
9
|
+
3. Apply the selected skills and references as review criteria. Do not invoke their implementation workflows or modify the iteration.
|
|
10
|
+
|
|
11
|
+
Center the review on three questions:
|
|
12
|
+
|
|
13
|
+
## 1. Is the result scientifically backed?
|
|
14
|
+
|
|
15
|
+
Require the exact scoped claim to follow from the locked specification and raw evidence.
|
|
16
|
+
|
|
17
|
+
- Verify the model, units, State lifecycle, numerical method, inputs, controls, observation mapping, metrics, uncertainty, and seeds implement the declared biological abstraction and protocol.
|
|
18
|
+
- For training or fitting, verify targets, splits, parameters, bounds or priors, objective, gradients, resets, selection, recovery, identifiability, and held-out prediction as applicable.
|
|
19
|
+
- Confirm acceleration preserves behavior and reported results include unfavorable evidence, provenance, and controls that distinguish the claim from alternatives. Record unsupported external assumptions; do not invent support.
|
|
20
|
+
|
|
21
|
+
## 2. Is the code minimal and BrainX-native?
|
|
22
|
+
|
|
23
|
+
Require the smallest clear implementation built on the highest-level suitable BrainX API.
|
|
24
|
+
|
|
25
|
+
- Prefer the owning modeling package's orchestrators, models, simulators, fitters, monitors, and visualization APIs; use lower-level BrainX infrastructure or generic numerical libraries only at uncovered boundaries.
|
|
26
|
+
- Flag manual loops, array manipulation, State bookkeeping, integration, optimization, or plotting scaffolding when a selected reference establishes a simpler API. Name that verified replacement; do not invent APIs.
|
|
27
|
+
- When generic optimization, metrics, input generation, integration, encoding, or other infrastructure replaces a BrainTools-owned operation, require the iteration's `BrainTools API gap` artifact to name the checked APIs, exact missing capability, smallest external boundary, and unit, State, shape, and numerical parity evidence. An unavailable optional backend does not justify bypassing another suitable routed BrainTools API. Return `REFUSE` when this evidence is absent.
|
|
28
|
+
- Preserve scientific meaning, units, reproducibility, performance, and figure quality. Keep plotting code minimal and clean: prefer package visualization, then BrainTools, then one basic `matplotlib.pyplot.subplots(...)` composition.
|
|
29
|
+
|
|
30
|
+
## 3. Is training or fitting good enough?
|
|
31
|
+
|
|
32
|
+
Apply this section whenever `ACTIVE_COVERAGE` is `training`, `fitting`, or `training+fitting`. Audit the optimization problem before accepting either success or failure.
|
|
33
|
+
|
|
34
|
+
- **Loss closure:** Decide whether the objective reaches a justified attainable floor, not necessarily zero. Inspect component-wise train, validation, and held-out curves against initialization, a simple baseline, the best checkpoint, and when applicable tiny-subset overfit, exact-pipeline recovery, a noise floor, or a known optimum. Distinguish true convergence from budget limits, unstable or missing gradients, boundary saturation, flat directions, stochastic variance, and insufficient capacity.
|
|
35
|
+
- **Architecture:** Verify representations, temporal reduction, recurrence, readout, activation or surrogate, normalization, regularization, sharing, connectivity, and State reset match the scientific task. Check BrainState's prebuilt `brainstate.nn` layers before accepting custom machinery. Use closure and controlled ablations to distinguish architecture failure from optimization failure or overfitting.
|
|
36
|
+
- **Hyperparameters and method:** Audit optimizer or estimator, learning rate or search scale, schedule cadence, batch or candidate count, sequence handling, clipping, regularization, initialization, surrogate settings, starts, seeds, bounds or transforms, budget, stopping, and selection. Prefer `braintools.optim.Adam` or `SGD` as gradient baselines, package-owned fitters such as `brainmass.Fitter`, valid gradients before derivative-free fitting, and bounded `ScipyOptimizer` or `NevergradOptimizer` only at their documented boundary.
|
|
37
|
+
- Ground each recommendation in a verified owning-package, BrainState, or BrainTools API; explain the observed failure it addresses and propose the smallest one-change comparison. Do not recommend changing architecture, objective, preprocessing, and optimizer together.
|
|
38
|
+
|
|
39
|
+
Return `REFUSE` when optimization adequacy is required for the scoped outcome but loss closure, architecture adequacy, or method adequacy remains unsupported. A scientifically valid negative or inconclusive result may still pass when the attainable gap is explained and the optimization audit rules out a correctable in-spec failure.
|
|
40
|
+
|
|
41
|
+
Good enough means valid and sufficient for the scoped outcome. It does not mean positive, novel, or publishable. Accept a rigorous refutation or bounded inconclusive result when its evidence is sufficient.
|
|
42
|
+
|
|
43
|
+
Return a Markdown document as the tool response. Do not write the report to the filesystem, wrap the document in a code fence, or add text before its title. Use exactly this structure:
|
|
44
|
+
|
|
45
|
+
# BrainX iteration review
|
|
46
|
+
|
|
47
|
+
- **OUTCOME:** `PASS | REFUSE`
|
|
48
|
+
- **SCIENTIFIC_OUTCOME:** `SUPPORTED | PARTIALLY_SUPPORTED | REFUTED | INCONCLUSIVE | INVALID`
|
|
49
|
+
- **LOSS_CLOSURE:** `NOT_APPLICABLE | CLOSED | EXPLAINED_GAP | OPEN | UNRESOLVED`
|
|
50
|
+
- **OPTIMIZATION_ADEQUACY:** `NOT_APPLICABLE | SUFFICIENT | INSUFFICIENT | UNRESOLVED`
|
|
51
|
+
- **NEXT_ACTION:** `ADVANCE_TO_VISUALIZATION | RETURN_TO_STUDY`
|
|
52
|
+
|
|
53
|
+
## Good-enough reason
|
|
54
|
+
|
|
55
|
+
One concise evidence-based explanation.
|
|
56
|
+
|
|
57
|
+
## Findings
|
|
58
|
+
|
|
59
|
+
Use one subsection per finding, or write `None.` when there are no findings.
|
|
60
|
+
|
|
61
|
+
### <stable ID>: <short title>
|
|
62
|
+
|
|
63
|
+
- **Severity:** `critical | major | minor`
|
|
64
|
+
- **Location:** file and line or artifact path
|
|
65
|
+
- **Problem:** concrete defect
|
|
66
|
+
- **Scientific consequence:** how it affects validity or interpretation
|
|
67
|
+
- **Minimum fix:** smallest sufficient correction or experiment
|
|
68
|
+
|
|
69
|
+
## Unverified assumptions
|
|
70
|
+
|
|
71
|
+
- Assumption and why available artifacts cannot resolve it, or `None.`
|
|
72
|
+
|
|
73
|
+
Return `PASS` only when the iteration is valid and sufficient for its scoped scientific outcome. Return `REFUSE` when a correction, additional in-spec experiment, researcher decision, or unresolved capability is required. Do not return a numeric quality score. Do not manufacture findings when the supplied evidence is correct.
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import assert from 'node:assert/strict';
|
|
2
|
+
import { chmodSync } from 'node:fs';
|
|
3
|
+
import { dirname, resolve } from 'node:path';
|
|
4
|
+
import { fileURLToPath } from 'node:url';
|
|
5
|
+
import test from 'node:test';
|
|
6
|
+
import { spawn } from 'node:child_process';
|
|
7
|
+
|
|
8
|
+
const testDirectory = dirname(fileURLToPath(import.meta.url));
|
|
9
|
+
const server = resolve(testDirectory, '..', 'server.mjs');
|
|
10
|
+
const fakeCodex = resolve(testDirectory, 'fixtures', 'fake-codex.mjs');
|
|
11
|
+
chmodSync(fakeCodex, 0o755);
|
|
12
|
+
|
|
13
|
+
function runProxy(messages) {
|
|
14
|
+
return new Promise((resolveOutput, reject) => {
|
|
15
|
+
const child = spawn(process.execPath, [server], {
|
|
16
|
+
env: { ...process.env, BRAINX_CODEX_BIN: fakeCodex },
|
|
17
|
+
stdio: ['pipe', 'pipe', 'pipe'],
|
|
18
|
+
});
|
|
19
|
+
let stdout = '';
|
|
20
|
+
let stderr = '';
|
|
21
|
+
child.stdout.on('data', (chunk) => { stdout += chunk; });
|
|
22
|
+
child.stderr.on('data', (chunk) => { stderr += chunk; });
|
|
23
|
+
child.on('error', reject);
|
|
24
|
+
child.on('exit', (code) => {
|
|
25
|
+
if (code !== 0) {
|
|
26
|
+
reject(new Error(`proxy exited ${code}: ${stderr}`));
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
resolveOutput(stdout.trimEnd().split('\n').map((line) => JSON.parse(line)));
|
|
30
|
+
});
|
|
31
|
+
for (const message of messages) {
|
|
32
|
+
child.stdin.write(`${JSON.stringify(message)}\n`);
|
|
33
|
+
}
|
|
34
|
+
child.stdin.end();
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
test('injects the reviewer prompt and configured BrainX skills into fresh sessions', async () => {
|
|
39
|
+
const [message] = await runProxy([{
|
|
40
|
+
jsonrpc: '2.0',
|
|
41
|
+
id: 1,
|
|
42
|
+
method: 'tools/call',
|
|
43
|
+
params: {
|
|
44
|
+
name: 'codex',
|
|
45
|
+
arguments: {
|
|
46
|
+
prompt: 'Review iteration 4',
|
|
47
|
+
'approval-policy': 'on-request',
|
|
48
|
+
sandbox: 'danger-full-access',
|
|
49
|
+
config: { model_reasoning_effort: 'xhigh' },
|
|
50
|
+
},
|
|
51
|
+
},
|
|
52
|
+
}]);
|
|
53
|
+
|
|
54
|
+
const args = message.params.arguments;
|
|
55
|
+
assert.match(args['base-instructions'], /independent computational-neuroscience/);
|
|
56
|
+
assert.match(args['base-instructions'], /Open and read `brainx-general-guard` first/);
|
|
57
|
+
assert.match(args['base-instructions'], /Is the result scientifically backed/);
|
|
58
|
+
assert.match(args['base-instructions'], /Is the code minimal and BrainX-native/);
|
|
59
|
+
assert.match(args['base-instructions'], /Is training or fitting good enough/);
|
|
60
|
+
assert.match(args['base-instructions'], /\*\*Loss closure:\*\*/);
|
|
61
|
+
assert.match(args['base-instructions'], /\*\*Architecture:\*\*/);
|
|
62
|
+
assert.match(args['base-instructions'], /\*\*Hyperparameters and method:\*\*/);
|
|
63
|
+
assert.match(args['base-instructions'], /BrainState's prebuilt `brainstate\.nn` layers/);
|
|
64
|
+
assert.match(args['base-instructions'], /braintools\.optim\.Adam/);
|
|
65
|
+
assert.match(args['base-instructions'], /BrainTools API gap/);
|
|
66
|
+
assert.match(args['base-instructions'], /RETURN_TO_STUDY/);
|
|
67
|
+
assert.match(args['base-instructions'], /Return a Markdown document as the tool response/);
|
|
68
|
+
assert.match(args['base-instructions'], /# BrainX iteration review/);
|
|
69
|
+
assert.match(args['base-instructions'], /- \*\*OUTCOME:\*\* `PASS \| REFUSE`/);
|
|
70
|
+
assert.match(args['base-instructions'], /- \*\*LOSS_CLOSURE:\*\* `NOT_APPLICABLE/);
|
|
71
|
+
assert.match(args['base-instructions'], /## Findings/);
|
|
72
|
+
assert.doesNotMatch(args['base-instructions'], /```text\s+OUTCOME:/);
|
|
73
|
+
assert.match(args['base-instructions'], /Keep plotting code minimal and clean/);
|
|
74
|
+
assert.match(args['developer-instructions'], /brainx-general-guard/);
|
|
75
|
+
assert.match(args['developer-instructions'], /TRAINING_REVIEW_REFERENCE: \/.*\/training-workflow\.md/);
|
|
76
|
+
assert.match(args['developer-instructions'], /FITTING_REVIEW_REFERENCE: \/.*\/parameter-fitting-workflow\.md/);
|
|
77
|
+
assert.doesNotMatch(args['developer-instructions'], /^- brainx-modeling-loop$/m);
|
|
78
|
+
assert.equal(args.config.model_reasoning_effort, 'xhigh');
|
|
79
|
+
assert.equal(args['approval-policy'], 'never');
|
|
80
|
+
assert.equal(args.sandbox, 'read-only');
|
|
81
|
+
assert.equal(args.config['skills.config'].length, 8);
|
|
82
|
+
assert.ok(args.config['skills.config'].every((skill) => skill.enabled));
|
|
83
|
+
assert.ok(args.config['skills.config'].every((skill) => skill.path.startsWith('/')));
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
test('passes continuation and unrelated MCP messages through unchanged', async () => {
|
|
87
|
+
const reply = {
|
|
88
|
+
jsonrpc: '2.0',
|
|
89
|
+
id: 2,
|
|
90
|
+
method: 'tools/call',
|
|
91
|
+
params: {
|
|
92
|
+
name: 'codex-reply',
|
|
93
|
+
arguments: { threadId: 'thread-1', prompt: 'Recheck finding BX-2' },
|
|
94
|
+
},
|
|
95
|
+
};
|
|
96
|
+
const list = { jsonrpc: '2.0', id: 3, method: 'tools/list', params: {} };
|
|
97
|
+
|
|
98
|
+
assert.deepEqual(await runProxy([reply, list]), [reply, list]);
|
|
99
|
+
});
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
# Full-text resolver MCP
|
|
2
|
+
|
|
3
|
+
This stdio MCP resolves biology and neuroscience papers to the best accessible full-text version without duplicating general literature search.
|
|
4
|
+
|
|
5
|
+
Source priority is:
|
|
6
|
+
|
|
7
|
+
```text
|
|
8
|
+
published PMC or publisher OA
|
|
9
|
+
accepted repository manuscript
|
|
10
|
+
submitted bioRxiv/medRxiv or repository preprint
|
|
11
|
+
unresolved
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
Every result preserves the requested work separately from the retrieved document. A preprint is never labeled as the final journal article.
|
|
15
|
+
|
|
16
|
+
## Tools
|
|
17
|
+
|
|
18
|
+
| Tool | Use |
|
|
19
|
+
|---|---|
|
|
20
|
+
| `resolve_fulltext` | Resolve the best accessible version and return provenance without downloading the document. |
|
|
21
|
+
| `get_fulltext` | Retrieve JATS or HTML as Markdown. Preserve PDF-only versions as source links. |
|
|
22
|
+
| `list_versions` | List every known accessible published, accepted, and submitted version. |
|
|
23
|
+
|
|
24
|
+
All tools accept any useful combination of `doi`, `pmid`, `pmcid`, `title`, `authors`, and `year`. Prefer DOI. Title resolution requires a normalized exact title match; the resolver does not confirm relationships from title similarity alone.
|
|
25
|
+
|
|
26
|
+
`get_fulltext` also accepts:
|
|
27
|
+
|
|
28
|
+
| Input | Meaning |
|
|
29
|
+
|---|---|
|
|
30
|
+
| `version` | Restrict retrieval to `publishedVersion`, `acceptedVersion`, `submittedVersion`, or `unknown`. |
|
|
31
|
+
| `source` | Restrict retrieval to `PMC`, `OpenAlex`, `bioRxiv`, or `medRxiv`. |
|
|
32
|
+
| `include_raw` | Include retrieved JATS or HTML in `structuredContent`. Defaults to `false`. |
|
|
33
|
+
| `max_chars` | Optionally truncate returned Markdown. Omit for the complete converted document. |
|
|
34
|
+
|
|
35
|
+
## Install and register
|
|
36
|
+
|
|
37
|
+
Install this resolver together with Europe PMC search and the BrainX Codex reviewer:
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
npx brainx-skill mcp install
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
The installer creates a durable runtime under `~/.brainx/mcp`, registers the resolver as `fulltext_resolver`, and refuses to overwrite an existing user-owned registration. Restart Codex or reload MCP configuration after installation. Use `npx brainx-skill mcp remove` to remove the managed registrations and runtime.
|
|
44
|
+
|
|
45
|
+
For repository development, install dependencies and start the stdio server directly:
|
|
46
|
+
|
|
47
|
+
```bash
|
|
48
|
+
npm install
|
|
49
|
+
node mcp-servers/fulltext-resolver/server.mjs
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
The second command waits for an MCP client and does not print protocol data to stderr during normal startup.
|
|
53
|
+
|
|
54
|
+
For manual Codex registration, add the server to `~/.codex/config.toml`, or to `.codex/config.toml` in a trusted project:
|
|
55
|
+
|
|
56
|
+
```toml
|
|
57
|
+
[mcp_servers.fulltext_resolver]
|
|
58
|
+
command = "node"
|
|
59
|
+
args = ["/absolute/path/to/brainx-skill-bundle/mcp-servers/fulltext-resolver/server.mjs"]
|
|
60
|
+
startup_timeout_sec = 20
|
|
61
|
+
tool_timeout_sec = 120
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
Optional environment configuration:
|
|
65
|
+
|
|
66
|
+
```toml
|
|
67
|
+
[mcp_servers.fulltext_resolver.env]
|
|
68
|
+
OPENALEX_MAILTO = "researcher@example.edu"
|
|
69
|
+
OPENALEX_API_KEY = "optional-key"
|
|
70
|
+
FULLTEXT_RESOLVER_USER_AGENT = "lab-fulltext-resolver/1.0 (mailto:researcher@example.edu)"
|
|
71
|
+
FULLTEXT_HTTP_TIMEOUT_MS = "30000"
|
|
72
|
+
FULLTEXT_MAX_BYTES = "8000000"
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
OpenAlex works anonymously by default. Europe PMC and the bioRxiv/medRxiv metadata and publication-crosswalk APIs require no key. No paid publisher API or AWS credential is required.
|
|
76
|
+
|
|
77
|
+
## Example calls
|
|
78
|
+
|
|
79
|
+
Resolve by DOI:
|
|
80
|
+
|
|
81
|
+
```json
|
|
82
|
+
{
|
|
83
|
+
"doi": "10.1038/s41586-020-2649-2"
|
|
84
|
+
}
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
Retrieve a known preprint version of a journal paper:
|
|
88
|
+
|
|
89
|
+
```json
|
|
90
|
+
{
|
|
91
|
+
"doi": "10.1371/journal.pone.0256482",
|
|
92
|
+
"source": "medRxiv"
|
|
93
|
+
}
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
A successful result identifies at least:
|
|
97
|
+
|
|
98
|
+
```text
|
|
99
|
+
requested DOI
|
|
100
|
+
retrieved DOI or identifier
|
|
101
|
+
source
|
|
102
|
+
version
|
|
103
|
+
relationship
|
|
104
|
+
license when known
|
|
105
|
+
source location
|
|
106
|
+
original format
|
|
107
|
+
normalized format
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
## Retrieval behavior
|
|
111
|
+
|
|
112
|
+
- PMC: fetch Europe PMC JATS and convert the article body, abstract, figures, tables, and references to Markdown.
|
|
113
|
+
- OpenAlex: inspect `best_oa_location`, `primary_location`, and `locations[]`; preserve each location's version and license.
|
|
114
|
+
- bioRxiv/medRxiv: query the official published-DOI crosswalk, fetch the latest preprint revision, and prefer its JATS URL.
|
|
115
|
+
- HTML repositories: extract the main article container and convert it to Markdown.
|
|
116
|
+
- PDFs: return the accessible PDF URL and provenance. PDF parsing is an explicit v1 non-goal.
|
|
117
|
+
|
|
118
|
+
Source outages are isolated. A Europe PMC, OpenAlex, or bioRxiv failure is recorded in `source_errors` and does not prevent another source from resolving the work.
|
|
119
|
+
|
|
120
|
+
## Security and correctness boundaries
|
|
121
|
+
|
|
122
|
+
- The resolver follows only public HTTP(S) URLs and rejects localhost and private literal IP addresses.
|
|
123
|
+
- It does not authenticate to institutions, bypass paywalls, automate browser logins, or call publisher-specific APIs.
|
|
124
|
+
- It does not fabricate content when retrieval fails.
|
|
125
|
+
- OpenAlex repository locations can point to landing pages rather than direct manuscripts. `get_fulltext` reports a fetch failure and tries the next ranked version when the page cannot yield article text.
|
|
126
|
+
- Raw JATS/HTML is returned only when `include_raw=true`.
|
|
127
|
+
|
|
128
|
+
## Test
|
|
129
|
+
|
|
130
|
+
```bash
|
|
131
|
+
node --test mcp-servers/fulltext-resolver/test/*.test.mjs
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
The default tests use fixtures and mocked source clients. Live smoke checks are intentionally separate from the deterministic suite.
|
|
135
|
+
|
|
136
|
+
See `REUSE.md` for the reuse audit and `THIRD_PARTY_NOTICES.md` for attribution.
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# Reuse audit
|
|
2
|
+
|
|
3
|
+
Audit completed on September 4, 2026. Forks were created under `Wilsonnijc-bot` before implementation.
|
|
4
|
+
|
|
5
|
+
| Component | Source repository and audited revision | Reused files or modules | License | Changes required |
|
|
6
|
+
|---|---|---|---|---|
|
|
7
|
+
| Europe PMC metadata and JATS retrieval | `CoChatAI/europepmc-mcp-server` at `a1af9d06ec7f5f2caef56005fdc1d9d4f12cb115`; fork `Wilsonnijc-bot/europepmc-mcp-server` | `server.py`: REST base URL, search contract, full-text XML endpoint, timeout and user-agent behavior | MIT | Adapted to a Node source adapter; retained only lookup and JATS retrieval needed by the resolver. Added accepted-manuscript detection and normalized provenance. |
|
|
8
|
+
| OpenAlex DOI and title resolution | `DeyangLiu123/openalex-mcp` at `e139b22ced22e0b724ad84ce43bacb470017161a`; fork `Wilsonnijc-bot/openalex-mcp` | `ids.py`: DOI normalization, conservative exact-title matching, identifier parsing; `formats.py`: OA location access patterns | MIT | Ported pure normalization and conservative matching behavior to Node. Removed search/harvesting and paid content-download functionality. |
|
|
9
|
+
| OpenAlex transport and location fields | `cyanheads/openalex-mcp-server` at `513f1158f03bd1dda4a180941c75d7506e6723c5`; fork `Wilsonnijc-bot/openalex-mcp-server` | `openalex-service.ts`, `types.ts`, `server-config.ts`, `field-catalog.json`: anonymous/keyed configuration, retries, `best_oa_location`, `primary_location`, `locations[]`, `version`, license, and URL fields | Apache-2.0 | Adapted the works-only subset to Node 18 and the official MCP SDK. Kept API key and `mailto` optional. Did not use the paid OpenAlex content endpoint. |
|
|
10
|
+
| bioRxiv/medRxiv crosswalk and full text | `cyanheads/biorxiv-mcp-server` at `2b406943815192328481797332cc706b386887ff`; fork `Wilsonnijc-bot/biorxiv-mcp-server` | `biorxiv-service.ts`, `biorxiv-fulltext-service.ts`, `types.ts`, `shared.ts`: `/pubs`, `/details`, revision selection, JATS/HTML URLs, markup cleanup, retries and error isolation | Apache-2.0 | Added the official reverse lookup from published DOI to preprint DOI, selected the latest revision, and normalized the result into the common provenance model. Removed framework-specific storage and transport dependencies. |
|
|
11
|
+
| JATS conversion fallback | `yogsoth-ai/biorxiv-mcp` at `c17747a4a635003d692d4e05b6eda093536908dd`; fork `Wilsonnijc-bot/biorxiv-mcp` | `convert.py`: JATS-first conversion and degraded text fallback; `fetch.py`: structured-source preference | Apache-2.0 | Reimplemented the converter in Node with `linkedom`, preserving structured abstract, sections, figure captions, tables, and references. The AWS requester-pays MECA backend remains optional and is not required in v1. |
|
|
12
|
+
| MCP stdio server | Official `@modelcontextprotocol/sdk` package, version range `^1.30.0` | `McpServer`, `StdioServerTransport`, Zod input validation, tool annotations | MIT | Registered only `resolve_fulltext`, `get_fulltext`, and `list_versions`; no custom JSON-RPC transport was written. |
|
|
13
|
+
|
|
14
|
+
## Selection decision
|
|
15
|
+
|
|
16
|
+
Use Node.js because the host repository already requires Node 18 and the richest reusable bioRxiv implementation is TypeScript. This avoids requiring Python, Pandoc, FastMCP, Bun, Node 24, AWS, or a second environment for the default resolver.
|
|
17
|
+
|
|
18
|
+
The upstream MCP servers were not vendored whole because they expose broad search and analysis interfaces outside this resolver's boundary. The implementation adapts only the source-client, normalization, retry, conversion, and provenance behavior needed by the three public tools.
|
|
19
|
+
|
|
20
|
+
## Reuse boundary
|
|
21
|
+
|
|
22
|
+
New code is limited to:
|
|
23
|
+
|
|
24
|
+
```text
|
|
25
|
+
common resolver orchestration
|
|
26
|
+
normalized version/provenance model
|
|
27
|
+
source ranking and fallback
|
|
28
|
+
MCP tool composition
|
|
29
|
+
end-to-end tests
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
No Nature, Cell Press, Neuron, PNAS, arXiv, Crossref, Unpaywall, CORE, Semantic Scholar, or paywall-specific client was added.
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
# Third-party notices
|
|
2
|
+
|
|
3
|
+
This resolver adapts behavior and selected source code from the projects listed in `REUSE.md`.
|
|
4
|
+
|
|
5
|
+
## CoChatAI Europe PMC MCP server
|
|
6
|
+
|
|
7
|
+
MIT License
|
|
8
|
+
|
|
9
|
+
Copyright (c) 2026 CoChat AI
|
|
10
|
+
|
|
11
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
12
|
+
|
|
13
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
16
|
+
|
|
17
|
+
## DeyangLiu123 OpenAlex MCP
|
|
18
|
+
|
|
19
|
+
MIT License
|
|
20
|
+
|
|
21
|
+
Copyright (c) 2026 DeyangLiu123
|
|
22
|
+
|
|
23
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
24
|
+
|
|
25
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
26
|
+
|
|
27
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
28
|
+
|
|
29
|
+
## cyanheads OpenAlex and bioRxiv MCP servers
|
|
30
|
+
|
|
31
|
+
Copyright (c) Casey Hand and contributors.
|
|
32
|
+
|
|
33
|
+
Licensed under the Apache License, Version 2.0. The repository root `LICENSE` contains the applicable license terms. Adapted files in this resolver carry modification notices.
|
|
34
|
+
|
|
35
|
+
Source projects:
|
|
36
|
+
|
|
37
|
+
```text
|
|
38
|
+
cyanheads/openalex-mcp-server
|
|
39
|
+
cyanheads/biorxiv-mcp-server
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
## yogsoth-ai bioRxiv MCP
|
|
43
|
+
|
|
44
|
+
Copyright (c) yogsoth-ai and contributors.
|
|
45
|
+
|
|
46
|
+
Licensed under the Apache License, Version 2.0. The repository root `LICENSE` contains the applicable license terms. Adapted files in this resolver carry modification notices.
|
|
47
|
+
|
|
48
|
+
## Runtime libraries
|
|
49
|
+
|
|
50
|
+
The resolver uses the following packages under their published licenses:
|
|
51
|
+
|
|
52
|
+
```text
|
|
53
|
+
@modelcontextprotocol/sdk
|
|
54
|
+
linkedom
|
|
55
|
+
turndown
|
|
56
|
+
zod
|
|
57
|
+
```
|