# Set up the NewInstance MCP server

NewInstance exposes its platform to AI agents as an MCP server.

- Server URL: https://service.newinstance.cloud/mcp
- Transport: Streamable HTTP (stateless, POST only)
- Sign-in: OAuth 2.1 in the person's browser, started by your client.

Never ask the person for an API key, password or token. Add the server below, then let the client start sign-in.

## 1. Add the server

Pick the section for the client you run in.

### Claude Code

Needs version 2.1.231 or later.

```
claude mcp add --transport http newinstance https://service.newinstance.cloud/mcp
claude mcp login newinstance
```

Tip: add `--scope user` to the add command to use it in every project. Without it, the server is added for the current folder only.

Run the login from a shell, or run `/mcp`, choose newinstance, then Authenticate. The server's tools load in the next Claude Code session, so tell the person to start a new session. `claude mcp list` shows the connection status.

### Cursor

Edit `~/.cursor/mcp.json` (all projects) or `.cursor/mcp.json` (one project):

```
{"mcpServers":{"newinstance":{"url":"https://service.newinstance.cloud/mcp"}}}
```

Cursor prompts for sign-in when the server is enabled.

### Claude Desktop and claude.ai

Open Settings (or Customize), Connectors, Add custom connector, enter https://service.newinstance.cloud/mcp, then Connect and sign in. On Team and Enterprise, an owner adds it under Organization settings, Connectors, and members then click Connect. These clients connect from Anthropic's cloud, so the URL must be publicly reachable. Do not use claude_desktop_config.json, it is for local servers only.

### VS Code and GitHub Copilot

Run the command `MCP: Add Server` and choose HTTP, or create `.vscode/mcp.json`:

```
{"servers":{"newinstance":{"type":"http","url":"https://service.newinstance.cloud/mcp"}}}
```

VS Code prompts for sign-in on first connect. `MCP: List Servers` shows the status.

### Windsurf

Edit `~/.codeium/windsurf/mcp_config.json`:

```
{"mcpServers":{"newinstance":{"serverUrl":"https://service.newinstance.cloud/mcp"}}}
```

### OpenAI Codex CLI

```
codex mcp add newinstance --url https://service.newinstance.cloud/mcp
codex mcp login newinstance
```

Or edit `~/.codex/config.toml`: `[mcp_servers.newinstance]` then `url = "https://service.newinstance.cloud/mcp"`. Then run `codex mcp login newinstance` to sign in. `/mcp` in Codex shows it.

### Gemini CLI

```
gemini mcp add --transport http newinstance https://service.newinstance.cloud/mcp
```

Then run `/mcp auth newinstance`. Or edit `~/.gemini/settings.json`:

```
{"mcpServers":{"newinstance":{"httpUrl":"https://service.newinstance.cloud/mcp"}}}
```

Use httpUrl, not url, which means SSE.

### Any other client

Use Streamable HTTP POST. Discover OAuth 2.1 from the 401 `WWW-Authenticate` header (`resource_metadata`), register dynamically and use PKCE S256. A stdio-only client can run `npx -y mcp-remote https://service.newinstance.cloud/mcp`:

```
{"mcpServers":{"newinstance":{"command":"npx","args":["-y","mcp-remote","https://service.newinstance.cloud/mcp"]}}}
```

## 2. Sign in (what the person sees)

1. If the browser is already signed in to the NewInstance dashboard, the agent connects as that account and there is no sign-in page. Otherwise the NewInstance sign-in page opens.
2. The first time per agent app, a consent page in the NewInstance dashboard names the app and where it returns to.
3. The person clicks Approve and lands back in the agent.

To connect a different account, sign in to the dashboard as that account first.

## 3. Check it worked

Call `list_organizations` and report the organizations to the person.

## 4. What to do next

- `list_organizations`: organizations the person belongs to.
- `search_operations`: find a platform operation by keyword. Always search first.
- `describe_operation`: read an operation's arguments and return fields. Always describe before writing.
- `run_query`: run a read operation.
- `run_mutation`: run a write operation. Changes apply immediately and are audited.
- `setup_status`: see what a product area still needs. Call it before setting an area up. For the Docs Portal, `setup_status` with domain `Docs Portal` returns the design guide.
- `run_setup_plan`: run a multi-step setup plan.

Keys and secrets show as `[hidden]` and cannot be created through the agent until the person turns on "Let my agents create and see keys and secrets" in Account settings, Connected agents. Even then, never print a key or secret back unless the person asks for it.

To write API docs for the Docs Portal, install the collection skill for Claude Code:

```
curl -fsSL --create-dirs --output-dir ~/.claude/skills/docs-portal-collection-style -o SKILL.md https://service.newinstance.cloud/mcp/skills/docs-portal-collection-style/SKILL.md -o scripts/check_collection.py https://service.newinstance.cloud/mcp/skills/docs-portal-collection-style/scripts/check_collection.py -o assets/example-collection.json https://service.newinstance.cloud/mcp/skills/docs-portal-collection-style/assets/example-collection.json
```

## 5. Troubleshooting

- 401 or `invalid_token`: sign in again with your client's login step above.
- Consent page asks to sign in or names another account: sign in to the dashboard as the same person, then retry.
- "Connection ended" or 401 after it worked: the agent was disconnected by the person or an org owner. Reconnect by signing in again.
- 429: wait a minute, then retry.
- 405 on GET: the client must use Streamable HTTP POST, not SSE.
