Skip to main content
Glama
famistudio-mcp

famistudio-mcp

Official
by btdt

famistudio-mcp

English | 简体中文

Model Context Protocol server for FamiStudio. Generate, inspect, validate and render NES .fms projects from plain JSON — no GUI, no manual format wrangling.

compile_song_spec  ──▶  create_fms  ──▶  validate_fms  ──▶  verify_roundtrip  ──▶  export_audio
   JSON notes           .fms file         invariants        FamiStudio agrees       .wav

FamiStudio's command line can read .fms, .txt, .ftm and .nsf, but it has no fms-export command — writing the binary format is the only supported way to produce a .fms from a script. famistudio-mcp does that the same way FamiStudio 4.5.x does, validates every load invariant before writing, and proves the result by feeding it back to FamiStudio.


Quick start

Nothing to install — point your MCP host at the published package:

// Claude Desktop / Cursor / any MCP client that spawns a command
{
  "mcpServers": {
    "famistudio": {
      "command": "npx",
      "args": ["-y", "famistudio-mcp"],
      // Optional fallback; see "Where generated files go" in docs/USAGE.md. If your client
      // can prompt, you will be asked once and can pick a directory per project instead.
      "env": { "FAMISTUDIO_MCP_OUTDIR": "/absolute/path/to/your/audio-work" }
    }
  }
}

Bun users can swap the command:

{ "command": "bunx", "args": ["famistudio-mcp"] }

Then ask your agent for what you want:

Build me a 2-second snake-move blip: a bright Square1 arpeggio, a low Triangle pulse underneath, and a noise tick. Write it to D:/Game Assets/snake_move.fms, verify FamiStudio can load it, and render a 44100 Hz WAV next to it.

Without an MCP host

The same engine ships as a CLI, which is handy for scripts and CI:

npx -y famistudio-mcp-cli info
npx -y famistudio-mcp-cli compile examples/snake-move.json -o out/snake.fms
npx -y famistudio-mcp-cli verify out/snake.fms
npx -y famistudio-mcp-cli export out/snake.fms out/snake.wav --rate 44100
npx -y famistudio-mcp-cli analyze out/snake.wav --pitch

As a library

npm install famistudio-mcp
import { compileSongSpec, writeFms, readProject } from 'famistudio-mcp/core';
import { writeFile } from 'node:fs/promises';

const { project } = compileSongSpec({
  name: 'Blip',
  patternLength: 16,
  channels: [
    { channel: 'Square1', notes: [{ time: 0, note: 'C4', duration: 8 }, { time: 8, note: 'stop' }] },
    { channel: 'Triangle', notes: [{ time: 0, note: 'C1', duration: 16 }] },
  ],
});

await writeFile('blip.fms', writeFms(project));
console.log(readProject(writeFms(project)).songs[0].name); // "Blip"

FamiStudio itself is only needed for rendering, text export and round-trip verification. Generating, reading, validating and diffing projects works without it.


Related MCP server: project-fmod-api

Tools

Tool

Purpose

famistudio_info

Locate the FamiStudio executable, report its version and the allowed read/write roots

compute_ticks

Convert between seconds, ticks and tempo

compile_song_spec

Compile a JSON song spec into a complete project object, optionally writing a .fms

create_fms

Same, but always writes a file

validate_fms

Check every FamiStudio load invariant and list the problems

read_fms

Decode a .fms into structured JSON (songs, channels, patterns, notes, envelopes)

summarize_fms

Human-readable listing of a project with per-pattern note dumps

diff_fms

Structural diff of two projects

verify_roundtrip

Round-trip through FamiStudio: text export + WAV render, checking for desync and silence

export_audio

Render WAV / MP3 / OGG via the FamiStudio CLI

export_text

FamiStudio text, FamiTracker text, or sound-engine assembly

analyze_audio

WAV duration, peak/RMS, silence and pitch detection

run_famistudio

Escape hatch for any other FamiStudio CLI command (NSF, ROM, ...)

  1. compute_ticks — decide the tick budget for the sound you want.

  2. compile_song_spec — build the notes.

  3. create_fms — write the file (or pass the returned project straight on).

  4. verify_roundtrip — prove FamiStudio loads it and produces audio.

  5. export_audio — render the .wav for your game.

  6. analyze_audio — confirm duration and pitch, e.g. with separateChannels.

The one thing to know before writing notes: a tick is one frame of the console, so a song's length is ticks / 60.0988 seconds (NTSC) and its tempo follows from the tick grid you write — bpm = 60 * frameRate / beatLength. groove and noteLength do not scale playback. Everything else about the spec, including the full grammar and an effects table, is in docs/USAGE.md.


