# Set up a connection: Connect your AI in minutes.

Copy one setting, paste one prompt, and your AI works with MatterSpace Duplex from the next request. Add hooks wherever a step should be checked before it runs.

Source: https://www.matterspace.ai/duplex/docs/connections

## For agents

### Your job during setup
Help the user connect their client to MatterSpace Duplex without ever handling their key in plain text.

### Steps
1. Ask which client they use: Claude Code, Codex, Cursor, GitHub Copilot, claude.ai, Claude Desktop, ChatGPT, another MCP client or their own agent.
2. For a key-based client, have them export `DUPLEX_API_KEY` (and optionally `DUPLEX_SCOPE`) in their environment, then give the exact setting from this page for their client.
3. For claude.ai, Claude Desktop or ChatGPT, walk them through adding a custom connector with the address `https://api.duplex.matterspace.ai/mcp` and OAuth sign-in. No key.
4. If their client has hooks (Claude Code, Codex, Cursor, GitHub Copilot CLI) and they want steps checked before they run, have them run `duplex-hook setup --url <address> --scope <scope>` and then `duplex-hook status`.
5. Have them paste the standing prompt that matches their client: with hooks, or without hooks.
6. Start a new session, then call `duplex_status {show: "capabilities"}` and report the scope, the guarantee (advisory or hooked) and the tools the key may use.

### Never
- Never ask the user to paste their key into the chat, and never write a key into a committed file.
- Never claim the connection works because a tool is listed. It works when `duplex_status` answers with the user's scope.

### If it fails
- 401: the key or address is wrong, or the key was rotated.
- 403: the key doesn't reach that scope or lacks the permission.
- Tools missing: the session started before the connection was added. Start a new session.

Where to find more in the MatterSpace Duplex docs:
- Set up a connection, this topic in full: https://www.matterspace.ai/duplex/docs/connections.md
- Every prompt, and where to paste the standing ones: https://www.matterspace.ai/duplex/docs/prompts.md
- Exact tools, operations, settings and answers: https://www.matterspace.ai/duplex/docs/reference.md
- Errors and what to do about them: https://www.matterspace.ai/duplex/docs/troubleshooting.md
- Every docs page, with what it covers: https://www.matterspace.ai/duplex/docs/llms.txt

## For people

### Start with your key

Make a key in your console and keep it in your environment. Every setting below reads it from there, so it never lands in a file you commit.

Your key and scope (macOS and Linux. On Windows, set the same variables in your user environment.):

```
export DUPLEX_API_KEY="<your key>"
export DUPLEX_SCOPE="eng:platform/you"   # optional
```

Tip: On the hosted service, the address is https://api.duplex.matterspace.ai/mcp. In a dedicated environment or your own cloud, use the address your console shows.

### Which connection each AI uses

The clients run on macOS, Linux and Windows.

| Your AI | Look up rules and methods | Check selected steps | Set up with |
| --- | --- | --- | --- |
| Claude Code | MCP | Duplex hooks | One command, or .mcp.json for the team |
| Codex | MCP | Duplex hooks | One command, or config.toml |
| Cursor | MCP | Duplex hooks | .cursor/mcp.json |
| GitHub Copilot | MCP | Duplex hooks in the CLI, or repository hooks | .vscode/mcp.json, or the CLI package |
| claude.ai, Claude Desktop, ChatGPT | MCP | Not over MCP alone | A connector: the address and a sign-in |
| Any MCP client | MCP | Not over MCP alone | The address and your key |
| Your own agents | MCP, or the API and SDKs | Not over MCP alone | A key scoped to one workspace |

### Claude Code

For you, in one command:

```
claude mcp add --transport http duplex https://api.duplex.matterspace.ai/mcp --header "Authorization: Bearer ${DUPLEX_API_KEY}"
```

For your whole team: .mcp.json at the project root (Each person’s own key and scope are read from their environment.):

```
{
  "mcpServers": {
    "duplex": {
      "type": "http",
      "url": "https://api.duplex.matterspace.ai/mcp",
      "headers": {
        "Authorization": "Bearer ${DUPLEX_API_KEY}",
        "x-duplex-scope": "${DUPLEX_SCOPE:-}"
      }
    }
  }
}
```

### Codex

In one command:

```
codex mcp add duplex --url https://api.duplex.matterspace.ai/mcp --bearer-token-env-var DUPLEX_API_KEY
```

Or in config.toml:

```
# ~/.codex/config.toml
[mcp_servers.duplex]
url = "https://api.duplex.matterspace.ai/mcp"
bearer_token_env_var = "DUPLEX_API_KEY"
```

### Cursor

.cursor/mcp.json in the project, or ~/.cursor/mcp.json for you:

```
{
  "mcpServers": {
    "duplex": {
      "url": "https://api.duplex.matterspace.ai/mcp",
      "headers": {
        "Authorization": "Bearer ${env:DUPLEX_API_KEY}"
      }
    }
  }
}
```

### GitHub Copilot in VS Code

.vscode/mcp.json (VS Code asks for your key once, as a password.):

