Skip to main content
Glama

πŸ”₯ Neurosymbolic Forge (NSForge)

Turn concepts into verifiable, traceable formulas. NSForge is an MCP server that forges new formulas through deterministic, provenance-tracked derivation β€” the AI orchestrates, tools reify.

License Python MCP Tools Harness

🌐 English | 繁體中文


πŸ’‘ Why NSForge?

LLMs are great at understanding and planning, but doing symbolic math by hand makes them hallucinate, contradict themselves, and produce unverifiable results. NSForge draws a clean line:

The LLM does…

NSForge does…

Understand the question

Precise symbolic computation

Plan the derivation

Track every step's provenance

Explain the result

Verify (dimensions, boundary, equivalence)

β€”

Store the formula, generate code

North star: every symbol, equation, value, and line of code in a result has a tool call as its birth certificate. The amount the AI computes by hand approaches zero.

NSForge is NOT a formula database β€” it's a derivation factory. Formulas are inputs (from SymPy‑MCP, Wikidata, BioModels, you); the operators (compose Β· substitute Β· solve Β· verify Β· prove) are the product.


Related MCP server: Desmos MCP Server

πŸͺœ The Reification Ladder

The core idea: climb from a fuzzy concept to executable, provenance-bound code, one deterministic rung at a time.

flowchart LR
    C["πŸ’­ CONCEPT<br/>a goal"] --> S["πŸ”€ SYMBOL<br/>typed + units"]
    S --> D["🧩 DERIVATION<br/>composed"]
    D --> V{"βœ… verify"}
    V -->|"fails"| D
    V -->|"passes"| A["βš™οΈ ALGORITHM<br/>code"]
    A -. "emitted only if ledger complete" .-> L[["πŸ“’ provenance ledger"]]
    C -.-> L
    S -.-> L
    D -.-> L

πŸ“– Deep dive: Reification-ladder direction Β· General-formula-exploration roadmap


🌍 Ecosystem: don't reinvent the wheel

NSForge works with other MCP servers, not against them.

flowchart TB
    subgraph SY["πŸ”’ sympy-mcp Β· 32 tools"]
        direction LR
        SY1["Base formulas: F=ma, PV=nRT, Arrhenius"]
        SY2["Constants Β· ODE / PDE / matrices"]
    end
    subgraph NS["πŸ”¨ nsforge-mcp Β· 91 tools β€” YOU ARE HERE"]
        direction LR
        NS1["Derivation framework<br/>compose Β· verify Β· code"]
        NS2["Provenance repository"]
        NS3["Formula search<br/>Wikidata Β· BioModels Β· SciPy"]
    end
    subgraph US["🎯 usolver-mcp · optional"]
        US1["Z3 Β· OR-Tools Β· CVXPY Β· HiGHS"]
    end
    SY -->|"base formulas"| NS
    NS -->|"prepared model"| US
    NS -->|"stores CREATED formulas"| REPO[("formulas/derivations")]

βœ… Belongs in NSForge

❌ Use another tool

Temperature-corrected drug elimination

Basic physics formulas β†’ sympy-mcp

Body-fat-adjusted volume of distribution

Physical constants β†’ sympy-mcp

Renal-function dose adjustments

Clinical scores β†’ medical-calc-mcp

Custom composite PK/PD models

Textbook formulas β†’ references


πŸ“¦ Installation

Requirements: Python 3.12+ and uv (recommended).

uv add nsforge-mcp          # or: pip install nsforge-mcp
git clone https://github.com/u9401066/nsforge-mcp.git
cd nsforge-mcp
uv sync --all-extras
uv run python -c "import nsforge; print(nsforge.__version__)"

Configure as an MCP server

{
  "mcpServers": {
    "nsforge": { "command": "uvx", "args": ["nsforge-mcp"] }
  }
}

🎬 How it works β€” SymPy-MCP first

The golden rule: compute & verify with SymPy-MCP, then record with NSForge (provenance + human insight at every step).

flowchart LR
    A["πŸ€– LLM<br/>understand + plan"] --> B["πŸ”’ SymPy-MCP<br/>compute + verify"]
    B --> C["πŸ”¨ NSForge<br/>record step + provenance"]
    C --> D{"more<br/>steps?"}
    D -->|"yes"| B
    D -->|"no"| E["βœ… complete<br/>stored formula + code"]

Task

Tool

Why

Math computation

SymPy-MCP

Full ODE / PDE / matrix support

Formula display

derivation_show

User confirms each step

Knowledge storage

NSForge

Provenance, searchable

Dimension check

NSForge check_dimensions

Physical-unit verification


🧭 Autonomous task orchestration (L2 / L3)

Hand NSForge a declarative Derivation Task Spec (DTS) and it runs the whole ladder for you. task_explore turns a single answer into a space of verified answers: it runs the base derivation plus every alternative, then ranks the survivors.

