Skip to main content

SDK for using Smithery with Python

Project description

Smithery Python SDK

Build FastMCP servers with Smithery integration - adds session-scoped configuration, and seamless deployment to the Smithery platform.

Installation

# Recommended: using uv
uv add smithery

# Or using pip
pip install smithery

FastMCP Compatibility

When using with existing FastMCP servers, ensure you have compatible versions:

  • mcp>=1.6.0 OR fastmcp>=2.0.0

Usage

from smithery import Server
from pydantic import BaseModel

class ConfigSchema(BaseModel):
    debug: bool = False

@Server("My Server", config_schema=ConfigSchema)
def create_server():
    pass

@create_server.tool()
def hello(name: str) -> str:
    ctx = create_server.get_context()
    config = ctx.session_config
    # Access config using dot notation: config.debug
    return f"Hello, {name}!" + (" (debug)" if config.debug else "")

if __name__ == "__main__":
    create_server.run(transport="streamable-http")

For servers without config schema, just use @Server("My Server")

Configuration is passed via URL query parameters: http://localhost:8000/mcp?debug=true

CLI Commands

The SDK includes a CLI for development and testing:

# Initialize a new project
uvx smithery init

# Run server in development mode  
uv run smithery dev

# Run server with playground for testing
uv run smithery playground

# Run with specific transport and port
uv run smithery dev --transport shttp --port 8080 --reload

See scaffold for a complete example

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

smithery-0.4.4.tar.gz (17.4 kB view details)

Uploaded Source

Built Distribution

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

smithery-0.4.4-py3-none-any.whl (25.4 kB view details)

Uploaded Python 3

File details

Details for the file smithery-0.4.4.tar.gz.

File metadata

  • Download URL: smithery-0.4.4.tar.gz
  • Upload date:
  • Size: 17.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for smithery-0.4.4.tar.gz
Algorithm Hash digest
SHA256 18ae19af8405e6476ca4984036d4460822ec1647ad2262addb4909d03387d671
MD5 524ead31d5be2abd9c58f016fe53286c
BLAKE2b-256 1e75d0b0fc1a5c10a20f3e01cefd98276ccbe7b44d74eeb6551bd2f42d8b4768

See more details on using hashes here.

Provenance

The following attestation bundles were made for smithery-0.4.4.tar.gz:

Publisher: publish-python.yml on smithery-ai/sdk

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file smithery-0.4.4-py3-none-any.whl.

File metadata

  • Download URL: smithery-0.4.4-py3-none-any.whl
  • Upload date:
  • Size: 25.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for smithery-0.4.4-py3-none-any.whl
Algorithm Hash digest
SHA256 883d060b3ecc73a2972019760e342f5a04b62edf18e3bc03594a41851319808a
MD5 5ff7bf0fe075e635bbbdcb60ea6202ec
BLAKE2b-256 3054a088fa621c9c76a72a70079fac42b822137a1609ec08525168bd8e9f415d

See more details on using hashes here.

Provenance

The following attestation bundles were made for smithery-0.4.4-py3-none-any.whl:

Publisher: publish-python.yml on smithery-ai/sdk

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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