Skip to content
Limited timeStarter is now $9 a month instead of $20.See plans
charmotion

How to Build and Wire an Interactive Rive Mascot in Cursor from One Prompt

By the Charmotion team · Updated · How we write guides

Cover illustration for the guide: How to Build and Wire an Interactive Rive Mascot in Cursor from One Prompt, with Charmotion demo characters

To build an interactive Rive mascot in Cursor from a single prompt, add a remote MCP server to .cursor/mcp.json, then ask the agent to design the character and its animation set. It returns a .riv file with mood states and integration notes for your React or Next.js app. Each animation costs one credit; idle is free.

Key takeaways

  • Cursor reads remote MCP servers from .cursor/mcp.json, either globally or per project, and needs only a url for an HTTP server.
  • One prompt can cover the design, the animation set and the code, as long as it names the moods and the target file.
  • The .riv file has a CharacterStateMachine with a number input called mood, so your app drives the mascot with fixed numbers.
  • Hosted Cloud Agents do not read the global mcp.json file, so they need the server added on cursor.com/agents.
  • Editing the file in the Rive editor for a product needs a paid Rive plan (as of December 2026).

Already have a character or logo? See examples in real app screens: splash, onboarding, loading and empty-state screens, with the animation that plays in each.

Where does the MCP server go in Cursor's mcp.json?

Cursor reads Model Context Protocol servers from a file named mcp.json. A global file at ~/.cursor/mcp.json applies to every project you open, and a project file at .cursor/mcp.json applies only to that repository. For a mascot you will use across several projects, the global file is the simplest choice. For a team, commit the project file so everyone gets the same server.

Each server sits under a top-level "mcpServers" object, keyed by a name you choose. A remote server needs a url. Charmotion's remote endpoint is https://charmotion.app/mcp, a Streamable HTTP server with OAuth sign-in, so no API key goes in the file:

{
  "mcpServers": {
    "charmotion": {
      "url": "https://charmotion.app/mcp"
    }
  }
}

Cursor expands variables such as ${env:NAME} in the url and headers fields. Use that for any server that needs a secret, so the key stays out of the file. Charmotion's server does not need one. After saving, open Cursor's MCP settings, confirm the server is listed and connected, then complete the sign-in prompt.

Two boundaries matter. Hosted Cloud Agents do not read ~/.cursor/mcp.json; they use servers configured at cursor.com/agents and your team's servers. The Cursor Terminal UI does read .cursor/mcp.json, so a server added in the Agents Window is picked up there too.

What should the single prompt say?

The prompt decides how to build an interactive Rive mascot in Cursor from a single prompt, so it must name the character, the animation set and the output file. Describe one finished, coloured character facing the viewer with visible eyes and a mouth. The agent's design step can draw that character from your description for 1 credit. If you already have an image, give the agent its path instead. A sketch, a photo or a busy scene is refused before anything is charged.

A prompt that covers the whole job looks like this:

Design a friendly round mascot for my habit tracker: a teal blob with big eyes and a small leaf on its head, flat colours, facing forward. Create a character set with launch, happy, wave and loading. Save the .riv to public/mascot.riv in this Next.js project and add a Mascot component that takes a mood prop.

Launch, happy, wave and loading are preselected in the character set, so the prompt can leave them out. Behind the prompt, the agent calls a short sequence of tools:

ToolWhat it doesCredits
design_characterDraws one character from your description or uses your image1 credit
create_character_setBuilds the .riv with the animations you chose1 per animation; idle is free
get_character_setReturns download links and the AI_README integration notesNone
export_videosOptional MP4, GIF, transparent WebM, MOV and 9:16 launch MP4None

An animation the engine cannot make gives its credit back automatically. Each animation is also checked by a review step before delivery, so a weak result is redone rather than handed over.

What is inside the .riv file the agent returns?

The file is one Rive (.riv) document that a runtime loads directly. It contains three state machines and one data binding model:

  • CharacterViewModelMachine uses Data Binding with a number property called mood.
  • CharacterStateMachine has a number input called mood, which your code sets.
  • LaunchStateMachine appears only when you picked launch. It plays the launch intro once and then settles into idle.

Mood numbers are fixed, so code you write today still works after you add animations later:

MoodNumberTypical use in an app
idle0Resting loop, the default state
happy1Success, with sparkles
wave2Greeting or onboarding
thinking3Work in progress
sad4Error
loading5Waiting on a request
listening6User is typing or speaking
talking7Reply is streaming
sleeping8Idle screen or inactive session
attention9Needs the user; shows a "!"

Moods blend into each other, so a change from 0 to 5 does not jump. Some moods show small accents such as Z z z while sleeping and sparkles when happy. The boolean accents hides them. Characters have no one-shot triggers, so a success is shown with happy and an error with sad.

How do you wire the mood states into React or Next.js?

