Skip to main content

High-level Python SDK for the MCP Gateway: async context-managed HTTP client with optional OIDC tokens.

Project description

Palma AI SDK (Python)

High-level Python SDK for the MCP Gateway. Provides an async context-managed client over HTTP that handles connection lifecycle, optional OIDC client-credentials tokens, and simple tool/resource calls.

Installation

pip install palma-sdk

Usage

import os
from dotenv import load_dotenv
from palma_sdk import (
    PalmaHttpClient,
    PalmaHttpClientConfig,
    OIDCClientCredentialsConfig,
    create_oidc_token_provider,
)

load_dotenv()

token_provider = None
if os.getenv("AUTH0_DOMAIN"):
    token_provider = create_oidc_token_provider(
        OIDCClientCredentialsConfig(
            issuer=f"https://{os.getenv('AUTH0_DOMAIN')}",
            client_id=os.getenv("AUTH0_CLIENT_ID", ""),
            client_secret=os.getenv("AUTH0_CLIENT_SECRET", ""),
            audience=os.getenv("AUTH0_AUDIENCE"),
            scope=os.getenv("AUTH0_SCOPE"),
            sub=os.getenv("AUTH0_SUB"),
        )
    )

cfg = PalmaHttpClientConfig(
    endpoint=os.getenv("MCP_ENDPOINT", "http://localhost:3000/mcp"),
    org_id=os.getenv("MCP_ORG_ID"),
    token_provider=token_provider,
)

async def main():
    async with PalmaHttpClient(cfg) as client:
        tools = await client.list_tools()
        print("tools:", tools)

Features

  • Async context manager handles connect/initialize/cleanup
  • Optional OIDC client-credentials token provider
  • Tool and resource APIs (list, call, read)
  • Type hints throughout

License

MIT

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

palma_sdk-0.1.1.tar.gz (3.7 kB view details)

Uploaded Source

Built Distribution

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

palma_sdk-0.1.1-py3-none-any.whl (4.9 kB view details)

Uploaded Python 3

File details

Details for the file palma_sdk-0.1.1.tar.gz.

File metadata

  • Download URL: palma_sdk-0.1.1.tar.gz
  • Upload date:
  • Size: 3.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.2.1 CPython/3.11.13 Linux/6.11.0-1018-azure

File hashes

Hashes for palma_sdk-0.1.1.tar.gz
Algorithm Hash digest
SHA256 154adb3fd8a469a72edddd346e24840a9b4820ed0e20ad9f0857cae56773d759
MD5 181050cbafe2b3554e809b8746ba3990
BLAKE2b-256 3be08330827e308288e638969edcae3bb9c7466c55385903455deb3ecebd71bc

See more details on using hashes here.

File details

Details for the file palma_sdk-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: palma_sdk-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 4.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.2.1 CPython/3.11.13 Linux/6.11.0-1018-azure

File hashes

Hashes for palma_sdk-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 989d845ee7812894fa43488684447ed82c4b2cc5dcba080a4f1eef2f5a698f4c
MD5 f938e598d2dc6e9199b1bd7ac0e28599
BLAKE2b-256 b72d656ea6e55f60c7a6577630d31600df06b56f5578cf5ede9ebaf59f208d03

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