Skip to main content

CLI and Python SDK for managing MCP Gateway workspaces, backends, and agents

Project description

MCP Gateway CLI & SDK

Enterprise-grade Model Context Protocol management for Claude Desktop

PyPI version License: MIT

Manage MCP servers, workspaces, and configurations for Claude Desktop with enterprise security features.

Two ways to use:

  • 🖥️ CLI: Command-line tool for interactive management
  • 🐍 SDK: Python library for programmatic integration

🚀 Quick Start

Installation

pip install of-mcp

Note: Package name is of-mcp, CLI command is mcpgw

After installation, add to your PATH (if needed):

# Add to ~/.zshrc or ~/.bashrc
export PATH="$HOME/Library/Python/3.12/bin:$PATH"

Requirements: Python 3.9+

CLI Usage

1. Login

mcpgw auth login
# Enter your email and password

2. List Workspaces

mcpgw workspace list

3. Create Workspace

mcpgw workspace create --name "Production"

4. Add Backend

mcpgw backend add WORKSPACE_ID --name "Gmail" --url "http://gmail-mcp:9000"

5. Create Agent

mcpgw agent create WORKSPACE_ID --name "My Agent"
# Save the API key shown!

SDK Usage

Use of-mcp as a Python library in your applications:

from of_mcp import MCPGatewayClient

# Initialize client
client = MCPGatewayClient(token="your-token")

# Or login with email/password
client = MCPGatewayClient()
client.login(email="user@example.com", password="password")

# List workspaces
workspaces = client.workspaces.list()
print(workspaces)

# Create workspace
workspace = client.workspaces.create(name="Production", description="Prod environment")
print(f"Created workspace: {workspace['id']}")

# Add backend
backend = client.backends.add(
    workspace_id=workspace['id'],
    name="Gmail",
    url="http://gmail-mcp:9000"
)

# List backends
backends = client.backends.list(workspace['id'])

# Create agent
agent = client.agents.create(
    workspace_id=workspace['id'],
    name="Email Agent",
    description="Handles email operations"
)
print(f"Agent API key: {agent['api_key']}")

# Browse catalog
catalog = client.catalog.list(category="email")

# Enable catalog backend
enabled = client.catalog.enable(
    workspace_id=workspace['id'],
    backend_id="backend_gmail"
)

SDK Error Handling

from of_mcp import MCPGatewayClient, AuthenticationError, APIError

try:
    client = MCPGatewayClient()
    client.login(email="user@example.com", password="wrong-password")
except AuthenticationError as e:
    print(f"Login failed: {e}")
except APIError as e:
    print(f"API error ({e.status_code}): {e}")

SDK with Environment Variables

import os
from of_mcp import MCPGatewayClient

# Uses MCPGW_API_URL and MCPGW_TOKEN from environment
os.environ['MCPGW_API_URL'] = 'http://localhost:8000/api/v1'
os.environ['MCPGW_TOKEN'] = 'your-token'

client = MCPGatewayClient()
workspaces = client.workspaces.list()

CLI Commands

Authentication

mcpgw auth login              # Login
mcpgw auth logout             # Logout
mcpgw auth whoami             # Show current user

Workspaces

mcpgw workspace list                    # List all workspaces
mcpgw workspace get WORKSPACE_ID        # Get workspace details
mcpgw workspace create                  # Create new workspace
mcpgw workspace delete WORKSPACE_ID     # Delete workspace

Backends

mcpgw backend list WORKSPACE_ID                           # List backends
mcpgw backend add WORKSPACE_ID --name X --url Y           # Add backend
mcpgw backend remove WORKSPACE_ID BACKEND_ID              # Remove backend

Backend Catalog

mcpgw catalog list                                  # Browse catalog
mcpgw catalog list --category email                 # Filter by category
mcpgw catalog enable WORKSPACE_ID BACKEND_ID        # Enable from catalog

Agents

mcpgw agent list WORKSPACE_ID                 # List agents
mcpgw agent create WORKSPACE_ID --name X      # Create agent

Configuration

Config stored in ~/.mcpgw/config.json

Environment Variables

  • MCPGW_API_URL - API base URL (default: https://api.mcpgw.io/api/v1)
  • MCPGW_PROFILE - Configuration profile to use
  • MCPGW_TOKEN - Authentication token (for CI/CD)

Profiles

Manage multiple environments:

# Create profiles for different environments
mcpgw profile create staging --api-url https://staging.mcpgw.io/api/v1
mcpgw profile create local --api-url http://localhost:8000/api/v1

# List profiles
mcpgw profile list

# Switch between profiles
mcpgw profile use staging

# Show current profile
mcpgw profile current

Examples

Setup a new workspace

# Login
mcpgw auth login

# Create workspace
mcpgw workspace create --name "Production"

# Enable Gmail backend
WORKSPACE_ID="ws_abc123"
mcpgw catalog enable $WORKSPACE_ID backend_gmail

# Create an agent
mcpgw agent create $WORKSPACE_ID --name "Email Agent"

Get workspace info as JSON

mcpgw workspace list --json-output | jq '.[0]'

Development

# Install in development mode
cd cli
pip install -e .

# Run tests
pytest

# Build distribution
pipx run build

# Upload to PyPI
pipx run twine upload dist/*

📖 Documentation

🔗 Links

📝 License

MIT License - see LICENSE for details

🤝 Contributing

Contributions welcome! See CONTRIBUTING.md


Made with ❤️ by Orange Fennec

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

of_mcp-0.1.2.tar.gz (30.1 kB view details)

Uploaded Source

Built Distribution

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

of_mcp-0.1.2-py3-none-any.whl (14.4 kB view details)

Uploaded Python 3

File details

Details for the file of_mcp-0.1.2.tar.gz.

File metadata

  • Download URL: of_mcp-0.1.2.tar.gz
  • Upload date:
  • Size: 30.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.14

File hashes

Hashes for of_mcp-0.1.2.tar.gz
Algorithm Hash digest
SHA256 97d2b2b7ca84cee6d8e61d4927cbd72e864f2a4107618a8742945e0420dc06f1
MD5 dc12e7d808ca6335fa1bc7b3840108e2
BLAKE2b-256 8efcf60f369523fb87e7d3933344b3b99fdd492a3c840d85650dc6b52e38f704

See more details on using hashes here.

File details

Details for the file of_mcp-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: of_mcp-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 14.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.14

File hashes

Hashes for of_mcp-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 45edc79d3a99815e446d3699d12d28f8e6bb137ef1f4abe820c78965020b3c1e
MD5 cd52e42691866a55a208ba892ff47597
BLAKE2b-256 d9b75cffed2854a648f9deed6e7352463f6d26f0aba3e8c4487f5885ec2ab7c3

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