Skip to main content
Glama

Open source from Noise Factor · more projects

shade-mcp

MCP server for shader effect development.

Distilled from three projects:

  • noisemaker — browser-based shader testing

  • portable — portable effect authoring

  • shade — agent-assisted shader editing

Requirements

  • Node.js 22 or newer

  • A viewer page for the seven viewer-driven browser tools; runDslProgram and the seed tools need a Noisemaker checkout. See Viewer.

Related MCP server: graphite-editor-mcp

Quick Start

npm install            # installs dependencies and builds dist/
npm run setup          # install Playwright Chromium (browser tools only)

Using shade-mcp with noisemaker or portable? See docs/SETUP.md for step-by-step configuration.

Viewer

The browser tools use Chromium. Seven control a viewer page that hosts the renderer; runDslProgram creates a fresh renderer on a blank page for each call. shade-mcp does not include a viewer. Set SHADE_VIEWER_ROOT to the smallest directory containing the viewer and its imported modules. For the seven viewer tools, the page must expose the renderer through window globals. Set SHADE_GLOBALS_PREFIX to match those globals. With prefix <p>, the viewer publishes <p>CanvasRenderer, <p>RenderingPipeline, <p>CurrentBackend() (glsl or wgsl), <p>CurrentEffect (the effect id, or an entry with id or namespace and name, and instance.globals), <p>SetPaused, <p>SetPausedTime, <p>FrameCount and optionally <p>PipelineGeneration, a number it bumps after every successful compile. To select an effect, shade-mcp calls <p>SelectEffect(id, { url }) when the viewer publishes it, where url is where shade-mcp's server serves the effect's directory (/effects/<id>/); the call resolves when the compile finishes and may resolve to { error }. Without it, shade-mcp drives a <select id="effect-select">. To switch backends, it calls <p>SetBackend('glsl' | 'wgsl') when published, which recompiles, and otherwise the renderer's switchBackend. Portable's viewer publishes the selection and backend calls. runDslProgram uses a fresh renderer independently of the viewer globals and SHADE_VIEWER_PATH. By default it imports Noisemaker source modules from /shaders/src/index.js and assets from /shaders under SHADE_VIEWER_ROOT. For Portable's built-in Noisemaker DSL, set SHADE_DSL_RENDERER_MODULE=https://shaders.noisedeck.app/1/noisemaker-shaders-core.esm.js, SHADE_DSL_ASSETS_BASE=https://shaders.noisedeck.app/1, and SHADE_DSL_USE_BUNDLES=true; keep its viewer settings for the other browser tools. To use authored user.* effects, pass effects as comma-separated Portable package IDs under SHADE_EFFECTS_DIR (up to 16), such as user/gradient,user/tint. For a flat single-effect directory, use its directory name as the ID. The fresh renderer loads each package's raw definition.json and the requested backend's shader files. Omitting effects loads built-ins only. Authored registration requires a Noisemaker runtime with CanvasRenderer.registerPortableEffect; older CDN bundles return an explicit unsupported-runtime error. Viewer state is never inherited, and duplicate authored function names fail the batch.

Project

SHADE_VIEWER_ROOT

SHADE_VIEWER_PATH

SHADE_GLOBALS_PREFIX

noisemaker

<noisemaker>

/demo/shaders/

__noisemaker

portable

<portable>

/viewer/index.html

__portable

noisemaker's viewer page is in demo/shaders/ and imports the engine from shaders/src/ at the repository root. For noisemaker, set SHADE_VIEWER_ROOT to the repository root. If you use the page's directory as the root, every module request returns 404. The server refuses dotfiles regardless of the root.

The analysis, knowledge, and utility tools read from disk and need no viewer.

Configuration

Environment variables:

Variable

Default

Description

SHADE_EFFECTS_DIR

<project root>/effects

Path to the effects library

SHADE_PROJECT_ROOT

cwd

Project root, used for relative paths and AI key lookup

SHADE_VIEWER_ROOT

<project root>/viewer

Directory served as the viewer

SHADE_VIEWER_PATH

/

Path within the viewer to open

SHADE_VIEWER_PORT

0 (OS-assigned)

Port for the local viewer server

SHADE_GLOBALS_PREFIX

__shade

Prefix of the viewer's window globals

SHADE_DSL_RENDERER_MODULE

/shaders/src/index.js

Root-relative or HTTPS Noisemaker module exporting CanvasRenderer and compile for runDslProgram and the seed tools

SHADE_DSL_ASSETS_BASE

/shaders

Root-relative or HTTPS Noisemaker asset base for runDslProgram and the seed tools

