MAPSHROOM / MODEL CONTEXT PROTOCOL
Your AI.
Your shaders.
Describe an effect. Watch it take shape. Bring it into your mapping. Connect your assistant to Mapshroom with a public server address.
“Create slow waves of light, with colors I can adjust.”
Preview → Open on Mapshroom
Shader, controls and a link ready to open.ONE PUBLIC ADDRESS
Connect your app.
MCP is the protocol your assistant uses to call Mapshroom tools. The remote server is online, even when the computer running your local server is off. Add it once in the MCP settings of the app you want to use.
https://mapshroom.dev/api/mcpTransport: Streamable HTTP. Authentication: none. No Node.js or downloaded file is needed for the remote connection. AI app access and features depend on its plan and workspace settings.
Cursor
Merge this entry into ~/.cursor/mcp.json for all your folders, or .cursor/mcp.json in the project. Keep other entries and restart the MCP connection. For Cursor on the web, add the same URL in its remote integration settings.
{
"mcpServers": {
"mapshroom": {
"url": "https://mapshroom.dev/api/mcp"
}
}
}Codex
Add an HTTP server in MCP settings, or run this command. If a local server is already named mapshroom, use a different name to keep both.
codex mcp add mapshroom-remote --url https://mapshroom.dev/api/mcpClaude Code
claude mcp add --transport http mapshroom https://mapshroom.dev/api/mcpVS Code
Use MCP: Add Server and choose HTTP, or merge this configuration into .vscode/mcp.json.
{
"servers": {
"mapshroom": {
"type": "http",
"url": "https://mapshroom.dev/api/mcp"
}
}
}ChatGPT, Claude & other apps
If your app supports a custom MCP connector, enter the remote URL and select no authentication. Enable the connector in the conversation. A mobile app does not automatically support custom connectors: check the client and account features. If unavailable, use a compatible client and open the shader link on your phone.
ONE MESSAGE TO COPY
Let your agent set it up.
Send this message to your agent. It can read the public instructions without running JavaScript. If it cannot access your settings, it can guide you through setup.
Read https://mapshroom.dev/mcp/agents.md and configure Mapshroom MCP in this app using https://mapshroom.dev/api/mcp (Streamable HTTP, no authentication). Preserve other configured servers. Verify initialize, tools/list, get_mapshroom_context and get_shader_spec. Then create a shader with a preview and a link to open it in Mapshroom.
If Mapshroom MCP is unavailable or you cannot install it, continue with an interactive Canvas that reproduces the same workflow: shader, controls and an Open on Mapshroom button. Create the effect I requested. Do not stop at GLSL code or installation commands. Briefly explain that this is a standalone preview without claiming MCP was installed.
Read https://mapshroom.dev/mcp/canvas.md for the no-MCP Canvas recipe. Download https://mapshroom.dev/mcp/canvas.mjs and call createShaderCanvas({ code, uniforms, shaderId, previewInput: "neutral" }). Render result.inlineHtml with your native Canvas/artifact/HTML capability. If you cannot execute the module, fill https://mapshroom.dev/mcp/canvas-template.html as documented in the recipe. If shell downloads are blocked, canvas.md also includes the complete HTML template for text-only retrieval. No MCP tool calls or installation are needed.
Use the exact generated GLSL for the canvas and its Open on Mapshroom button. Keep the direct external import link and Copy action from the template. Slider changes must update the import link and copied GLSL. The button must open Mapshroom with this shader and current values, not just the homepage or another chat prompt.
Input is one texture: a photo, grayscale depth, mask or neutral white. If I only asked to produce a shader, choose a procedural example on neutral white and label that choice. For depth/image effects, explain which image to select in the preview and then separately in Mapshroom. More context: https://mapshroom.dev/mcp/context.md.
REQUIRED SHADER STRUCTURE (replace the example effect and prompt record):
```glsl
// NAME: Short Effect Name
// MAPSHROOM PROMPT: "REPLACE WITH THE EXACT USER REQUEST"
// MAPSHROOM CONTRACT: {"version":1,"role":"legacy-render","inputs":[{"slot":"color","semantic":"color","required":true,"space":"source-uv","accepted":[{"encoding":"rgba-color","version":1,"colorSpace":"srgb","filtering":"linear","alpha":"coverage"}],"defaultVariant":"original"}],"output":"color","lighting":"legacy-owned","photoShadows":"not-applicable"}
uniform float speed; // @min -2.0 @max 2.0 @default 0.25
uniform float amount; // @min 0.0 @max 2.0 @default 1.0
uniform float scale; // @min 0.25 @max 8.0 @default 2.0
vec4 processColor(sampler2D tex, vec2 uv, float time, vec2 resolution) {
vec4 source = texture(tex, uv);
// Replace this example with the requested effect and use every declared control.
float modulation = 1.0 + sin(time * speed + uv.x * scale) * 0.1 * amount;
return vec4(source.rgb * modulation, source.a);
}
```
SHADER BODY CONTRACT (the GLSL-only rule below applies inside the shader, not to your full response):
Return one complete replacement fragment shader.
The first non-empty line must be: // NAME: <Short Name>
The second non-empty line must be: // MAPSHROOM PROMPT: "<the exact user request as a JSON string>"
All visual logic must live inside: vec4 processColor(sampler2D tex, vec2 uv, float time, vec2 resolution)
Expose 3 to 6 meaningful effect controls as custom uniforms so Mapshroom automatically creates controls. Convert adjustable concepts in the request into uniforms instead of hardcoded constants: numbers become float/int sliders, colors become vec3 color controls, and switches become bool controls
If the user does not name adjustable parameters, infer the 3 to 6 most useful creative controls for the requested effect
Use only supported custom uniform types: float, int, vec3, bool
Put every uniform on its own line and keep its UI metadata on that same line after //
Every float or int must include: @min <number> @max <number> @default <number>
Every vec3 must include: @default <r>,<g>,<b>; every bool must include: @default true|false
The shader is invalid if it has fewer than 3 correctly annotated custom uniforms. Before returning, count the declarations and verify their metadata
Preserve useful uniforms from the current shader unless the user explicitly asks to remove them
Use GLSL ES 3.00 syntax for WebGL 2 and sample textures with texture()
Do not include #version 300 es because Mapshroom injects the version and program wrapper
Do not declare void main()
Do not write to gl_FragColor in the generated body
Do not include explanations outside the GLSL response
Semantic input ABI v1:
After NAME and MAPSHROOM PROMPT, include // MAPSHROOM CONTRACT: <single-line JSON>.
Preserve the current contract and named slots when editing unless the request changes the actual input requirements. Declare every input the code really reads. Metadata never starts generation. No inference or normal fitting inside GLSL.
The first input is the processColor tex argument. Additional slots use uniform sampler2D u_input_<slot>, declared in GLSL. All source inputs share UV and crop.
Canonical codec formats (copy exactly, including profiles and normal conventions): {"color":{"encoding":"rgba-color","version":1,"colorSpace":"srgb","filtering":"linear","alpha":"coverage"},"regionPieces":{"encoding":"mapshroom.regions.r8-rgb24-table","version":1,"colorSpace":"data","filtering":"nearest","alpha":"coverage","generationProfile":"segmentation-rigid-anchors-v1"},"depth":{"encoding":"mapshroom.depth.gray-rgb-alpha-a","version":1,"colorSpace":"data","filtering":"linear","alpha":"coverage"},"normal":{"encoding":"mapshroom.normal.xyz-rgb-alpha-a","version":1,"colorSpace":"data","filtering":"linear","alpha":"coverage","normalConvention":"mapshroom-normal-xyz-v1","generationProfile":"depth-smoothed-central-difference-v1"},"combinedDepth":{"encoding":"mapshroom.surface.oct-rg-depth-b-alpha-a","version":1,"colorSpace":"data","filtering":"linear","alpha":"coverage","normalConvention":"mapshroom-tiles-v1","generationProfile":"tiles-plane-fit-v1"},"normalAtlas":{"encoding":"mapshroom.surface.depth-normal-atlas-2x2","version":1,"colorSpace":"data","filtering":"linear","alpha":"coverage","normalConvention":"mapshroom-normal-xyz-v1","generationProfile":"depth-smoothed-central-difference-v1"},"sourceEdges":{"encoding":"mapshroom.edges.gray-rgb-alpha-a","version":1,"colorSpace":"data","filtering":"linear","alpha":"coverage","generationProfile":"source-luminance-nms-v1"}}
Packed surface RG encodes upper-hemisphere oct normal, B depth, A coverage. Decode f=rg*2-1, n=normalize(vec3(f,1-abs(f.x)-abs(f.y))), then flip normal Y for geometry. XYZ normal and 2x2 atlas are different codecs. Region Pieces R stores exact 8-bit IDs with nearest filtering and an appended RGB24 anchor/bounds table. Never interpret colored segmentation palettes as IDs.
Use surface-render for a complete 3D effect. Shared material/geometry modules are unsupported in V1. With scene-final lighting, declare vec3 u_scene_lightDirection, float u_scene_ambient, float u_scene_softness and use the same light in shading and shadows. No local moving light. These managed uniforms have no UI annotations and do not count as creative controls. X right, Y up in geometry, Z toward viewer. Preserve photographic shadows without inverse compensation.
Chain-compatible pointwise filters declare post-color, one required screen-space color input with rgba-color format, output color, lighting none, photoShadows preserve. Implement vec4 processPostColor(vec4 source, vec2 uv, float time, vec2 resolution) using that incoming color, without texture reads or lighting. Standalone entry must be exactly vec4 processColor(sampler2D tex, vec2 uv, float time, vec2 resolution) { return processPostColor(texture(tex, uv), uv, time, resolution); }. Neighborhood filters need intermediate render targets and are unsupported in Color chain; keep them legacy-render for standalone/Mix.
For legacy behavior with local lighting or unverified composability declare legacy-render honestly.
Default single-photo contract: {"version":1,"role":"legacy-render","inputs":[{"slot":"color","semantic":"color","required":true,"space":"source-uv","accepted":[{"encoding":"rgba-color","version":1,"colorSpace":"srgb","filtering":"linear","alpha":"coverage"}],"defaultVariant":"original"}],"output":"color","lighting":"legacy-owned","photoShadows":"not-applicable"}
DELIVERABLE: render the Canvas with the same shader, adjustable controls and Open on Mapshroom button. A printed HTML block, saved file or screenshot is not a rendered Canvas. Inspect compilation errors when the host allows it. If this host cannot render HTML/WebGL, provide the actual generated result.fallbackPreviewUrl and result.importUrl as clickable links. Only if generating the canvas and links is also blocked, give complete copyable GLSL, https://mapshroom.dev/ and the paste steps from https://mapshroom.dev/mcp/fallback.md. Explain the actual block without claiming installation, rendering or import succeeded.Agent guide in MarkdownProduct and workflow contextllms.txtJSON configuration
Reading a page or writing “use Mapshroom” does not automatically install an MCP server. Tools must be added and enabled in the client.
FROM IDEA TO SHADER
Create, preview, open.
Use Mapshroom MCP. Read get_mapshroom_context and get_shader_spec, then create a shader with slow light waves and controls for speed and intensity. Show me a preview, then give me the link to open it in Mapshroom.- Your assistant reads the Mapshroom GLSL format and writes the shader.
- If the app supports MCP Apps or HTML/WebGL, it shows an interactive preview. Otherwise it returns a browser preview link.
- Adjust the controls and choose Open on Mapshroom. The link contains the shader and current values; rendering happens on the device.
- The shader is added to a workspace in the same browser and profile. On another device it opens that device’s local workspace: MCP does not synchronize projects.
IF THE CONNECTION FAILS
Keep creating without MCP.
If the connection fails, ask for a Canvas with your shader, controls and an Open on Mapshroom button. The message below includes the GLSL structure and instructions to use the same preview without installing MCP.
- Describe the effect and input: photo, depth map, mask or neutral canvas. Your assistant creates the shader and renders an interactive Canvas when the chat supports HTML/WebGL.
- Adjust the controls and choose Open on Mapshroom. The button brings the same shader and your chosen values into the workspace. Copy gives you GLSL with those values.
- If the chat cannot display a Canvas, open the generated browser preview link. If links are also unavailable, copy the GLSL into Mapshroom with Load from clipboard (+) → Paste shader, or paste into Code and choose Recompile current code.
- Select the required image or depth map, inspect the result and adjust the controls. If a compilation error appears, copy it back to the agent for a corrected shader.
Open MapshroomCanvas without MCPAgent fallback instructionsPublic GLSL specificationContext and inputs
If Mapshroom MCP is unavailable or you cannot install it, continue with an interactive Canvas that reproduces the same workflow: shader, controls and an Open on Mapshroom button. Create the effect I requested. Do not stop at GLSL code or installation commands. Briefly explain that this is a standalone preview without claiming MCP was installed.
Read https://mapshroom.dev/mcp/canvas.md for the no-MCP Canvas recipe. Download https://mapshroom.dev/mcp/canvas.mjs and call createShaderCanvas({ code, uniforms, shaderId, previewInput: "neutral" }). Render result.inlineHtml with your native Canvas/artifact/HTML capability. If you cannot execute the module, fill https://mapshroom.dev/mcp/canvas-template.html as documented in the recipe. If shell downloads are blocked, canvas.md also includes the complete HTML template for text-only retrieval. No MCP tool calls or installation are needed.
Use the exact generated GLSL for the canvas and its Open on Mapshroom button. Keep the direct external import link and Copy action from the template. Slider changes must update the import link and copied GLSL. The button must open Mapshroom with this shader and current values, not just the homepage or another chat prompt.
Input is one texture: a photo, grayscale depth, mask or neutral white. If I only asked to produce a shader, choose a procedural example on neutral white and label that choice. For depth/image effects, explain which image to select in the preview and then separately in Mapshroom. More context: https://mapshroom.dev/mcp/context.md.
REQUIRED SHADER STRUCTURE (replace the example effect and prompt record):
```glsl
// NAME: Short Effect Name
// MAPSHROOM PROMPT: "REPLACE WITH THE EXACT USER REQUEST"
// MAPSHROOM CONTRACT: {"version":1,"role":"legacy-render","inputs":[{"slot":"color","semantic":"color","required":true,"space":"source-uv","accepted":[{"encoding":"rgba-color","version":1,"colorSpace":"srgb","filtering":"linear","alpha":"coverage"}],"defaultVariant":"original"}],"output":"color","lighting":"legacy-owned","photoShadows":"not-applicable"}
uniform float speed; // @min -2.0 @max 2.0 @default 0.25
uniform float amount; // @min 0.0 @max 2.0 @default 1.0
uniform float scale; // @min 0.25 @max 8.0 @default 2.0
vec4 processColor(sampler2D tex, vec2 uv, float time, vec2 resolution) {
vec4 source = texture(tex, uv);
// Replace this example with the requested effect and use every declared control.
float modulation = 1.0 + sin(time * speed + uv.x * scale) * 0.1 * amount;
return vec4(source.rgb * modulation, source.a);
}
```
SHADER BODY CONTRACT (the GLSL-only rule below applies inside the shader, not to your full response):
Return one complete replacement fragment shader.
The first non-empty line must be: // NAME: <Short Name>
The second non-empty line must be: // MAPSHROOM PROMPT: "<the exact user request as a JSON string>"
All visual logic must live inside: vec4 processColor(sampler2D tex, vec2 uv, float time, vec2 resolution)
Expose 3 to 6 meaningful effect controls as custom uniforms so Mapshroom automatically creates controls. Convert adjustable concepts in the request into uniforms instead of hardcoded constants: numbers become float/int sliders, colors become vec3 color controls, and switches become bool controls
If the user does not name adjustable parameters, infer the 3 to 6 most useful creative controls for the requested effect
Use only supported custom uniform types: float, int, vec3, bool
Put every uniform on its own line and keep its UI metadata on that same line after //
Every float or int must include: @min <number> @max <number> @default <number>
Every vec3 must include: @default <r>,<g>,<b>; every bool must include: @default true|false
The shader is invalid if it has fewer than 3 correctly annotated custom uniforms. Before returning, count the declarations and verify their metadata
Preserve useful uniforms from the current shader unless the user explicitly asks to remove them
Use GLSL ES 3.00 syntax for WebGL 2 and sample textures with texture()
Do not include #version 300 es because Mapshroom injects the version and program wrapper
Do not declare void main()
Do not write to gl_FragColor in the generated body
Do not include explanations outside the GLSL response
Semantic input ABI v1:
After NAME and MAPSHROOM PROMPT, include // MAPSHROOM CONTRACT: <single-line JSON>.
Preserve the current contract and named slots when editing unless the request changes the actual input requirements. Declare every input the code really reads. Metadata never starts generation. No inference or normal fitting inside GLSL.
The first input is the processColor tex argument. Additional slots use uniform sampler2D u_input_<slot>, declared in GLSL. All source inputs share UV and crop.
Canonical codec formats (copy exactly, including profiles and normal conventions): {"color":{"encoding":"rgba-color","version":1,"colorSpace":"srgb","filtering":"linear","alpha":"coverage"},"regionPieces":{"encoding":"mapshroom.regions.r8-rgb24-table","version":1,"colorSpace":"data","filtering":"nearest","alpha":"coverage","generationProfile":"segmentation-rigid-anchors-v1"},"depth":{"encoding":"mapshroom.depth.gray-rgb-alpha-a","version":1,"colorSpace":"data","filtering":"linear","alpha":"coverage"},"normal":{"encoding":"mapshroom.normal.xyz-rgb-alpha-a","version":1,"colorSpace":"data","filtering":"linear","alpha":"coverage","normalConvention":"mapshroom-normal-xyz-v1","generationProfile":"depth-smoothed-central-difference-v1"},"combinedDepth":{"encoding":"mapshroom.surface.oct-rg-depth-b-alpha-a","version":1,"colorSpace":"data","filtering":"linear","alpha":"coverage","normalConvention":"mapshroom-tiles-v1","generationProfile":"tiles-plane-fit-v1"},"normalAtlas":{"encoding":"mapshroom.surface.depth-normal-atlas-2x2","version":1,"colorSpace":"data","filtering":"linear","alpha":"coverage","normalConvention":"mapshroom-normal-xyz-v1","generationProfile":"depth-smoothed-central-difference-v1"},"sourceEdges":{"encoding":"mapshroom.edges.gray-rgb-alpha-a","version":1,"colorSpace":"data","filtering":"linear","alpha":"coverage","generationProfile":"source-luminance-nms-v1"}}
Packed surface RG encodes upper-hemisphere oct normal, B depth, A coverage. Decode f=rg*2-1, n=normalize(vec3(f,1-abs(f.x)-abs(f.y))), then flip normal Y for geometry. XYZ normal and 2x2 atlas are different codecs. Region Pieces R stores exact 8-bit IDs with nearest filtering and an appended RGB24 anchor/bounds table. Never interpret colored segmentation palettes as IDs.
Use surface-render for a complete 3D effect. Shared material/geometry modules are unsupported in V1. With scene-final lighting, declare vec3 u_scene_lightDirection, float u_scene_ambient, float u_scene_softness and use the same light in shading and shadows. No local moving light. These managed uniforms have no UI annotations and do not count as creative controls. X right, Y up in geometry, Z toward viewer. Preserve photographic shadows without inverse compensation.
Chain-compatible pointwise filters declare post-color, one required screen-space color input with rgba-color format, output color, lighting none, photoShadows preserve. Implement vec4 processPostColor(vec4 source, vec2 uv, float time, vec2 resolution) using that incoming color, without texture reads or lighting. Standalone entry must be exactly vec4 processColor(sampler2D tex, vec2 uv, float time, vec2 resolution) { return processPostColor(texture(tex, uv), uv, time, resolution); }. Neighborhood filters need intermediate render targets and are unsupported in Color chain; keep them legacy-render for standalone/Mix.
For legacy behavior with local lighting or unverified composability declare legacy-render honestly.
Default single-photo contract: {"version":1,"role":"legacy-render","inputs":[{"slot":"color","semantic":"color","required":true,"space":"source-uv","accepted":[{"encoding":"rgba-color","version":1,"colorSpace":"srgb","filtering":"linear","alpha":"coverage"}],"defaultVariant":"original"}],"output":"color","lighting":"legacy-owned","photoShadows":"not-applicable"}
DELIVERABLE: render the Canvas with the same shader, adjustable controls and Open on Mapshroom button. A printed HTML block, saved file or screenshot is not a rendered Canvas. Inspect compilation errors when the host allows it. If this host cannot render HTML/WebGL, provide the actual generated result.fallbackPreviewUrl and result.importUrl as clickable links. Only if generating the canvas and links is also blocked, give complete copyable GLSL, https://mapshroom.dev/ and the paste steps from https://mapshroom.dev/mcp/fallback.md. Explain the actual block without claiming installation, rendering or import succeeded.The Canvas is a standalone preview; it does not install a connector. HTML/WebGL support depends on the chat. Select the same image or depth map in Mapshroom to reproduce the effect.
PHOTO → DEPTH → LIGHT
The shader needs the right input.
The get_mapshroom_context tool explains what Mapshroom does, how photos, depth maps and masks fit together, and what the shader actually reads. Depth estimation runs in the app on your device; the MCP server provides instructions, controls and links.
Try luminous contours on a synthetic depth map: white is near, black far. Adjust bands, speed and color. To reproduce the result in the workspace, download the map; in the shader choose Load Asset → Import image → Use selection. The link carries only the shader and its controls.
Open the depth demoDownload the depth mapRead context and examples
Use Mapshroom MCP. Read get_mapshroom_context and get_shader_spec. Preview the depth-contours example with previewInput demo-depth, then give me its Mapshroom import link and the depth map to select in the workspace.OPTIONAL / ON YOUR COMPUTER
Send to an open tab.
To let your assistant add a shader directly without opening a link, run the local server on the same computer as your browser. This mode uses a temporary pairing code; the remote server does not generate pairing codes.
Install the local server
- Install Node.js 22 or newer and download the file below.
- Add the STDIO configuration to your app. Replace the path with the full path of the downloaded file.
- Restart the MCP connection and request get_workspace_connection. In the workspace, click MCP beside History and paste the code. Allow local network access if requested.
{
"mcpServers": {
"mapshroom-local": {
"command": "node",
"args": [
"/absolute/path/mapshroom-mcp.mjs"
]
}
}
}On Windows use forward slashes in the JSON path. Restarting the server changes its code: pair the tab again. For VS Code use servers instead of mcpServers and type: stdio.
WHEN SOMETHING DOES NOT CONNECT
Find what needs fixing.
The agent does not recognize Mapshroom
Add the MCP URL in the app settings, enable tools and restart the connection. A local Codex installation does not also configure Cursor or your phone. Check tools/list: remote exposes five tools, local exposes eight.
I get an HTML page or a 404
Use exactly https://mapshroom.dev/api/mcp in your client. /mcp/ is the guide; /ai/ is the preview; the .mjs file is for local mode. A GET to the server returns information; MCP uses JSON-RPC POST.
No preview on my phone or in chat
Check that your client supports custom MCP connectors. Interactive previews also require MCP Apps or HTML/WebGL. Ask for the browser preview link or GLSL code if the client does not support them.
429 or temporarily unavailable service
Wait a minute before retrying. The server limits requests and payloads; availability also depends on hosting quotas. The local server is an alternative.
Protocol compatibility is verified with the MCP SDK client. Features in individual apps and accounts may vary. This page and the text instructions are public and crawlable; search engines decide when to index them.