Open source
Code
Four JavaScript packages: one measures the fractal structure of a time series, one generates a series with the structure you ask for, and two MCP servers give both to an AI assistant.
DFA
dfa-variability
Detrended Fluctuation Analysis and multifractal DFA with no dependencies. It returns the scaling exponent α, the short-term α₁ and long-term α₂, a label for each (random, regular, fractal, complex), and the usual HRV statistics: SDNN, RMSSD, PNN50. It runs in Node.js and in the browser.
Install
npm install dfa-variability
Use
const DFA = require("dfa-variability");
const series = [8, 10, 6, 9, 7, 5, 5, 11, 11, 8, 6, 7, 9, 10, 7, 9];
const result = new DFA(series).compute();
console.log(result.alpha, result.alpha1, result.alpha2);
console.log(result.alphaLabel); // "random" / "regular" / "fractal" / "complex"
Fractal Signal Generator
generate-fractal-signal
Generates mono- and multifractal time series of a given length and range with a chosen DFA exponent: global α, short-term α₁, long-term α₂, or a crossover between the two. Every result is checked with dfa-variability and comes back with its measured exponents. The signal at the top of the home page was made with it.
Install
npm install generate-fractal-signal
Use
const { generateSignal } = require("generate-fractal-signal");
const result = generateSignal({
signalLength: 256,
signalRange: [10000, 30000],
signalType: "Fractal", // α ≈ 1
});
console.log(result.timeSeries); // 256 integers between 10000 and 30000
console.log(result.alpha, result.alpha1, result.alpha2); // measured exponents
Set targetAlpha for any other exponent. The useful range is about 0.2 to
1.7.
MCP Server
mcp-fractality
An MCP server that wraps the two packages above, so Claude, Cursor and other AI
assistants can generate fractal signals and measure any time series with DFA and
multifractal DFA. It needs Node.js 18 or later and runs locally over stdio. It also runs
at https://mcp.fractality.app/mcp, with nothing to install.
Claude Code
claude mcp add fractality -- npx -y mcp-fractality
Claude Desktop, Cursor and other clients
{
"mcpServers": {
"fractality": {
"command": "npx",
"args": ["-y", "mcp-fractality"]
}
}
}
The tools, example prompts and other ways to install are on the MCP page.
Natural Dynamics MCP Server
natural-dynamics-mcp
An MCP server built on the same two packages that gives a plain verdict on any series:
static, predictable, natural or too driven. It also generates numbers that vary the way
natural systems do. It runs locally over stdio, or at
https://natural.fractality.app/mcp.
Claude Code
claude mcp add natural-dynamics -- npx -y natural-dynamics-mcp
License
All three packages are released under the AGPL v3. For other licensing, write to support.noduslabs.com.