```
{
  "servers": {
    "duplex": {
      "type": "http",
      "url": "https://api.duplex.matterspace.ai/mcp",
      "headers": {
        "Authorization": "Bearer ${input:duplex-api-key}"
      }
    }
  },
  "inputs": [
    { "id": "duplex-api-key", "type": "promptString", "password": true, "description": "MatterSpace Duplex key" }
  ]
}
```

### claude.ai, Claude Desktop and ChatGPT

A connector takes the address alone and signs you in. No key needed.

A connector lands you in your own personal workspace. An organization’s workspace is reached with a key.

1. **Claude.** Settings → Connectors → Add custom connector. Name it MatterSpace Duplex, paste https://api.duplex.matterspace.ai/mcp and leave the advanced settings empty.
2. **ChatGPT.** Settings → Apps & Connectors → Advanced settings → Developer mode on. Then Create, paste the same address and choose OAuth.
3. **Sign in and allow.** Sign in with your MatterSpace Duplex account. The page names the app the access goes to: choose Allow.
4. **Turn it on in a chat.** Turn the connector’s tools on, and paste the prompt without hooks into the project’s instructions.

### Any MCP client, or your own agents

Your own agents can also use the API, the Python and TypeScript SDKs, or the command line, with a key scoped to one workspace.

Address and headers:

```
URL:     https://api.duplex.matterspace.ai/mcp   (streamable HTTP)
Header:  Authorization: Bearer <your key>         (or x-duplex-key: <your key>)
Scope:   x-duplex-scope: <your scope>             (when a key is shared by a team)
```

### Add hooks: check a step before it goes ahead

In Claude Code, Codex, Cursor and GitHub Copilot CLI, the Duplex package adds the connection, its hooks and its commands in one install, once you agree. Give the hooks your address and key once:

1. **Choose the steps.** Pick the steps that should be checked, and what happens when a rule applies.
2. **First check.** Try a step the rule covers, and one it doesn’t. The covered step is checked; the other is labeled as outside the check.
3. **See the record.** Open the record for the checked step: the rule, the outcome and any review.

macOS and Linux:

```
duplex-hook setup --url https://api.duplex.matterspace.ai --scope eng:platform/you
duplex-hook status
```

Windows, in PowerShell:

```
& "<package folder>/hooks/duplex-hook.cmd" setup -Url https://api.duplex.matterspace.ai -Scope eng:platform/you
```

Tip: MCP gives your AI guidance and tools, and your AI takes the action. Hooks let Duplex check the action itself, before it runs. Disconnecting restores your previous settings exactly.

### Paste the prompt and make the first check

Paste the standing prompt for your client, then ask your AI which Duplex workspace it reaches. It names yours, with the guarantee of the connection.

[Standing prompts](https://www.matterspace.ai/duplex/docs/prompts#standing) · [Your first session](https://www.matterspace.ai/duplex/docs/first-session)

### If it isn’t working

1. **Check the workspace.** Make sure you signed in to the right organization and workspace.
2. **Check the client.** Make sure your AI tool supports the connection you chose.
3. **Start a new session.** Refresh the connection’s tools and start again: a running session keeps the tool list it began with.
4. **Check the hooks.** Run duplex-hook status to see whether Duplex answers your hooks.
5. **Tell us.** Say what you tried and what happened, leaving out passwords and private details.

[Troubleshooting](https://www.matterspace.ai/duplex/docs/troubleshooting) · [Support](https://www.matterspace.ai/support)

## Prompts

### Set up Duplex for my client (ask your AI)

```text
Help me connect MatterSpace Duplex to this client. Ask me which client I use, then give me the exact setting to add. My key is already exported as DUPLEX_API_KEY; never ask me to paste it here. When we're done, check the connection with duplex_status and tell me the scope and guarantee you see.

Where to find more in the MatterSpace Duplex docs:
- Set up a connection, this topic in full: https://www.matterspace.ai/duplex/docs/connections.md
- Every prompt, and where to paste the standing ones: https://www.matterspace.ai/duplex/docs/prompts.md
- Exact tools, operations, settings and answers: https://www.matterspace.ai/duplex/docs/reference.md
- Errors and what to do about them: https://www.matterspace.ai/duplex/docs/troubleshooting.md
- Every docs page, with what it covers: https://www.matterspace.ai/duplex/docs/llms.txt
```

### First check after connecting (ask your AI)

```text
Call duplex_status with show "capabilities". Tell me the scope you reach, the guarantee this connection gives, and the tools my key may use.

Where to find more in the MatterSpace Duplex docs:
- Set up a connection, this topic in full: https://www.matterspace.ai/duplex/docs/connections.md
- Every prompt, and where to paste the standing ones: https://www.matterspace.ai/duplex/docs/prompts.md
- Exact tools, operations, settings and answers: https://www.matterspace.ai/duplex/docs/reference.md
- Errors and what to do about them: https://www.matterspace.ai/duplex/docs/troubleshooting.md
- Every docs page, with what it covers: https://www.matterspace.ai/duplex/docs/llms.txt
```
