HostAfrica Developer Platform

Connecting ChatGPT to the API with MCP

Connect ChatGPT or OpenAI Codex to your HostAfrica VPS infrastructure through the Model Context Protocol (MCP). Once connected, you can reboot servers, check status, take snapshots, and manage firewall rules with plain-language instructions instead of the command line.

This guide covers both OpenAI clients. If you use Claude instead, see Connecting Claude to the API with MCP. For a tool-agnostic overview of the MCP transport, see Connecting to the API with MCP.

Before you start

You need three things before connecting:

Connect via ChatGPT

Available to ChatGPT Plus, Pro, Business, and Enterprise users. Setup takes about two minutes.

1. Enable Developer Mode

Open ChatGPT and go to Settings > Apps > Advanced Settings, then toggle on Developer mode. This unlocks app creation for MCP connections.

2. Create a new connector

Go to Settings > Connectors/Apps > Create. Give it a recognisable name like HostAfrica VPS and a short description such as "Manage my HostAfrica virtual servers." ChatGPT uses the description to decide when to invoke the connector automatically, so be specific.

3. Enter the connection URL

Set the Connection URL to the HostAfrica MCP endpoint. The URL must use HTTPS.

https://api.hostafrica.com/mcp

Under Authentication, select Access Token / API key. Set Header scheme to Bearer, then paste your HostAfrica API token. You can generate one in the HostAfrica Client Area.

4. Test the connection

Save the app and start a new chat. Ask ChatGPT Show me all my VPS services on HostAfrica and it should list your servers immediately - no commands, no SSH.

Connect via Codex CLI

Codex supports MCP servers natively through its config file, which is ideal for automation scripts and terminal-based workflows.

1. Install the Codex CLI

If you have not already, install the OpenAI Codex CLI globally via npm (requires Node.js 18 or later):

# requires Node.js 18+
npm install -g @openai/codex

2. Add the HostAfrica MCP server

Codex stores MCP configuration in ~/.codex/config.toml. Add the HostAfrica server under the [mcp.servers] section. Replace <your-token> with the token you generated.

[mcp.servers.hostafrica]
type    = "http"
url     = "https://api.hostafrica.com/mcp"

[mcp.servers.hostafrica.headers]
Authorization = "Bearer <your-token>"

To scope this to a single project instead, place the file at .codex/config.toml in your project root.

3. Verify the server is connected

Launch Codex and type /mcp inside the TUI to see all active MCP servers. You should see hostafrica listed with a connected status.

codex
# inside the TUI:
/mcp
hostafrica   connected   https://api.hostafrica.com/mcp

4. Start giving instructions

With the server connected, Codex can manage your infrastructure as part of any task, alongside writing code, generating scripts, or debugging deployments.

What you can say to your AI

Once connected, describe what you want in plain language and your AI calls the right MCP tools for you:

  • List all my VPS services and their IP addresses.
  • Reboot my api.server VPS.
  • Take a snapshot of api3.my.api.server before I deploy.
  • Show me the firewall rules for service 184442.
  • Create a daily backup schedule for all three of my servers.
  • What is the current power state of each VPS?

Security notes

Your API token grants its bearer the same permissions you have over your account resources. Treat it like a password:

  • Do not share it with others.
  • Do not commit it to version control - use environment variables or a secrets manager.
  • If you believe it has been compromised, rotate or revoke it yourself in the HostAfrica Client Area.

Ready to connect? Create a HostAfrica account, generate your API token in the HostAfrica Client Area, and have your first server responding to plain-English commands in minutes. For general support and feedback, submit a query through your client area.