Skip to main content

Lightweight MCP client for TowardsAGI MCP servers

Project description

TMCP Client

PyPI version Python 3.8+ License: MIT

Lightweight MCP client for TowardsAGI MCP servers

A minimal, efficient client for connecting to TowardsAGI MCP servers via HTTP API. Designed for use with Claude, Cursor, VS Code, and other MCP-compatible applications.

๐Ÿš€ Quick Start

Installation

# Install from PyPI
pip install tmcp-client

# Or use with uvx (no installation required)
uvx tmcp-client

Usage with MCP Applications

Add to your MCP configuration file (e.g., ~/.cursor/mcp.json):

{
  "mcpServers": {
    "my-database": {
      "command": "uvx",
      "args": ["tmcp-client"],
      "env": {
        "TOWARDSMCP_SERVER_URL": "https://your-server.com/",
        "TOWARDSMCP_RESOURCE": "your-resource-name",
        "TOWARDSMCP_API_KEY": "tmcp_your-api-key"
      }
    }
  }
}

๐Ÿ“‹ Configuration

The client requires three environment variables:

Variable Description Example
TOWARDSMCP_SERVER_URL Your TMCP server URL https://beta.towardsmcp.com/
TOWARDSMCP_RESOURCE Resource name to connect to my-database
TOWARDSMCP_API_KEY Your API key tmcp_abc123...

๐Ÿ”ง Installation Methods

Method 1: UVX (Recommended)

No installation required - automatically downloads and runs:

{
  "command": "uvx",
  "args": ["tmcp-client"],
  "env": { ... }
}

Method 2: Global Installation

Install once, use everywhere:

pip install tmcp-client
{
  "command": "tmcp-client",
  "env": { ... }
}

Method 3: Python Module

Use with existing Python installation:

{
  "command": "python",
  "args": ["-m", "tmcp_client"],
  "env": { ... }
}

๐Ÿ—๏ธ Architecture

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”    HTTP/JSON-RPC    โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚   MCP Client    โ”‚ โ—„โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ–บ โ”‚  TowardsAGI      โ”‚
โ”‚ (Claude/Cursor) โ”‚                     โ”‚  MCP Server      โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜                     โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
         โ–ฒ                                        โ”‚
         โ”‚ stdio/JSON-RPC                         โ”‚
         โ–ผ                                        โ–ผ
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”                     โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚   tmcp-client   โ”‚                     โ”‚   Your Database  โ”‚
โ”‚     Bridge      โ”‚                     โ”‚   (PostgreSQL,   โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜                     โ”‚   MongoDB, etc.) โ”‚
                                        โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

๐Ÿ› ๏ธ Development

Local Development

# Clone and install in development mode
git clone https://github.com/TowardsAGI-AI/tmcp-client.git
cd tmcp-client
pip install -e .

# Run tests
pytest

# Format code
black src/
isort src/

Building

# Build package
python -m build

# Install locally
pip install dist/tmcp_client-*.whl

๐Ÿ“š Examples

Basic Usage

import asyncio
from tmcp_client import TMCPBridge

async def example():
    bridge = TMCPBridge()
    
    # List available tools
    tools = await bridge.list_tools()
    print(f"Available tools: {[t['name'] for t in tools]}")
    
    # Call a tool
    result = await bridge.call_tool("query", {"sql": "SELECT 1"})
    print(f"Result: {result}")
    
    await bridge.close()

# Run with environment variables set
asyncio.run(example())

Multiple Resources

{
  "mcpServers": {
    "production-db": {
      "command": "uvx",
      "args": ["tmcp-client"],
      "env": {
        "TOWARDSMCP_SERVER_URL": "https://prod.towardsmcp.com/",
        "TOWARDSMCP_RESOURCE": "prod-database",
        "TOWARDSMCP_API_KEY": "tmcp_prod_key"
      }
    },
    "analytics-db": {
      "command": "uvx", 
      "args": ["tmcp-client"],
      "env": {
        "TOWARDSMCP_SERVER_URL": "https://analytics.towardsmcp.com/",
        "TOWARDSMCP_RESOURCE": "analytics-warehouse",
        "TOWARDSMCP_API_KEY": "tmcp_analytics_key"
      }
    }
  }
}

๐Ÿ” Troubleshooting

Common Issues

"Missing required environment variables"

  • Ensure all three environment variables are set in your MCP config

"Authentication failed (401)"

  • Check your TOWARDSMCP_API_KEY is correct and not expired

"Resource not found (404)"

  • Verify the TOWARDSMCP_RESOURCE name matches your server configuration

"Connection timeout"

  • Check your TOWARDSMCP_SERVER_URL is accessible and correct

Debug Mode

Set TMCP_DEBUG=1 environment variable for verbose logging:

{
  "env": {
    "TOWARDSMCP_SERVER_URL": "...",
    "TOWARDSMCP_RESOURCE": "...",
    "TOWARDSMCP_API_KEY": "...",
    "TMCP_DEBUG": "1"
  }
}

Publishing Build Artifact

cd tmcp-client
twine upload dist/*
Enter your API token: "provoid API tocken from pypi project (tmcp/api_tocken.txt)"

๐Ÿ“„ License

MIT License - see LICENSE file for details.

๐Ÿค Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Add tests
  5. Submit a pull request

๐Ÿ“ž Support


Made with โค๏ธ by TowardsAGI.AI

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

tmcp_client-1.0.3.tar.gz (10.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

tmcp_client-1.0.3-py3-none-any.whl (9.1 kB view details)

Uploaded Python 3

File details

Details for the file tmcp_client-1.0.3.tar.gz.

File metadata

  • Download URL: tmcp_client-1.0.3.tar.gz
  • Upload date:
  • Size: 10.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.2

File hashes

Hashes for tmcp_client-1.0.3.tar.gz
Algorithm Hash digest
SHA256 a05610ae53e0dcf9f590e0f8581e7bb4580c1d8bf4db61a714f85145470746a3
MD5 60fb04341ade08d16db45a332dc899c0
BLAKE2b-256 38305a981745b8ca18a2bb95507ebe4fb3b9844c495d83d24878e40abbdef489

See more details on using hashes here.

File details

Details for the file tmcp_client-1.0.3-py3-none-any.whl.

File metadata

  • Download URL: tmcp_client-1.0.3-py3-none-any.whl
  • Upload date:
  • Size: 9.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.2

File hashes

Hashes for tmcp_client-1.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 c0e52d9404846ba62e832a64e6c287b497731de078583756ad48ee69a4899d8a
MD5 2a6a7308b908dd75652ae9e50f0e1b4c
BLAKE2b-256 0f3680726059b14b1563c140078bd12198be8e30cc8aa7256ed7dfa0f96e26f5

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page