SHADE_DSL_USE_BUNDLES

false

Set true when DSL effects load from bundled assets (Portable's CDN)

SHADE_BACKEND

webgl2

Default rendering backend (webgl2 or webgpu)

SHADE_MAX_BROWSERS

1

Concurrent browser sessions

SHADE_HEADLESS

1 (headless)

Set to 0 to watch the browser window

SHADE_TIMEOUT_MS

120000

Ceiling for every browser and page operation

SHADE_AI_TIMEOUT_MS

120000

Ceiling for a single AI provider request

SHADE_AI_MODEL

provider default

Model used by the AI-powered tools

ANTHROPIC_API_KEY

—

Required for AI-powered tools (vision, analysis)

OPENAI_API_KEY

—

Fallback AI provider

MCP Client Configuration

Claude Code

Put this in .mcp.json at the project root, or register it with claude mcp add shade -- node /path/to/shade-mcp/dist/index.js.

{
  "mcpServers": {
    "shade": {
      "command": "node",
      "args": ["/path/to/shade-mcp/dist/index.js"],
      "env": {
        "SHADE_EFFECTS_DIR": "/path/to/effects"
      }
    }
  }
}

VS Code Copilot

In .vscode/mcp.json:

{
  "servers": {
    "shade": {
      "command": "node",
      "args": ["/path/to/shade-mcp/dist/index.js"],
      "env": {
        "SHADE_EFFECTS_DIR": "/path/to/effects"
      }
    }
  }
}

Cursor

In .cursor/mcp.json:

{
  "mcpServers": {
    "shade": {
      "command": "node",
      "args": ["/path/to/shade-mcp/dist/index.js"],
      "env": {
        "SHADE_EFFECTS_DIR": "/path/to/effects"
      }
    }
  }
}

Windsurf

In ~/.codeium/windsurf/mcp_config.json:

{
  "mcpServers": {
    "shade": {
      "command": "node",
      "args": ["/path/to/shade-mcp/dist/index.js"],
      "env": {
        "SHADE_EFFECTS_DIR": "/path/to/effects"
      }
    }
  }
}

Tool Reference

Result envelope

Every tool result's text is JSON in one envelope, errors included.

  • A single result carries a top-level outcome, computed from the tool's own status: ok (the check passed or the query answered), fail (the check ran and its verdict is negative: a parity mismatch, a passthrough filter, divergent algorithms, a uniform that did not affect output, meets_target: false), warning (findings to review), skipped (nothing was testable) or error (no verdict). A payload with no status is error when it carries an error string. An outcome key inside the payload never overrides the computed one. Verb-specific fields such as status and mismatchPercent are kept beside it.

  • A batch (several effects in one call) is { outcome, summary, results }. Each entry carries its own outcome and summary counts entries per outcome. The batch outcome is error when every entry is an error, fail when any entry is fail or error, warning when any entry is warning, skipped when every entry is skipped, and ok otherwise.

  • MCP isError is set when the call failed as a whole: a single error result, or a batch in which every entry is an error. A fail verdict is a successful call and does not set isError.

  • Errors raised inside a tool before it reaches its own handling, such as an unresolvable effect selector, and calls the MCP SDK rejects before the tool runs (an argument that fails the tool's input schema, an unknown tool) arrive in the same envelope with isError: { "outcome": "error", "status": "error", "error": "..." }. For a rejected argument, error is the SDK's message, for example MCP error -32602: Input validation error: ....

Browser Tools (11)

These tools require Playwright Chromium; all except runDslProgram and the seed tools require a viewer (see Viewer).

Each result of the six viewer verbs (compileEffect, renderEffectFrame, benchmarkEffectFPS, testUniformResponsiveness, testNoPassthrough, testPixelParity), and each batch entry, carries effect_id, the effect id that was requested, so entries match their requests. page_effect_id is the effect the viewer page reports as loaded (null when the viewer does not expose it) and backend is the backend the page reports. When the page shows another effect or renders on another backend, the entry's status is error.

Tool

Description

compileEffect

Compile a shader effect. Return diagnostics for each pass. Use comma-separated effect IDs for a batch.

renderEffectFrame

Render one frame. Return mean RGB, variance, and blank/monochrome detection. Optionally capture a PNG.

describeEffectFrame

Render a frame. Analyze the image with AI vision. The tool requires ANTHROPIC_API_KEY or OPENAI_API_KEY.

benchmarkEffectFPS

Measure FPS, jitter, and frame timing statistics against a target frame rate.

testUniformResponsiveness

Check whether each uniform control changes the output: range, dropdown, boolean and vector controls, gates opened first, against a reference captured twice to measure the output's own change between renders. Each control is pass, fail, error, gated, unstable (no verdict) or untested. The status is ok only when every measured control passed; any error or unstable control makes it error, otherwise any fail makes it fail.

testNoPassthrough

Check that a filter effect modifies the input it consumes: compares output and input at two paused times by mean difference, changed grid pixels and strongly changed pixels; a filter that is the identity at its defaults is measured again with its controls moved.

testPixelParity

Compare WebGL2 and WebGPU output pixel by pixel within the epsilon tolerance.

runDslProgram

Render every written output surface at frames 1, 120, and 600 after warmup by default, at 960×540. Return one PNG contact sheet as MCP image content plus metrics for each surface and frame.

getProgramSeed

Return a program's seed: the value of its seed directive, or null when it has none. It reads the directive without compiling or checking the program.

setProgramSeed

Set a program's seed, 0 to 4294967295. Return the seed and the program with its seed directive written or replaced. The whole program comes back as the engine's unparser writes it: comments before search are dropped, and literal values are written as compiled, while random calls stay as written.

reseedProgram

As setProgramSeed, with a fresh random seed.

The seed tools use the engine's seed API (CanvasRenderer.getSeed and setSeed), which Noisemaker 2 has. setProgramSeed and reseedProgram compile the program with built-in effects only; they have no effects argument. Point SHADE_DSL_RENDERER_MODULE at a Noisemaker 2 renderer to use them. With a renderer that has no seed API, each returns an error that names the missing methods.

Analysis Tools (4)

These tools analyze files on disk and do not need a browser.

Tool

Description

checkEffectStructure

Detect unused files, broken references, naming violations, leaked uniforms, and structural parity issues.

checkAlgEquiv

Compare the semantics of GLSL/WGSL pairs with AI. The tool requires an AI key.

compareShaders

Compare shader structure: function names, uniforms, and line counts.

analyzeBranching

Analyze unnecessary shader branching with AI. Return optimization suggestions. The tool requires an AI key.

Knowledge Tools (7)

In-memory search indexes.

Tool

Description

searchEffects

Search effect library by concept, tag, algorithm, or visual style.

analyzeEffect

Return the full definition, shader source, uniforms, and passes for an effect ID.

searchShaderSource

Search GLSL source code across all effects with a regular expression.

searchShaderKnowledge

Search curated shader documentation by meaning: DSL grammar, GLSL techniques, patterns, errors, and the shader-craft references (category shader-craft).

searchShaderLibrary

Search local GLSL/WGSL library symbols by name, signature, summary and module.

checkShader

Return advisory source findings for GLSL/WGSL text or a shader file inside the effects directory or project root.

bundleShader

Inline used library symbols and their dependencies with credits. Return source; write a file only with explicit write: true.

Utility Tools (2)

Tool

Description

listEffects

List all effects, optionally filtered by namespace.

generateManifest

Rebuild effect manifest by scanning effects directory.

Development

npm test           # run tests
npm run typecheck  # tsc --noEmit, including tests
npm run build      # build with tsup
npm run dev        # watch mode

Tests and typecheck are separate checks. Vitest does not typecheck. Run both commands.

Credits

The shader-craft knowledge in src/knowledge/shader-craft/ adapts the shader-art-coding skill from shader-skills by gokayfem (MIT, Copyright (c) 2026 gokayfem) for Noisemaker effects. It is pinned to upstream commit e09bc993bf04201f26c03c87c89210e9b472f526 (2026-10-19). provenance.json records each upstream file and its blob hash. The upstream licence ships in the knowledge bundle as SHADER_CRAFT_LICENSE.

The techniques come from their original authors, each credited in SHADER_CRAFT_CREDITS:

  • Inigo Quilez: distance functions, smooth minimum, soft shadows, filtering, noise derivatives, domain warping

  • Mercury demogroup: hg_sdf combinators and repetition

  • Jarzynski and Olano: PCG hashes

  • Stefan Gustavson, and Gustavson and McEwan: simplex noise

  • Ken Perlin: gradient noise and turbulence; Perlin and Neyret: flow noise

  • Bridson, Hourihan and Nordenstam: curl noise

  • Jorge Jimenez: interleaved gradient noise; Martin Roberts: R2 sequence

  • Troy Sobotka and Benjamin Wrensch: AgX; the Khronos Group: PBR Neutral; Stephen Hill: ACES fit and wrap lighting

  • Bjorn Ottosson: Oklab; Brian Karis: environment BRDF; the Filament documentation: GGX shading

  • Barre-Brisebois and Bouchard: fast translucency

  • Sebastien Hillaire: volumes and sky; Andrew Schneider: clouds

  • Mark Finch: water waves; Ryan Geiss: terrain; Müller et al.: procedural buildings

The shader-craft building-block library (SHADER_CRAFT_LIBRARY_MODULES) is the upstream GLSL library adapted to the Noisemaker effect contract, with a WGSL twin of every function. SHADER_CRAFT_LIBRARY indexes both, and each entry cites its technique credits by key.

License

MIT

Available Tools

24 tools
analyzeBranchingB

Analyze unnecessary shader branching with AI. Return optimization suggestions.

Inputs: effect_id (required), backend.

analyzeEffectA

Return the full definition, shader source, uniforms, and passes for an effect.

Inputs: effect_id (required).

benchmarkEffectFPSC

Measure achieved FPS, jitter, and frame timing statistics against a target frame rate.

Inputs: backend, effects, effect_id, resolution, +2 more.

bundleShaderA

Inline only the shader library symbols used by a program and their dependencies, with upstream and technique credits. Return source; write back only with explicit write: true.

Inputs: file, write, source, language.

checkAlgEquivB

Compare the semantics of GLSL/WGSL pairs with AI. Flag divergent algorithms. Ignore syntax differences.

Inputs: effect_id (required).

checkEffectStructureC

Detect these effect issues:

  • unused files

  • broken references

  • naming violations

  • leaked or undefined uniforms

  • missing descriptions

  • structural parity issues

  • GLSL name collisions: uniforms versus functions, reserved words, or built-in shadowing.

Inputs: effect_id (required).

checkShaderA

Advisory GLSL/WGSL source findings for Noisemaker effects. Findings never block compilation or change a file.

Inputs: file, source, language.

compareShadersC

Compare shader structure: function names, uniform declarations, and line counts. This tool does not require AI.

Inputs: effect_id (required).

compileEffectC

Compile a shader effect. Return diagnostics for each pass. Use comma-separated effect IDs for a batch.

Inputs: backend, effects, effect_id.

describeEffectFrameC

Render a frame. Analyze the image with AI vision, using the prompt that the user supplies.

Inputs: prompt (required), backend, effects, effect_id, +1 more.

generateManifestB

Scan the effects directory to rebuild the effect manifest.

Inputs: no named parameters.

getProgramSeedA

Read a Noisemaker DSL program's seed: the value of its seed directive, or null when it has none (it then draws from 0). It reads the directive without compiling or checking the program. Needs a Noisemaker 2 renderer.

Inputs: dsl (required).

listEffectsB

List all effects, optionally filtered by namespace. Pass id to the other tools; func is the name a DSL program calls.

Inputs: namespace.

renderEffectFrameB

Render one frame. Compute mean RGB, variance, and monochrome/blank detection. Optionally capture a PNG.

Inputs: time, backend, effects, uniforms, +4 more.

reseedProgramB

Give a Noisemaker DSL program a fresh random seed and return it as setProgramSeed does. Built-in effects only. Needs a Noisemaker 2 renderer.

Inputs: dsl (required).

runDslProgramB

Compile Noisemaker DSL with optional authored Portable packages in a fresh renderer and return a multi-frame, per-surface PNG grid with metrics.

Inputs: dsl (required), frames, backend, effects, +5 more.

searchEffectsA

Search the effect library by concept, tag, algorithm, or visual style. The tool expands the query with synonyms.

Inputs: query (required), limit.

searchShaderKnowledgeB

Search curated shader documentation by meaning: DSL grammar, GLSL techniques, effect patterns, common errors, and the shader-craft references (workflow, subject routing, SDF modeling, noise, terrain, water, rendering pipeline, library functions, recreating a reference video).

Inputs: query (required), limit, category.

searchShaderLibraryB

Search the local shader-craft library for GLSL or WGSL building blocks, signatures and summaries.

Inputs: query (required), limit, language.

searchShaderSourceA

Search GLSL source code across all effects with a regular expression. Return matching snippets with context.

Inputs: query (required), limit, context_lines.

setProgramSeedA

Set a Noisemaker DSL program's seed and return the seed and the program with its seed directive written or replaced. The whole program comes back as the engine's unparser writes it: comments before the search directive are dropped, and literal values are written as compiled, while random calls stay as written. Built-in effects only. Needs a Noisemaker 2 renderer.

Inputs: dsl (required), seed (required).

testNoPassthroughA

Check that a filter effect modifies the input it consumes. Compares the rendered output with the bound input texture (skipping a feedback read of the effect's own output) at paused t=0 and t=0.37: similarity (mean RGB difference on a 64x64 grid), changed_fraction (grid pixels changed by more than 2/255) and strong_fraction (all pixels changed by more than 16/255). Output is unchanged when similarity and changed_fraction are at most 0.01 and strong_fraction at most 0.0005 at both times. A filter unchanged at its defaults is measured again with its ungated controls moved (identity_at_defaults, varied); only a filter unchanged both ways is a passthrough.

Inputs: backend, effects, effect_id.

testPixelParityA

Render with both WebGL2 and WebGPU. Compare the output pixel by pixel within the epsilon tolerance.

Inputs: seed, effects, epsilon, effect_id.

testUniformResponsivenessB

For each uniform control the tool finds two values that differ from the value the loaded program set: a range control's farther 25%/75% point and its 38.2% point, a dropdown's other choices, a boolean's opposite, or a vector moved a quarter of its range. It first opens the control's ui.enabledBy gate by setting the gate params (enabled_with). It captures the output twice (the second against the first measures how much the output changes between renders on its own), then sets each value and compares at paused t=0 and t=0.37. A control responds when the luma, a per-channel mean or the per-pixel mean (64x64 grid) changes by more than 0.002, or more than 0.05% of all pixels change by more than 16/255 (strong_fraction); when the output changes on its own, only well beyond that change. A control that does not respond is retried with one other control moved (context). Results per uniform: pass, fail, error, gated (a compile-time define or a gate that cannot be opened), unstable (no verdict: the output changes between renders by more than the thresholds), or untested (no other value can be set at run time). Status is ok when at least one control was measured and every measured control responded; error when one could not be measured or got no verdict (unstable); otherwise fail when one did not respond; skipped when no control could be set at run time (every control gated or untested). Async overlays are awaited, up to the session timeout (settle_timed_out).

Inputs: backend, effects, effect_id.

Tool Schema Changelog

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

Loading tool schema changelog…

    TDQS

    B3.1/5.0

    Scored across 24 tools

    Disambiguation3/5

    The set has clear clusters (search, check/analyze, seed, compile/render, test), but within clusters there is real overlap: searchShaderSource vs searchShaderLibrary vs searchEffects vs searchShaderKnowledge are four similarly named searches, and checkShader vs checkEffectStructure vs checkAlgEquiv vs compareShaders vs analyzeBranching/analyzeEffect are easy to confuse. The detailed descriptions mitigate this, but an agent could still misselect between searchShaderLibrary and searchEffects or between checkShader and checkEffectStructure.

    Naming Consistency4/5

    All tools are camelCase and overwhelmingly verb-leading (search*, check*, get/set*, compile*, run*, analyze*, test*, render*, describe*, bundle*, list*, generate*). A few names are verb-only or noun-heavy (reseedProgram, compareShaders), and the verb choice varies across similar actions (check/compare/analyze), but the pattern is predictable overall.

    Tool Count3/5

    24 tools is on the heavy side for a shader-authoring server and sits in the '16-25 feels heavy' band. Most tools do map to distinct operations (search, seed, compile, run, render, test, manifest, bundle), so it is defensible, but the surface is broad enough to be borderline.

    Completeness4/5

    Coverage is strong: search/read, seed manipulation, compile, run, render, analysis, regression testing, manifest rebuild, and bundling are all present. The main gap is authoring: there is no explicit create/edit/delete effect or write-shader-source tool (bundleShader and setProgramSeed only write as side effects), which leaves a workflow dead end for creating new effects.

    Maintenance

    ActivityActive
    ResponsivenessOutdated data

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      B
      maintenance
      Enables automated graphics capture and replay with RenderDoc, allowing agents to launch executables, inspect captures, and export thumbnails or timeline JSON for regression triage.
      1
      MIT
    • A
      license
      A
      quality
      C
      maintenance
      Enables AI agents to author node-graph-based procedural graphics as data and render them deterministically via a pinned headless engine, returning validated, hashed image artifacts with full provenance.
      4
      MIT
    • A
      license
      Not graded
      quality
      A
      maintenance
      Enables AI agents to inspect and edit live 3D scenes, materials, shaders, and lights in the browser without touching project code, then turn any previewed change into ready-to-paste source. Also provides performance and mobile audits, video frame capture, and Playwright helpers.
      8,555 npm
      MIT
    • F
      license
      Not graded
      quality
      A
      maintenance
      Enables AI agents to drive a browser-based game editor directly, covering projects, entities, scripts, assets, templates, animation, scenes, settings, builds, and viewport and runtime control. Agents can also launch the project and verify it actually runs by capturing screenshots, logs, and live state, then send keyboard, mouse, and touch input.
      -