Host[AI]frica

HostAfrica Developer Platform

Connecting Claude to the API with MCP

Give Claude Desktop or Claude Code direct access to manage your HostAfrica VPS infrastructure through the Model Context Protocol (MCP). Once connected, you can list services, take snapshots, reboot servers, and manage firewall rules in plain language, without leaving your Claude session.

This guide covers Claude Desktop, Claude Code, and Claude Connectors. If you use ChatGPT or OpenAI Codex instead, see Connecting ChatGPT 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 Claude:

Connect via Claude Desktop

Claude Desktop reads MCP servers from a local config file. It reaches the HostAfrica HTTP MCP server through the mcp-remote bridge, which passes your Bearer token with every request. Claude Desktop is available for macOS and Windows. The whole setup takes a couple of minutes.

1. Open the config file

Open claude_desktop_config.json in your editor. It lives at:

  • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
  • Windows: %APPDATA%\Claude\claude_desktop_config.json

2. Add the HostAfrica MCP server

Add the following entry. Claude Desktop runs mcp-remote via npx to reach the HostAfrica HTTP MCP server, passing your token in the Authorization header. Replace <your-token> with the token you generated.

{
  "mcpServers": {
    "hostafrica-api": {
      "command": "npx",
      "args": [
        "mcp-remote",
        "https://api.hostafrica.com/mcp",
        "--header",
        "Authorization: Bearer <your-token>"
      ]
    }
  }
}

3. Restart Claude Desktop

Fully quit Claude Desktop, not just close the window, and reopen it. MCP servers are only loaded on startup. On macOS, right-click the Dock icon and choose Quit; on Windows, right-click the system tray icon.

4. Confirm the connection

The HostAfrica server is then listed under Customize > Connectors > Desktop in Claude Desktop. Start a new conversation and ask Claude List all my HostAfrica VPS services; your servers should appear immediately.

Connect via Claude Code

Claude Code manages MCP servers through the CLI and authenticates with a static Bearer token, so one command is all it takes - no config file editing required.

1. Add the MCP server

Run this command in your terminal. The -s user flag stores the server in your global user config so it is available in every project. Replace <your-token> with the token you generated.

claude mcp add \
  --transport http \
  -s user \
  hostafrica \
  https://api.hostafrica.com/mcp \
  --header "Authorization: Bearer <your-token>"

Alternatively, use the JSON form if you prefer a single command:

claude mcp add-json hostafrica \
  '{"type":"http","url":"https://api.hostafrica.com/mcp","headers":{"Authorization":"Bearer <your-token>"}}'

2. Verify the server is registered

List your configured MCP servers to confirm hostafrica appears:

claude mcp list
hostafrica    http    https://api.hostafrica.com/mcp

3. Use it in any session

Start Claude Code and ask it to use your servers directly - the MCP connection is available in every session automatically. It works alongside your code tasks: deploy your app, then ask Claude to reboot the server, all in one conversation.

Scoped to a project? Omit -s user to store the server in the project's .claude/ folder instead, so only that project can access it.

Connect via Claude Connectors

For Claude connectors (Claude web https://claude.ai and Claude Desktop) we support an endpoint, https://mcp.hostafrica.com/mcp which is compliant with MCP clients requiring OAuth 2.0. You can currently create a custom connector in Claude using this endpoint (add https://mcp.hostafrica.com/mcp as the remote server MCP URL). Alternatively you will be able to add the HostAfrica connector from the directory once it is listed there. When adding the HostAfrica connector with either method you will be asked to authenticate with your HostAfrica API token.

What you can ask Claude

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

  • List all my VPS services and their IP addresses.
  • Take a snapshot of api3.my.api.server before I deploy.
  • Reboot my.api.server and tell me when it is back up.
  • Show the firewall rules for my main server, then open port 443 if it is closed.
  • Set up a weekly backup schedule for all three South Africa servers.
  • What is the power state and IP of each VPS right now?

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 (opens in new tab).

Security reminder: never share your secret token with anyone. HostAfrica support will never ask you for your token, but can help you generate a new one if needed.

Ready to connect? Create a HostAfrica account (opens in new tab), generate your API token in the HostAfrica client area (opens in new tab), and have Claude managing your servers in minutes. For general support and feedback, submit a query (opens in new tab) through your client area.