Usercase

v0.2.27
io.usercase/mcp Checked 4 days ago Published 6 hours ago

Ask real users on your site and run virtual users in a real browser, then fix what they hit.

Usercase MCP Research your website with virtual users, before you have real ones. Open your repository in Claude Code or Codex and ask it to research your site. Your agent reads your code to understand what the site is and who it is for, then casts a handful of virtual users. Each one visits the site in a real browser on your machine, looks around with their own goal, and answers the Usercase survey cards they happen to meet. Their visits and answers show up in your Usercase dashboard. - Free. The AI runs on your own Claude Code or Codex subscription. - Runs on your machine.

Summary extracted from the README.

Usercase MCP

Research your website with virtual users, before you have real ones.

Open your repository in Claude Code or Codex and ask it to research your site. Your agent reads your code to understand what the site is and who it is for, then casts a handful of virtual users. Each one visits the site in a real browser on your machine, looks around with their own goal, and answers the Usercase survey cards they happen to meet. Their visits and answers show up in your Usercase dashboard.

  • Free. The AI runs on your own Claude Code or Codex subscription.
  • Runs on your machine. Your browser, your network, your staging or demo accounts. Passwords never pass through Usercase.
  • Visitors only see the screen. Your agent may read your code to plan the research, but the visitors cannot. A visitor who knows the code finds buttons real people can't, and the research loses its value.

Requirements

  • Claude Code or Codex on your computer, for virtual users. Other MCP clients (Cursor, VS Code …) can do everything else — install the script, plan a research, write questions, fix findings — but can't send virtual users
  • Node.js 18 or later
  • Google Chrome (or run npx playwright install chromium once)
  • A Usercase project with the SDK installed on your site, so the survey cards appear

Connect

It starts a browser on your machine, so it runs in local sessions, not web or cloud ones.

Claude Code

  1. In your repository folder, run:

    claude mcp add usercase -- npx -y @usercase/mcp@latest
    

    This is saved to your Claude Code settings (~/.claude.json), not to your repository. @latest picks up new versions each time Claude Code starts.

  2. Run any Usercase command, such as /mcp__usercase__install. Your browser opens on the Usercase dashboard: sign in, check that the code matches the one in your terminal, and pick the project (or create one). The key is made on your computer and saved in ~/.usercase/credentials.json; only its hash is sent to Usercase. It shows up in Settings → Integrations → API keys, where you can revoke it.

Each repository keeps its own connection, so different sites can go to different projects. To switch this repository to another project, run /mcp__usercase__connect.

Prefer a key? Create one under Settings → Integrations → API keys and add -e USERCASE_API_KEY=eb_sk_... before --. A key you set this way is used first.

Or install it as a plugin, with commands like /usercase:research: /plugin marketplace add usercase-io/usercase-plugin, then /plugin install usercase@usercase.

Codex

codex plugin marketplace add usercase-io/usercase-plugin
codex plugin add usercase@usercase

Commands are skills there: $usercase:research, $usercase:install and so on. The first one opens your browser to connect, as above.

Other MCP clients

Add this to your client's MCP settings (Cursor: .cursor/mcp.json):

{
  "mcpServers": {
    "usercase": {
      "command": "npx",
      "args": ["-y", "@usercase/mcp@latest"],
      "env": { "USERCASE_CLIENT": "other" }
    }
  }
}

Then ask in words, for example "Use Usercase to install its script on this site". Virtual users need Claude Code or Codex.

Commands

In Claude Code (shown below). In Codex use $usercase:<name>; in other clients just ask.

Command What it does
/mcp__usercase__research <url> [count] Sends virtual users to your site. More
/mcp__usercase__install Adds the Usercase script to your site. More
/mcp__usercase__new-research Plans a research from your data and code and saves it as a draft. More
/mcp__usercase__path <research id> Records the route each task is meant to take. More
/mcp__usercase__fix <research id> <finding> Fixes a finding from a research report, or an issue from Issues, in your code. More
/mcp__usercase__question Suggests a question for a precise moment and saves it as a draft. More
/mcp__usercase__steps <window id> Writes the steps for a question you are making in the dashboard. More
/mcp__usercase__connect Connects this repository to another project. More

Wherever a command needs an id, the dashboard shows it ready to copy. You can also just ask your agent, for example "research my staging site with 10 virtual users".

Install the script