Install the React wrapper for Rive's Canvas2D runtime, which Rive recommends for most apps: npm install @rive-app/react-canvas. Place the .riv in your public folder. In the App Router, the component that calls useRive must be a Client Component, so the file starts with a 'use client' line. The step-by-step setup is in how to use Rive in React and Next.js.

'use client';
import { useRive, useStateMachineInput } from '@rive-app/react-canvas';

const MOOD = { idle: 0, happy: 1, wave: 2, thinking: 3, sad: 4, loading: 5, listening: 6, talking: 7, sleeping: 8, attention: 9 };

export default function Mascot() {
  const { rive, RiveComponent } = useRive({
    src: '/mascot.riv',
    stateMachines: 'CharacterStateMachine',
    autoplay: true,
  });
  const moodInput = useStateMachineInput(rive, 'CharacterStateMachine', 'mood');
  return <RiveComponent />;
}

Set moodInput.value to MOOD.loading when a request starts, and to MOOD.happy or MOOD.sad when it ends. Keep that logic in the code that already tracks request state, so the mascot always reflects the real status. The useStateMachineInput hook is marked deprecated in favour of the newer data binding hooks, so new projects should follow Rive data binding in React and Next.js. The code above uses the mood input directly because it matches the CharacterStateMachine the agent generated.

Map your app state to the numbers in one place:

  • Request started: 5 (loading)
  • Request succeeded: 1 (happy)
  • Request failed: 4 (sad)
  • Waiting for user input: 6 (listening)

For a splash screen, load the file with stateMachines: 'LaunchStateMachine' first, then switch to CharacterStateMachine when the intro ends. The same pattern works in Bolt.new, v0 and Replit projects.

How do you test the mascot before you ship it?

Test the mascot in the same app where users will see it. A preview in a blank page can hide problems with layout and background.

  • Set each mood number once and check that the motion matches the table above.
  • Confirm that the launch intro plays once and then settles into idle.
  • Check the transparent background over your real page colours, both light and dark.
  • Trigger a request and confirm that loading goes to happy or sad, not to a stuck state.
  • Export videos with export_videos if your marketing or store pages need MP4, GIF or transparent WebM copies.

The common mistakes are simple. Developers look for a success trigger and find none, so use happy. They type the mood as a string, so send the number. They forget the Client Component line in Next.js. They also expect the .riv to show a splash screen, which only happens with files exported on Rive's free plan.

When should you open the file in the Rive editor?

Open the file in the Rive editor when you need to change the rig, add a new state machine or adjust a motion by hand. The editor covers state machines, data binding, layouts, scripting and 3D. Rive keeps editable work in a .rev file, and runtimes cannot load .rev files, so you export a new .riv when the edit is done.

Exporting is where plans matter. Rive's free plan cannot export .riv files for an app or product, and its exports play a Rive splash screen. The Cadet plan lists $9 per seat per month with up to 3 seats and exports without the splash screen (as of December 2026). Playing a finished .riv does not need a seat, because the runtimes are open source and load any .riv file. The plan details are in is Rive free and what the plans include.

For the MCP server's setup in other assistants, see the MCP server page, and for plan credits see the pricing page.

How to build an interactive Rive mascot in Cursor from a single prompt

  1. Add the server to mcp.json. Create ~/.cursor/mcp.json for all projects or .cursor/mcp.json for one project, and add an mcpServers entry with the url https://charmotion.app/mcp.
  2. Sign in and confirm the connection. Open Cursor's MCP settings, confirm the server is listed and connected, and complete the OAuth sign-in.
  3. Send one prompt. Describe the character, name the animation set and give the output path, such as public/mascot.riv, in one prompt to the Cursor agent.
  4. Let the agent build the set. The agent calls design_character if needed, then create_character_set and get_character_set, which returns the download links and integration notes.
  5. Wire the mood input. Add a Client Component that calls useRive with CharacterStateMachine and sets the mood number from your app state.
  6. Test every mood before release. Check each mood number, the launch intro, the transparent background and a real request cycle in your own page.

Frequently asked questions

Does the agent need a Rive account to create the mascot?

No. The MCP server builds the .riv file and you sign in with OAuth, with credits coming from your plan. You need a Rive seat only if you open the file in the Rive editor and export it again, and the editor's free plan cannot export .riv files for products (as of December 2026).

Can Cloud Agents in Cursor use this server?

Hosted Cloud Agents do not read ~/.cursor/mcp.json. Add the server at cursor.com/agents or in your team's server list so the cloud agent can call it. Local Cursor sessions and the Cursor Terminal UI read the project file as described above.

Will the same prompt work in Claude Code or VS Code?

The prompt works in any assistant that connects to the server, but each client keeps its own config file. Check that client's documentation for where its server list lives, then add the same remote URL there.

Can I add moods to the character after it is built?

Yes. Use add_animations to add more animations to the same character, and only the new ones use credits. Because mood numbers are fixed, code that already sets the mood numbers keeps working after the update.

Sources

Related guides