Documentation

Document

What is in it

README.md (this file)

What the project is, install, quick start, tool list

docs/USAGE.md

The full song-spec reference: note forms, effects, tempo, output location, configuration, editor/CLI options

docs/DEVELOPMENT.md

Build/test/verify commands and their gotchas, adding a tool, code style, path policy, desync debugging, known limitations

docs/FMS_FORMAT.md

The .fms container and payload layout, and the timing model, as implemented

AGENTS.md

The compact entry point for coding agents: repository map, the format invariants, the change checklist

CONTRIBUTING.md

How to contribute

CHANGELOG.md

Release history

Every document exists in English and Simplified Chinese (X.md / X.zh-CN.md), with a switcher under the title going to the other language — except AGENTS.md, which is agent-facing and deliberately English-only.


Compatibility

  • Writes and reads FamiStudio 4.5.x project files: serialization version 19.

  • Reading older files (versions 10–18) is not supported; open and re-save them in FamiStudio to upgrade them. Generation is unaffected.

  • Plain 2A03 only (no expansion audio: VRC6, FDS, N163, S5B, VRC7, EPSM). DPCM samples in an existing project are preserved byte-for-byte but cannot be authored.

  • The container uses zlib raw deflate by design, and a re-encoded container can differ byte-for-byte from the original while the decompressed payload is identical.


License

MIT — see LICENSE.

FamiStudio itself is a separate project by Mathieu Gauthier-Pilote, licensed under the MIT license; this server only reads and writes its file format and drives its command line.

Available Tools

13 tools
analyze_audioAnalyze a rendered WAVA
Read-onlyIdempotent

Report duration, peak/RMS level and silence for a WAV file, and optionally detect the pitch sequence. Pitch detection expects a monophonic render, e.g. a single channel exported with export_audio + separateChannels.

Inputs: path (required), channel, detectPitch, maxSegments, +3 more.

compile_song_specCompile a song spec into a FamiStudio projectA
Idempotent

Compile a compact JSON song specification (channels + notes) into a complete FamiStudio project object, optionally writing it to a .fms file. Object ids, the mandatory instrument envelope masks and the fixed 256-slot pattern tables are filled in automatically. The returned "project" can be passed straight to export_audio / verify_roundtrip / validate_fms.

Notes can be written two ways: absolute: {"channel":"Square1","notes":[{"time":0,"note":"C4","duration":8},{"time":8,"note":"E4"}]} grid: {"channel":"Square1","notes":["C4",null,null,null,"E4"]} // one entry per tick In grid form a note without "duration" sustains until the next filled cell. FamiStudio note names are one octave above standard pitch: its "C4" sounds ~523 Hz, so write melodies one octave below the pitch you hear in a tracker.

Inputs: spec (required), outputPath.

compute_ticksConvert between seconds and ticksA
Read-onlyIdempotent

FamiStudio tempo arithmetic: with a uniform groove one tick equals one frame, so duration is ticks / frameRate (60.0988 NTSC, 50.007 PAL). Use it to turn a target duration into the tick count a spec needs, or to check how long a pattern budget lasts.

Inputs: pal, ticks, seconds, noteLength, +1 more.

create_fmsWrite a FamiStudio .fms file from a song specA
Idempotent

Convenience wrapper around compile_song_spec that always writes a .fms file and returns its path plus a structural summary. Use this when the goal is a file on disk.

Inputs: spec (required), outputPath (required).

diff_fmsCompare two projectsA
Read-onlyIdempotent

Structurally compare two FamiStudio projects (files or inline objects) and list differences in metadata, instruments and per-note content. Use it to confirm that a rewrite did not change the musical content.

Inputs: projectA, projectB, projectPathA, projectPathB.

export_audioExport a project to WAV/MP3/OGGA
Idempotent

Render a FamiStudio project to an audio file with the FamiStudio command line. Requires FamiStudio 4.5.x to be installed; call famistudio_info first if unsure. Returns the artifact path plus duration, peak level and an audibility check for WAV output.

Inputs: outputPath (required), rate, songs, format, +6 more.

export_textExport a project to text or assemblyB
Idempotent

Convert a project with famistudio-txt-export (FamiStudio text - excellent for verification and for reading note data), famitracker-txt-export, or a sound-engine assembly exporter (famistudio-asm-export, famitone2-asm-export, ...). Returns a preview of the produced file.

Inputs: outputPath (required), songs, cleanup, command, +4 more.

famistudio_infoLocate FamiStudioA
Read-onlyIdempotent

