Use Google Gemini CLI and MCP to Connect with TNZ

Connect Google Gemini CLI to TNZ services using the Model Context Protocol (MCP). Send SMS, Email, and Voice directly from your AI terminal environment.

The TNZ Model Context Protocol (MCP) client acts as a bridge between Gemini CLI and TNZ's messaging suite.

By integrating the TNZ MCP client with the Google Gemini CLI, you empower your AI environment to interact directly with the TNZ CPaaS platform.

You'll be able to use natural language prompts to trigger SMS, Email and Voice messages, effectively giving your AI the ability to reach out to the real world.

Prerequisites

Before configuring the Gemini CLI, ensure you have completed the following:

  1. TNZ Account: You must have an active TNZ account with an API Auth Token.

  2. Gemini CLI Installed: Ensure the Google Gemini CLI is installed and running.

  3. TNZ MCP Installed: You must have the tnz-mcp Python package installed. Refer to this guide: TNZ MCP Client

 

Understanding the Integration

The Gemini CLI is designed to be extensible:

  • Gemini CLI acts as the client (the interface you type into).

  • TNZ MCP acts as the server (the tool that translates AI intent into TNZ API calls).

When you type a command like "Send an SMS to +6421...", Gemini analyses the intent, routes it through the MCP configuration, and the TNZ Python plugin executes the message delivery.

 

Configuration Steps

To enable the integration, you must register the tnz-mcp server within the Gemini CLI configuration file. The CLI supports two connection methods: Stdio (Standard Input/Output) and HTTP.

1. Locate or Create the Configuration File

The Gemini CLI looks for a settings.json (or sometimes config.json) file to load external tools. The location of this file depends on your operating system:

  • Linux/macOS: ~/.gemini/settings.json

  • Windows: %USERPROFILE%\.gemini\settings.json

If the .gemini folder or settings.json file does not exist, create them manually.

 

2. Edit the Configuration

Open the JSON file in your preferred text editor and add the mcpServers block using one of the methods below.

Stdio Mode (Recommended for Local Use)

This method runs the TNZ MCP server directly within the Gemini process. It is the simplest way to get started.

This tells Gemini CLI to run tnz-mcp as a stdio-based MCP server using the appropriate AuthToken.

{
...
"mcpServers": {
...
"tnz-mcp": {
"command": "tnz-mcp",
"transport": "stdio",
"env": {
"TNZ_AUTH_TOKEN": "Your-Auth-Token-Here"
}
}
}
}

 

HTTP Mode (For Remote/Networked Servers)

Use this method if you are running the TNZ MCP server separately (e.g. via Docker or on a remote machine) and exposing it via a URL.

{
...
"mcpServers": {
...
"tnz-mcp": {
"command": "tnz-mcp",
"transport": "http",
"url": "http://localhost:8000",
"env": {
"TNZ_AUTH_TOKEN": "Your-Auth-Token-Here"
}
}
}
}

 

 

Verifying the Installation

Once you have saved your settings.json file: 

Step 1: Restart your terminal

Restart your terminal to ensure the changes take effect.

 

Step 2: Check Server Status

Run the following command in your terminal to list the active MCP servers:

gemini mcp list

Configured MCP servers:
✓ tnz-mcp: tnz-mcp (stdio) - Connected

You should see an output confirming the connection.

Step 3: Test Functionality

Interact with Gemini using natural language to test the connection. Try the following prompt:

Send an SMS to +6421001002 with the message 'Test from Gemini' using tnz-mcp

If configured correctly, Gemini will confirm the action and send the SMS.

 

Troubleshooting

  • Key Names: Depending on the version of the Gemini CLI you are using, the configuration key might be mcpServers or simply tools. If mcpServers does not work, consult the official Gemini CLI documentation for the exact syntax of your version.

  • Path Issues: Ensure the tnz-mcp command is in your system's PATH. If Gemini cannot find the command, provide the full absolute path to the python executable in the JSON config (e.g., /usr/bin/python3 -m tnz_mcp).

  • Authentication: If you receive a 401 error, double-check that your TNZ_AUTH_TOKEN is copied correctly without extra spaces.


Topics:   Developers Installation

Start your free trial today!

Ready to revolutionise your messaging?
Connect with people anywhere - boost engagement, responses and conversations.

20 credits over 14-days. No obligation. No credit card required.