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
- Clone the repository:
git clone git@github.com:squareup/smarthub-extension.git
cd smarthub-extension
- Create a virtual environment:
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
- Install dependencies:
pip install -e ".[test,dev]"
Configuration
- Set up environment variables:
export SNOWFLAKE_USER="your_username"
export SNOWFLAKE_ACCOUNT="your_account"
export SNOWFLAKE_ROLE="your_role"
export SNOWFLAKE_WAREHOUSE="your_warehouse"
- 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
- Update version in
pyproject.toml - Create and push a tag:
git tag -a v0.1.2 -m "Release version 0.1.2"
git push origin v0.1.2
Contributing
- Fork the repository
- Create a feature branch
- Make your changes
- Run tests and linting
- Submit a pull request
License
MIT License - see LICENSE for details
Metadata
Release files for smarthub-extension 0.1.8
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| smarthub_extension-0.1.8.tar.gz | 9.9 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| smarthub_extension-0.1.8-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 19.6 kB
Release files / smarthub_extension-0.1.8.tar.gz
| Download URL | smarthub_extension-0.1.8.tar.gz |
|---|---|
| Size | 9.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a1556000bbdeb7cdadfaa3705487c6d3c107ef6f29771b3a92c24ebca710756d
|
|
BLAKE2b-256 checksum How to use checksums |
998f91a9a18b5adc1906c13491b506c4b04ac2f95578fdaa73caef22cf4e08e6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.9.6
|
Release files / smarthub_extension-0.1.8-py3-none-any.whl
| Download URL | smarthub_extension-0.1.8-py3-none-any.whl |
|---|---|
| Size | 9.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
350c0eb63ead587d22c4880392c5596f89d8fa6494ff607550cddb3d155e02e8
|
|
BLAKE2b-256 checksum How to use checksums |
1f902d61a4ddb9d15e75d2c5bee2fdccd8f55437140db4e44ee862efeb817a18
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.9.6
|
Security for smarthub-extension 0.1.8
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.