MCP NPCs

What is an MCP NPC

An MCP NPC is a pre-placed NPC driven by an external AI agent. The author places the NPC, patrol route, dialogue or attack in the world first, then lets the agent observe, move, fight and speak through MCP.

It is still an NPC, not a player substitute: it cannot press E, pick things up, open gates, change variables, cross scenes or spawn objects. Players still see the world the author built.

  • Good for: letting AI drive an NPC’s performance, patrol, combat or small talk
  • Also good for: using the NPC as a “body” for an external AI while the author still owns the world rules
  • Not for: automation that needs player abilities, the bag or economy logic — use variables, conditions and functions for that

Before you start

You need: a Pro or Studio tier, a multiplayer world, at least one official instance, and an NPC already placed in a scene. The NPC must have movement configured (patrol or wander) to be controllable.

⚠️
MCP works only in official instances; player-created instances never get agents. Single-player worlds cannot enable it.

For talkable NPCs, use a named dialogue. Simple lines only end dialogue by a 12-second timeout or walking away, so pausing agent control is less precise.

Enable MCP and safety switches

  1. Open World Settings → “MCP”; make sure the tier, multiplayer world and official instance all qualify.
  2. Enable MCP: one Agent key is generated automatically (copy it anytime in World Settings; if revoked, turn MCP off and on to regenerate).
  3. Multi-select the NPCs this key may control in “NPC list” (scene name / NPC instance name); use the save icon to update grants later.
  4. Choose speech: free text (platform content moderation must be enabled) or the author phrase library (the UI guides you there when moderation is unavailable); fill phrases in the current world language.
⚠️
Disabling MCP, revoking a key, freezing the world, or deleting/resetting an official instance immediately disconnects online agents and clears their control.

Free speech needs a local banned-terms list or a moderation service. If neither exists, use the phrase library or MCP cannot be enabled.

Create an agent key and grant NPCs

An agent key is a long-lived credential; give it only to your AI agent. Never post it in public chats or screenshots; revoke it in the MCP tab immediately if leaked.

Use one key per agent: different agents can be granted different NPCs, and a problem can be revoked without affecting the others.

💡
Revoking a key disconnects all of its connections; to restore access, create a new key and update the MCP client.

Connect an MCP app

Hosted mode needs no local program: the platform provides an MCP endpoint; you only need an agent key. You do not need to look up the official instance id yourself: World Settings → MCP lists a ready-to-copy URL for each official instance (the instanceId in the URL is the instance id). Put the URL and auth header into an MCP-capable AI tool.

{
  "mcpServers": {
    "scoreup-npc": {
      "type": "http",
      "url": "https://api.scoreup.top/mcp?instanceId=123",
      "headers": { "Authorization": "Bearer p1ag_..." }
    }
  }
}

After initialization the MCP tool carries a session id automatically; do not reuse someone else’s session id. One key may open several sessions, but each NPC can still have only one controller at a time.

Available tools: list controllable NPCs, observe, send a directive, speak, release control, read an NPC definition, view world summary and instance list, and wait for events.

Install in common agents

The configurations below all use the same endpoint and agent key. Replace `https://api.scoreup.top/mcp?instanceId=123` with the URL copied from World Settings and `p1ag_...` with your key. Keep the key only in the `PING1_AGENT_KEY` environment variable, not in files you share.

DeepSeek Harness (DSH): merge this into `~/.dsh/cordis.patch.yml`, and run `export PING1_AGENT_KEY=p1ag_...` before starting. Tool names start with `mcp__scoreup-npc__`.

# ~/.dsh/cordis.patch.yml — merge if the file exists
- insert:
    - id: scoreup-npc
      name: '@deepseek-ai/dsh-mcp-client'
      config:
        serverName: scoreup-npc
        transport: streamable-http
        url: https://api.scoreup.top/mcp?instanceId=123
        headers:
          Authorization: !!js '`Bearer ${process.env.PING1_AGENT_KEY}`'