The survey cards come from the Usercase script on your site. If it isn't there yet, let Claude Code add it:

/mcp__usercase__install

Claude gets your project's script (from the connected project), puts it once in your root layout or document head, shows you the diff, and opens your local site to check that it loads. It doesn't commit or deploy. Real visitors are recorded once you deploy the change.

Run a research

In Claude Code:

/mcp__usercase__research https://staging.example.com 5

The first time, Claude installs the visitor agent into ~/.claude/agents/ (not your repository) and may ask you to restart Claude Code. Then it:

  1. checks the site once: whether the SDK is running, whether a firewall blocks it, what the first screen shows
  2. reads your repository to understand the site
  3. casts the people and saves them to .usercase/people.json, where you can edit them
  4. sends one visitor per person, up to 5 at a time
  5. summarizes what happened

Keep it going

The number is how many people visit in total (default 5). Above 5, Claude works in rounds of 5: you approve the first list, and after that it casts new people unlike the earlier ones, round after round, until the total is reached.

/mcp__usercase__research https://staging.example.com 30
/mcp__usercase__research https://staging.example.com unlimited

With unlimited it keeps going until you press Esc. Every visit uses your Claude Code or Codex usage.

Focus on one part of the site

Name a part of the site, and Claude casts only people who come for it:

/mcp__usercase__research https://staging.example.com 5 focus=checkout

Take part in a research

Give a research id from your dashboard and the people take part in it instead of exploring freely — they accept its invitation and do its tasks from the study panel, the way invited participants do. The research must be live.

/mcp__usercase__research https://staging.example.com 10 research=<research id>

If the research is moderated by voice, the people read the moderator's captions and answer out loud, with a voice already on your computer (Windows voices, macOS say or espeak). No outside voice service is used.

When a visit ends, it is sent to your dashboard (Visits). If the upload fails, it is kept in .usercase/outbox.jsonl and sent with the next one.

Sites behind a sign-in

Ask Claude to sign in first. It opens Chrome (or Edge) with a fresh, empty profile and you sign in with a demo account, once per account. Google and other sign-in buttons work there. Your usual browser profile is never touched, and the temporary profile is deleted afterwards. Several accounts keep the signed-in visitors from all sharing one history. Only the sessions are saved (.usercase/sessions/), never the password. Claude checks that each sign-in worked, and asks you to sign in again only when one has expired.

Record a task's expected path

A research's task results separate people who went straight from those who took a detour — once the task has an expected path. The task screen in the dashboard shows a command for it:

/mcp__usercase__path <research id>

Claude reads your code to work out the route each task is meant to take, tells you the route, and walks it in a browser. It then walks it again in a fresh browser to make sure every step is found the same way, shows you the screenshots, and saves the path only after you approve it. Picking one item from a list (a product, a post) is not tied to the item Claude happened to open — any item of that kind counts. A local dev server is fine; only page paths are saved.

Questions for a precise moment

The dashboard's New question picks one simple moment (on arrival, after a pause, when leaving, after a click). For a moment made of several steps — "typed a search, opened no result, then did nothing for 10 seconds" — Claude writes it from your code and checks it against your recent real visits. Both need the API key.

You wrote the question, and want it to appear at a precise moment. In New question, choose Several steps and copy the command it gives you:

/mcp__usercase__steps <window id>

Claude reads your question, asks you when it should appear, writes the steps, and sends them back to that window. You see them there, and save the question as usual.

You're not sure what to ask. Run this and tell Claude who you want to hear from:

/mcp__usercase__question

Claude suggests the moment, the question and its answers, and saves it only after you approve — as a draft in your Inbox. Nobody sees it until you turn it on there.

Planning a research

/mcp__usercase__new-research

Claude asks whether you already know what you want to learn. If you don't, it reads your project's findings and where visitors left, and suggests two or three researches, saying which evidence comes from real visitors and which from virtual users. With no data yet, it offers to send a few virtual users first. It then reads your code to write the tasks, their success conditions (the page that means done, or the exact button) and the route each task is meant to take, and shows you all of it at once. On your approval it walks each route in a browser, checks it, and saves the research with the routes — as a draft in your Inbox, where you create it. The routes move into the research when you create it. A draft you discard, or don't create within 30 days, loses its recorded paths and their screenshots.

Fix a finding from a report

A research's Report lists findings: problems people hit, each backed by what they did, what the screen showed and what they wrote. Each finding has a Fix with your agent command:

/mcp__usercase__fix <research id> <finding, e.g. F1>

Add real for the report of real people; without it, the report of virtual users is used. Claude reads the finding and any earlier fixes of it, finds the code behind it, and tells you the change it proposes before touching anything. After you approve, it makes the change, runs your checks and records the fix on the finding. It doesn't commit, push or open a pull request unless you ask.

Once the change is deployed, mark it Live on site on the finding: the report compares people before and after the fix only from then on. To check it with virtual users, run the same tasks again with research=<research id>.

Issues from your questions' answers have the same button in Issues:

/mcp__usercase__fix issue <issue id>

Claude reads the question, what people chose and wrote, and any other issues with the same cause, then works the same way. Once the change is deployed, mark the issue reviewed; the question keeps running, so later answers show whether people still hit it.

What the visitors will and won't do

  • They identify themselves on every request (see below), and their answers are counted separately from real visitors. This cannot be turned off.
  • By default they don't write to your site: only GET, HEAD and OPTIONS requests are sent. They may still press Post, Save or Like like a person would, but nothing reaches your site, and the visitor is told it was not sent. Before the first round Claude asks whether you want those sent for real (for a test or staging site). Your answer is kept in .usercase/settings.json. With writes sent, signed-in visitors use the demo account as their own — they may change its profile name or settings, follow, save and post — so use demo accounts only.
  • They stay on your site and block analytics tools such as Google Analytics and Hotjar.
  • Either way they never pay, delete, connect a wallet, sign out or change a password, and never type into personal fields such as email or phone.
  • They stop when blocked. They do not solve CAPTCHAs or get around bot protection.
  • When the tool cannot do something on your site or misreads the screen, a diagnostic is sent to Usercase so the tool gets better: what failed, the page path, the HTML around the element and a screenshot of that moment. Only the Usercase team sees it, and it is kept for 30 days. Turn it off with USERCASE_DIAGNOSTICS=off.

Running on a production site

Staging is best: bot protection is usually off and analytics are separate. If you run on production, set three things up first, or the visitors may be blocked as an attack or counted as real traffic.

Every visitor request carries:

What Value Use it to
Header X-Usercase-Agent the kind of visitor, e.g. qa-explore separate them in logs and server-side analytics
Header X-Usercase-Key your own secret, sent only to your site let them through your firewall or CDN
User-Agent suffix UsercaseQA/1.0 (<kind>) exclude them in browser analytics and in logs that drop headers
  1. Let them through your firewall. Make a random secret (16+ characters, e.g. node -e "console.log(require('crypto').randomBytes(24).toString('base64url'))"), pass it as USERCASE_AGENT_KEY, and allow requests whose X-Usercase-Key header matches it. Don't allow on X-Usercase-Agent alone; anyone can send that.
  2. Exclude them from analytics. Filter out sessions whose user agent contains UsercaseQA.
  3. Separate them in logs by the header or the user-agent suffix.

Settings

Pass with claude mcp add ... -e NAME=value, codex mcp add ... --env NAME=value, or the env block of your MCP settings.

Name What it does
USERCASE_API_KEY A project API key, instead of connecting in the browser. Used before a saved connection.
USERCASE_AGENT_KEY Your firewall secret (see above). 16+ characters.
USERCASE_ALLOW_WRITE_PATHS Comma-separated path patterns where non-GET requests are allowed, for sites that load pages with POST after sign-in. Everything else stays blocked.
USERCASE_DIAGNOSTICS off stops sending diagnostics. On by default: when the tool cannot do something or misreads the screen (a button cut off or covered, a click that landed elsewhere, a change it did not notice), Usercase receives the kind of failure, the element's shape, the page path, the HTML around the element and a screenshot of that moment, to improve the tool. Only the Usercase team sees them; they are kept for 30 days.
USERCASE_HEADED 1 shows the visitors' browser on screen.
USERCASE_DIR Working folder. Default: .usercase in your repository.

Files it creates

.usercase/ in your repository:

  • people.json: the virtual users. Edit them freely; commit it if you want to reuse them.
  • runs/: visit records.
  • sessions/: one sign-in session per demo account.
  • paths/: screenshots of the expected paths Claude recorded, one folder per task.

runs/ and sessions/ are git-ignored by a .gitignore inside the folder.

Help

usercase.io