Skip to main content

SmartHub MCP extension for Goose

Project description

SmartHub MCP Extension

A natural language interface for SmartHub data and portfolio management.

Features

  • Natural language queries for merchant data
  • Comprehensive merchant information lookup
  • AM ownership and team data
  • Business relationship mapping
  • Integration with Goose AI assistant

Installation

  1. Clone the repository:
git clone git@github.com:squareup/smarthub-extension.git
cd smarthub-extension
  1. Create a virtual environment:
python -m venv venv
source venv/bin/activate  # On Windows: venv\Scripts\activate
  1. Install dependencies:
pip install -e ".[test,dev]"

Configuration

  1. Set up environment variables:
export SNOWFLAKE_USER="your_username"
export SNOWFLAKE_ACCOUNT="your_account"
export SNOWFLAKE_ROLE="your_role"
export SNOWFLAKE_WAREHOUSE="your_warehouse"
  1. Or create a configuration file:
# config.py
config = {
    "snowflake_user": "your_username",
    "snowflake_account": "your_account",
    "snowflake_role": "your_role",
    "snowflake_warehouse": "your_warehouse",
    "log_file": "/path/to/log/file.log",
    "debug": False
}

Example Queries

Basic Merchant Lookup

# Look up merchant by token
result = await get_merchant_info("MLM7X617NKATG")
print(f"Business Name: {result['summary']['business_name']}")
print(f"Current AM: {result['summary']['current_am']}")

# Look up merchant by business ID
result = await get_merchant_info("302718489")
print(f"Merchant Token: {result['summary']['merchant_token']}")
print(f"AM Team: {result['summary']['am_team']}")

List Available Tables

# Get all available tables
result = await list_available_tables()
for table in result["tables"]:
    print(f"Table: {table['name']} in {table['schema']}")

Test Connection

# Verify Snowflake connection
result = await test_snowflake_connection()
if result["status"] == "success":
    print(f"Connected as role: {result['role']}")
else:
    print(f"Connection failed: {result['message']}")

Development

Running Tests

# Run all tests with coverage
pytest tests/ -v --cov=smarthub_extension

# Run specific test file
pytest tests/test_server.py -v

# Run tests and generate coverage report
pytest tests/ -v --cov=smarthub_extension --cov-report=html

Code Quality

# Run linter
ruff check .

# Run type checker
mypy smarthub_extension

# Format code
black .

Creating a Release

  1. Update version in pyproject.toml
  2. Create and push a tag:
git tag -a v0.1.2 -m "Release version 0.1.2"
git push origin v0.1.2

Contributing

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

License

MIT License - see LICENSE for details

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

smarthub_extension-0.1.5.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.

smarthub_extension-0.1.5-py3-none-any.whl (9.7 kB view details)

Uploaded Python 3

File details

Details for the file smarthub_extension-0.1.5.tar.gz.

File metadata

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

File hashes

Hashes for smarthub_extension-0.1.5.tar.gz
Algorithm Hash digest
SHA256 71db632d5ad7ce55c3a890f6f863c1e2c7e7825d38fb591aa18432b0cc90cda0
MD5 ea699890bea11d87ab3a789b427f3ad2
BLAKE2b-256 838a0963589fddbdc34fa04d4587f33ad8444dda5b899fdbb8027b2ef2871f18

See more details on using hashes here.

File details

Details for the file smarthub_extension-0.1.5-py3-none-any.whl.

File metadata

File hashes

Hashes for smarthub_extension-0.1.5-py3-none-any.whl
Algorithm Hash digest
SHA256 55591638e46eb283e12961f2d80e6342c3941292f2eaac45ebe02c4a37b3af4a
MD5 5baf52993f7fa4c3694c36088bf39517
BLAKE2b-256 46e5e7ade89964e24abfe51b4d7dea26e5b48b66a70f5794fe7026597224901f

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