Claude Code: run the command below in a terminal; `--scope user` makes it available to all projects, or use `project`.

export PING1_AGENT_KEY="p1ag_..."
claude mcp add --scope user --transport http scoreup-npc \
  "https://api.scoreup.top/mcp?instanceId=123" \
  --header "Authorization: Bearer $PING1_AGENT_KEY"

Codex: add the following to `~/.codex/config.toml` (a project `.codex/config.toml` works only in trusted projects), and run `export PING1_AGENT_KEY=p1ag_...` before starting.

# ~/.codex/config.toml
[mcp_servers.scoreup-npc]
url = "https://api.scoreup.top/mcp?instanceId=123"
bearer_token_env_var = "PING1_AGENT_KEY"

Cursor: put the following in `.cursor/mcp.json` at the project root (or the global `~/.cursor/mcp.json`).

{
  "mcpServers": {
    "scoreup-npc": {
      "url": "https://api.scoreup.top/mcp?instanceId=123",
      "headers": {
        "Authorization": "Bearer ${env:PING1_AGENT_KEY}"
      }
    }
  }
}

Gemini CLI: put the following in `~/.gemini/settings.json` (or a project `.gemini/settings.json`); use `httpUrl`, not `url`, for remote connections.

{
  "mcpServers": {
    "scoreup-npc": {
      "httpUrl": "https://api.scoreup.top/mcp?instanceId=123",
      "headers": {
        "Authorization": "Bearer ${PING1_AGENT_KEY}"
      }
    }
  }
}
💡
After restarting or reloading the agent, tools named `mcp__scoreup-npc__…` should appear. If connection fails, check the `instanceId` in the URL, that the key is valid, MCP is enabled, and the instance is official. Other agents that support remote HTTP use the same `url` + `headers` shape; older stdio-only tools can bridge with `npx mcp-remote <endpoint> --header "Authorization: Bearer ..."`.

Directives and speech

  • goto: walk to a scene coordinate; out-of-bounds targets are rejected.
  • follow: follow a player or scene object at a distance.
  • hold: stay in place, useful for dialogue or waiting.
  • attack: player targets only; there is no separate ceasefire directive — use the author’s conditions/variables to stop attacks.
  • release: hand control back; the NPC returns to its authored patrol or idle.

Speech uses free text or the author’s phrase library; lines appear in a bubble above the NPC in both 2D and 3D scenes.

Directives and speech are rate-limited; when rejected, the agent receives a readable error code and retry hint.

Boundaries and limits

  • During player dialogue, agent control pauses: direct and say are rejected and the NPC behaves like a normal NPC. Observe and direct again after dialogue ends.
  • One NPC has only one controller at a time; a second connection gets a lease error.
  • Disabling MCP, freezing the world, deleting/resetting an instance, revoking a key, or removing a grant disconnects immediately.
  • Free speech is moderated before sending (may be delayed); the phrase library is reviewed once when saved, then sent instantly.
  • Pro allows up to 8 controlled NPCs per world and Studio 24, with 3 per scene; agents do not count as online players.

Free speech requires platform-wide content moderation. If it is not enabled, you can still turn on MCP for observe/move/attack; the speech settings will guide you to the author phrase library — fill in phrases and save, with no moderation service to configure yourself.

💡
Keep the NPC’s game rules in the world (conditions, computations, functions, timers); MCP only provides the external driver.

Tips

  • Test in the official instance first; confirm observe, movement and dialogue work before connecting a real agent.
  • Give the agent a clear role, tone and speaking cadence; server-side hard gates are not relaxed by the agent’s persona.
  • For attacking or ceasefire during dialogue, use the NPC’s attack conditions and variables, not agent pauses.
  • After publishing a new version, observe again and resend directives; old directives do not migrate.
  • On permission or lease errors, check the key, MCP switch, official instance and grant list first.