flowchart TD
    DTS["πŸ“‹ Derivation Task Spec"] --> BASE["base derivation"]
    DTS --> ALT1["alternative 1"]
    DTS --> ALT2["alternative 2"]
    BASE --> V["verify Β· acceptance oracles Β· provenance"]
    ALT1 --> V
    ALT2 --> V
    V --> RANK["πŸ† ranked candidates<br/>verified Β· oracles passed Β· simpler"]
  • task_plan β€” reify a DTS into an ordered, provenance-tagged plan

  • task_run β€” run the ladder end-to-end (optional hard timeout_s)

  • task_explore β€” branching search returning all verified candidates

πŸ“– General-formula-exploration roadmap


πŸŽ›οΈ Step-by-step control

Navigate and edit a derivation like a version-controlled document. Expressions are immutable (that keeps verification honest) β€” to change a result, rollback to a valid state and re-derive.

stateDiagram-v2
    direction LR
    [*] --> deriving
    deriving --> deriving: get_step / update_step / insert_note
    deriving --> earlier: rollback
    earlier --> deriving: re-derive a new path
    deriving --> [*]: complete + save

derivation_get_step Β· derivation_update_step Β· derivation_rollback Β· derivation_insert_note Β· derivation_delete_step β€” see the tool reference.


πŸ› οΈ Tools at a glance β€” 91 tools Β· 82 loaded by default

Module

#

What it does

πŸ”₯ Derivation engine

31

Stateful sessions: compose, step, track, store

πŸ”’ Calculation

12

Limits, series, sums, inequalities, probability

πŸ”£ Advanced algebra & transforms

14

expand/factor/apart… + Laplace / Fourier

βœ… Verification

6

Equality, derivative, integral, dimensions

🌐 Formula search

6

Wikidata, BioModels, SciPy constants

πŸ’» Code generation

4

Python, LaTeX, report, SymPy script

πŸ“ Expression

3

Parse, validate, extract symbols

🧭 Task orchestration

3

task_plan / task_run / task_explore

🧭 Suggester

1

Retrieval-augmented next-step ranking

🎡 Music (opt-in)

9

Symbolic tones β†’ waveform, spectrum, WAV β€” set NSFORGE_ENABLE_MUSIC=1

🧩 Runtime self-description

2

nsforge_health Β· nsforge_manifest (agent harness)

πŸ“– Full list with every tool: Tool Reference Β· machine-readable capabilities.json


βœ… Verification harness

One command is the ground truth. python scripts/check.py runs 10 gates β€” a green run is the definition of "done".

lint Β· format Β· type Β· import Β· manifest Β· test Β· bench Β· generic Β· provenance Β· diff
  • bench β€” known derivations reproduce correctly

  • generic β€” unseen, randomly-composed formulas derive correctly (proves NSForge is a derivation calculus, not a hand-built library)

  • provenance β€” every benchmark derivation carries a complete tool-provenance ledger (no hand-derived leaks)

python scripts/check.py            # all gates
python scripts/check.py --json     # machine-readable (for agents)

πŸ“š Derivation repository

Derived formulas are stored with full provenance β€” LaTeX, SymPy form, the base formulas combined, the steps taken, verification status, and clinical/physical context.

Derivation

Domain

Description

Temperature-corrected elimination

PK

First-order elimination + Arrhenius

NPO antibiotic effect

PK/PD

Henderson-Hasselbalch + Emax

Temperature-corrected Michaelis-Menten

PK

Saturable kinetics + temperature

Physiological Vd by body composition

PBPK

Vd adjustment for body composition

🐍 Worked example: examples/npo_antibiotic_analysis.py


🧠 Agent skills

NSForge ships 19 pre-built skills that teach agents how to use the tools β€” 6 NSForge workflows (nsforge-derivation-workflow, nsforge-formula-search, nsforge-verification-suite, …) plus 13 general development skills.

πŸ“– NSForge Skills Guide


πŸ”— Optional: NSForge β†’ USolver

NSForge derives the domain-smart formula; USolver finds the math-optimal values.

flowchart LR
    N["πŸ”¨ NSForge<br/>derive modified formula"] --> P["derivation_prepare_for_optimization"]
    P --> U["🎯 USolver<br/>Z3 · OR-Tools · CVXPY"]
    U --> R["optimal parameters"]

πŸ“– Skill: nsforge-usolver-collab


πŸ—οΈ Architecture & development

DDD with a pure domain core and a replaceable MCP layer (nsforge core has no MCP dependency).

uv sync --all-extras     # set up
uv run pytest            # tests
python scripts/check.py  # full harness (10 gates)
uv run nsforge-mcp       # start the server

πŸ“– Architecture Β· Contributing Β· NSForge vs SymPy-MCP


πŸ—ΊοΈ Roadmap

Reification-ladder phases 1–6 are live (engine β†’ benchmarks β†’ suggester β†’ self-correction β†’ provenance β†’ explore mode). Remaining: Lean4 formal verification (optional) and multi-agent infrastructure.

πŸ“– ROADMAP.md Β· General-formula-exploration roadmap


πŸ“„ License

Apache License 2.0

NSForge β€” Forge new formulas through verified derivation Β· Where Neural meets Symbolic

A
license - permissive license
-
quality - not tested
B
maintenance

Maintenance

–Maintainers
–Response time
–Release cycle
–Releases (12mo)
Commit activity

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/u9401066/nsforge-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server