# Codex

You can connect the hosted BoldSign MCP Server to OpenAI Codex to automate eSignature workflows through natural language. This setup uses API key authentication with the BoldSign MCP endpoint.

## Before You Begin

- Obtain your BoldSign API key from {% customlink href="/authentication/api-key/" text="API key settings" /%}.
- Choose the hosted MCP endpoint from {% customlink href="/boldsign-mcp-server/overview/#production-regional-endpoints" text="Regional Endpoints" /%} that matches your BoldSign account region.
- Ensure that Codex is installed and supports connecting to external MCP servers.

## Setup Steps

### Step 1: Set the API Key Environment Variable

Set the `BOLDSIGN_API_KEY` environment variable before starting Codex.

**Linux/macOS**

```bash
export BOLDSIGN_API_KEY="your-api-key-here"
```

**Windows (PowerShell)**

```powershell
$env:BOLDSIGN_API_KEY="your-api-key-here"
```

{% note %}

Never hardcode your API key directly in source code. Use environment variables or a secrets manager to keep credentials secure.

{% /note %}

### Step 2: Configure the BoldSign MCP Server

Add the BoldSign MCP server configuration to your Codex configuration file.

**Configuration file locations**

- Linux/macOS: `~/.codex/config.toml`
- Windows: `C:\Users\<username>\.codex\config.toml`

Add the following configuration:

```
[mcp_servers.boldsign]
url = "https://mcp.boldsign.com/mcp"
env_http_headers = { "X-API-Key" = "BOLDSIGN_API_KEY" }
```

Replace the endpoint with the regional URL that matches your BoldSign account. Using the wrong region can cause authentication failures.

### Step 3: Verify the Configuration

Run the following command to verify that the MCP configuration is valid:

```bash
codex mcp list
```

The BoldSign MCP server should appear in the list without any configuration errors.

### Step 4: Start Codex

Start Codex in your project directory:

```bash
codex
```

### Step 5: Verify the Connection

Once Codex is running, use:

```text
/mcp
```

Verify that the BoldSign MCP server appears in the active MCP server list and that its tools are available.

### Step 6: Test with a Read-Only Prompt

Start with a read-only prompt to verify everything is working:

- `List my BoldSign templates`
- `Show my recent documents`
- `List contacts in my BoldSign account`

## Troubleshooting

- **Server not connecting?** Run `codex mcp list`. If the BoldSign MCP server is not listed, verify your `config.toml` file and ensure it is saved in the correct location.
- **Authentication errors?** Ensure `BOLDSIGN_API_KEY` is set and valid.
- **Wrong region?** Verify the MCP endpoint matches your BoldSign account region.