MCP server for TNZ API integration with Claude Desktop and Gemini CLI
Project description
TNZ MCP Server
A Python package to run an MCP (Model Context Protocol) server for TNZ API, enabling integration with Claude Desktop and Gemini CLI.
User Installation Guide
This guide provides step-by-step instructions to install and configure the TNZ MCP server for use with Claude Desktop and Gemini CLI, including how to set up a config.json file to register the MCP server.
Step 1: Install Python
Ensure you have Python 3.9, 3.10, 3.11, or 3.12 installed. Verify with:
python --version
Download Python from python.org if needed.
Step 2: Install the Package
Install the tnz-mcp package using pip:
pip install tnz-mcp
This installs the package and its dependencies (tnzapi>=2.4.1, mcp>=1.0.0).
Step 2.5: Add Python Scripts Folder to PATH (if needed)
When you install tnz-mcp, pip places the executable script (tnz-mcp) in your Python Scripts (Windows) or bin (Linux/macOS) directory. If this folder is not already on your system PATH, you may see errors like command not found or tnz-mcp is not recognized.
Windows
-
Find the Scripts folder, e.g.:
C:\Users\<YourUser>\AppData\Roaming\Python\Python312\ScriptsPlease note "Python312" is the version of your Python, e.g. Python 3.1.2 points to Python312, 3.1.3 points to Python313.
or (if installed for all users):
C:\Python312\Scripts -
Press Win + R, type
sysdm.cpl, press Enter. -
Go to Advanced → Environment Variables.
-
Under User variables, select
Path→ Edit. -
Add the folder path above, click OK, and restart your terminal.
Linux / macOS
Add this line to your shell config (~/.bashrc, ~/.zshrc, etc.):
export PATH="$HOME/.local/bin:$PATH"
Then reload your shell:
source ~/.bashrc
After this, you should be able to run:
tnz-mcp
from anywhere.
Step 3: Set TNZ AuthToken
Register your account
If you don't have an account, head to https://www.tnz.co.nz/Customer/SignUp/ and fill in the form.
Create an API user
To access the API, you'll need a User with API access:
- Log in to the TNZ Dashboard.
- Navigate to 'Users'.
- Create a new user or select an existing one.
- Enable API access (if it's not already enabled).
- Click on the 'API' tab.
- Enable 'Auth Token' and create a new Auth Token.
- Click the 'Copy' button to copy it to your clipboard.
- Paste the Auth Token into the Authorization Header in your application or code.
- At any time, you can refresh your Auth Token by clicking the button and exporting your new Auth Token. This action will invalidate any apps using your old Auth Token.
Auth Tokens can be used for multiple use-cases, with SubAccount and Department values helping in tracking reporting and billing.
API v2.04 utilizes JWT token Authentication. For OAuth2 authentication options, contact your TNZ representative.
The TNZ MCP server requires a TNZ API AuthToken. You can set it using one of the following methods:
-
Environment Variable:
export TNZ_AUTH_TOKEN="Your-Auth-Token-Here"
Replace
Your-Auth-Token-Herewith your actual TNZ API token. -
Config File:
Create a
tnz_mcp.inifile in your working directory:[TNZ] AuthToken = Your-Auth-Token-Here
-
AI Agent Config File:
Add the AuthToken directly in the AI agent's configuration file (e.g.,
settings.jsonorconfig.json). This is done in the sameconfig.jsonused to register the MCP server (see Steps 5 and 6). Include theTNZ_AUTH_TOKENin theenvfield of the MCP server configuration. Examples are provided in Step 5 (Claude Desktop) and Step 6 (Gemini CLI) below, where the AuthToken is set within themcpServersconfiguration.Note: If the AuthToken is set in the AI agent's config file, it will override any token set via environment variable or
tnz_mcp.iniwhen the server is launched by the AI agent.
Step 4: Run the MCP Server
The server can run in stdio (default, for local CLI integration) or HTTP (for remote access).
-
Stdio Mode:
tnz-mcp
This starts the server using stdio, ideal for local use with Gemini CLI or Claude Desktop.
-
HTTP Mode:
tnz-mcp --transport streamable-http --host localhost --port 8000
This starts the server on
http://localhost:8000, suitable for remote or multi-client access.
Step 5: Configure Claude Desktop
Claude Desktop supports MCP servers via a config.json file or its settings UI. Verify Claude Desktop’s documentation for stdio support, as HTTP is more commonly used.
-
** nauseate or Create
config.json**:- Check Claude Desktop’s settings UI or documentation for the configuration file path (e.g.,
~/.anthropic/claude_desktop_config.jsonon Linux/Mac or%USERPROFILE%\\.anthropic\\claude_desktop_config.jsonon Windows). - If
claude_desktop_configdoesn't exist, butconfig.jsondoes, try to useconfig.json - If above doesn't work, create a
claude_desktop_config.jsonorconfig.jsonfile in the specified directory.
- Check Claude Desktop’s settings UI or documentation for the configuration file path (e.g.,
-
Add TNZ MCP Server:
-
Via
claude_desktop_config.json:-
For Stdio:
{ ... "mcpServers": { ... "tnz-mcp": { "command": "tnz-mcp", "transport": "stdio", "env": { "TNZ_AUTH_TOKEN": "Your-Auth-Token-Here" } } } }
Ensure
tnz-mcpis installed and accessible in your PATH. -
For HTTP:
{ ... "mcpServers": { ... "tnz-mcp": { "command": "tnz-mcp", "transport": "http", "url": "http://localhost:8000", "env": { "TNZ_AUTH_TOKEN": "Your-Auth-Token-Here" } } } }
Ensure the server is running with
tnz-mcp --transport streamable-http --host localhost --port 8000.
-
-
-
Restart Claude Desktop: Restart Claude to load the configuration.
-
Verify Integration: Test with a Claude Desktop something like:
Send an SMS to +64211231234 with message "Test from Claude" using tnz-mcp -
Troubleshooting:
- Ensure the server is running before launching Claude.
- Verify the AuthToken is valid (check
tnz_mcp.ini, environment variable, orconfig.json). - If stdio fails, try HTTP mode, as it’s more widely supported.
- Consult Anthropic’s documentation for error logs or advanced configuration.
Step 6: Configure Gemini CLI
Gemini CLI supports MCP servers via a settings.json or config.json file or command-line options.
-
Locate or Create
settings.json:- Find Gemini CLI’s configuration directory (e.g.,
~/.gemini/settings.jsonon Linux/Mac or%USERPROFILE%\\.gemini\\settings.jsonon Windows). Refer to Gemini CLI’s documentation for the exact path. - Create a
settings.jsonfile if it doesn’t exist.
- Find Gemini CLI’s configuration directory (e.g.,
-
Add TNZ MCP Server:
-
For Stdio:
{ ... "mcpServers": { ... "tnz-mcp": { "command": "tnz-mcp", "transport": "stdio", "env": { "TNZ_AUTH_TOKEN": "Your-Auth-Token-Here" } } } }
This tells Gemini CLI to run
tnz-mcpas a stdio-based MCP server with the AuthToken. -
For HTTP:
{ ... "mcpServers": { ... "tnz-mcp": { "command": "tnz-mcp", "transport": "http", "url": "http://localhost:8000", "env": { "TNZ_AUTH_TOKEN": "Your-Auth-Token-Here" } } } }
Ensure the server is running in HTTP mode.
-
-
Run Gemini CLI: Test with a Gemini CLI something like:
Send an SMS to +64211231234 with message "Test from Gemini" using tnz-mcp -
Verify Integration: Check if tnz-mcp has been enabled for Gemini from the terminal:
> gemini mcp list Configured MCP servers: ✓ tnz-mcp: tnz-mcp (stdio) - Connected
Check Gemini CLI’s documentation for exact syntax.
Note: The config.json key names (tools for Claude Desktop, mcpServers for Gemini CLI) may vary depending on the tool’s version or configuration. Verify the exact key names in the respective documentation for Claude Desktop and Gemini CLI.
Step 7: Test the Server
Test the MCP server using MCP Inspector:
npx @modelcontextprotocol/inspector --transport stdio
Or for HTTP:
npx @modelcontextprotocol/inspector --transport http --url http://localhost:8000
This verifies the server’s tools and responses.
Usage
Stdio Mode (Default)
Run the MCP server using stdio for local CLI-based integration:
tnz-mcp
This starts the server in stdio mode, suitable for Gemini CLI or local Claude Desktop integrations.
- Gemini CLI: Use
gemini connect mcp stdioor a compatible wrapper. Check Gemini CLI documentation for exact syntax. - Claude Desktop: Configure Claude to use stdio-based MCP tools (refer to Anthropic's documentation for setup).
HTTP Mode
Run the server over HTTP for remote access:
tnz-mcp --transport streamable-http --host localhost --port 8000
- Claude Desktop: Configure the MCP server URL (e.g.,
http://localhost:8000) in Claude's settings orconfig.json. - Gemini CLI: Use
gemini connect mcp http://localhost:8000or a compatible wrapper.
Features
- Messaging: Send SMS, Email, Fax, TTS, and Voice messages.
- Reports: Check message status, SMS replies, and received messages.
- Actions: Abort, resubmit, reschedule jobs, and set pacing for voice/TTS.
- Addressbook: Manage contacts, groups, and relationships.
- Security: AuthToken loaded securely from environment, config file, or AI agent configuration.
Testing
Run unit tests:
python -m unittest discover tests
License
MIT License. See LICENSE for details.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
File details
Details for the file tnz_mcp-0.1.2.tar.gz.
File metadata
- Download URL: tnz_mcp-0.1.2.tar.gz
- Upload date:
- Size: 13.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
54e930b8310476ba52141fb2ebce1b3cb71a8c8a23578056ac2ec9f99c7a489d
|
|
| MD5 |
77e8102c692916d53479878b0169bba9
|
|
| BLAKE2b-256 |
48994b87312f9234567dbdf127519224a627ea7cb678d2b6d03744f1c84f52d2
|