Report whether the FamiStudio executable was found, which version it is, and the paths that were probed. Also lists the CLI export commands this server can run, and the directories it is allowed to read and write.

Inputs: no named parameters.

read_fmsRead a .fms fileA
Read-onlyIdempotent

Decode a FamiStudio project file into structured JSON: songs, channels, patterns and notes, plus instrument envelope contents. Set includeNotes=false for a structural overview of large projects. Only version 19 files (FamiStudio 4.5.x) can be read; older files must be re-saved by FamiStudio.

Inputs: path (required), includeNotes.

run_famistudioRun an arbitrary FamiStudio CLI commandA
Idempotent

Escape hatch for FamiStudio commands this server does not wrap (NSF export, ROM export, assembly export with exotic options). Runs FamiStudio <input> <command> <output> [extraArgs...] with the given argv and no shell involved. Prefer export_audio / export_text when they fit.

Inputs: input (required), output (required), command (required), extraArgs, +1 more.

summarize_fmsSummarize a .fms projectA
Read-onlyIdempotent

Return a readable listing of a project: every song with its pattern order and per-pattern note dumps, plus tick totals and rendered duration. Use this to review what a .fms actually contains.

Inputs: project, projectPath, maxPatternsPerChannel.

validate_fmsValidate a project against FamiStudio rulesA
Read-onlyIdempotent

Check every invariant FamiStudio relies on when loading a project: the mandatory four-envelope instrument masks, the DPCM mapping count, unique object ids, nextUniqueId, reference integrity, note ranges and effect ranges, and the fixed 256-entry pattern tables. Returns the list of problems.

Inputs: project, projectPath.

verify_roundtripRound-trip a project through FamiStudioB
Idempotent

The end-to-end validity check: re-export the project to FamiStudio text and render a WAV, then report whether FamiStudio loaded the file cleanly (no field desync) and produced audio of the expected length. Run this after generating a .fms file.

Inputs: project, workDir, projectPath, renderAudio, +2 more.

Tool Schema Changelog

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

Loading tool schema changelog…

    TDQS

    A3.7/5.0

    Scored across 13 tools

    Disambiguation3/5

    Several tools sit close together: compile_song_spec vs create_fms, validate_fms vs verify_roundtrip, read_fms vs summarize_fms, and export_audio vs analyze_audio. The descriptions do clearly separate in-memory creation from file writing, invariant checks from end-to-end verification, and structured decoding from human-readable review, but an agent must read them carefully to avoid misselection.

    Naming Consistency4/5

    Most tools follow a clean verb_noun snake_case pattern such as compile_song_spec, validate_fms, and export_audio, with the repeated _fms suffix forming a recognizable family. The main deviations are famistudio_info, which is noun-style, and run_famistudio, which uses the application name as the object.

    Tool Count5/5

    Thirteen tools is a well-scoped size for a specialized FamiStudio server, and each tool maps to a distinct part of the create-validate-export-review workflow. None feel redundant or extraneous.

    Completeness4/5

    The server covers the full core loop: environment info, tempo arithmetic, spec compilation, file writing, validation, round-trip verification, reading, summarizing, diffing, audio analysis, and audio/text export. A minor gap is the lack of a direct update/modify path for an existing project from structured JSON, though run_famistudio acts as an escape hatch for uncovered CLI operations.

    Maintenance

    ActivitySlowing
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      C
      maintenance
      Provides a headless video editing workflow using portable JSON projects and Kdenlive for review, enabling automated video rendering and project management.
      19
      Apache 2.0
    • F
      license
      Not graded
      quality
      C
      maintenance
      Enables bounded, schema-validated automation of FMOD Studio game audio through MCP/CLI workflows, including inspection, safe mutations, previews, receipts, and high-level workflows for events, assets, parameters, adaptive music, spatial audio, banks, and mixer/routing.
      -
    • A
      license
      A
      quality
      B
      maintenance
      Enables agents to author, validate, inspect, patch, and render editable JSON pixel-art and animation recipes through local tools, producing PNG contact sheets, APNGs, sprite atlases, and related export bundles.
      2
      8
      1,365 npm
      141
      MIT
    • A
      license
      Not graded
      quality
      C
      maintenance
      Enables AI agents to build songs by editing a JSON song model: searching a licence-tagged sample library, adding step-pattern and time-stretched loop tracks, setting gain/pan, describing songs, and rendering them to 44.1 kHz WAV/MP3 with release-safety warnings. Songs and renders are read from and written to a project root, so an agent can go from empty project to finished track through MCP tool calls.
      1
      MIT