diff --git a/python/thirdweb-ai/pyproject.toml b/python/thirdweb-ai/pyproject.toml index d1e1d86..dbff462 100644 --- a/python/thirdweb-ai/pyproject.toml +++ b/python/thirdweb-ai/pyproject.toml @@ -20,7 +20,6 @@ dependencies = [ "jsonref>=1.1.0,<2", "httpx>=0.28.1,<0.29", "aiohttp>=3.11.14", - "requests>=2.32.3", ] [project.optional-dependencies] diff --git a/python/thirdweb-ai/src/thirdweb_ai/services/service.py b/python/thirdweb-ai/src/thirdweb_ai/services/service.py index c68c64c..7f19ec8 100644 --- a/python/thirdweb-ai/src/thirdweb_ai/services/service.py +++ b/python/thirdweb-ai/src/thirdweb_ai/services/service.py @@ -12,7 +12,7 @@ def __init__(self, base_url: str, secret_key: str, httpx_client: httpx.Client | self.base_url = base_url self.secret_key = secret_key self.client = ( - httpx_client if httpx_client else httpx.Client(timeout=120.0, transport=httpx.HTTPTransport(retries=5)) + httpx_client or httpx.Client(timeout=120.0, transport=httpx.HTTPTransport(retries=5)) ) def _make_headers(self): diff --git a/python/thirdweb-ai/src/thirdweb_ai/services/storage.py b/python/thirdweb-ai/src/thirdweb_ai/services/storage.py index db5d55d..6a1852f 100644 --- a/python/thirdweb-ai/src/thirdweb_ai/services/storage.py +++ b/python/thirdweb-ai/src/thirdweb_ai/services/storage.py @@ -7,7 +7,6 @@ from pathlib import Path from typing import Annotated, Any -import requests from pydantic import BaseModel from thirdweb_ai.services.service import Service @@ -75,10 +74,9 @@ def _get_file(self, path: str, params: dict[str, Any] | None = None, headers: di def _post_file(self, url: str, files: dict[str, Any]) -> dict[str, Any]: """Post files to a URL with proper authorization headers.""" headers = self._make_headers() - # Remove the Content-Type as requests will set it correctly for multipart/form-data headers.pop("Content-Type", None) - response = requests.post(url, files=files, headers=headers) + response = self.client.post(url, files=files, headers=headers) response.raise_for_status() return response.json() diff --git a/python/thirdweb-ai/uv.lock b/python/thirdweb-ai/uv.lock index a253631..52f5cbc 100644 --- a/python/thirdweb-ai/uv.lock +++ b/python/thirdweb-ai/uv.lock @@ -3419,14 +3419,13 @@ wheels = [ [[package]] name = "thirdweb-ai" -version = "0.1.8" +version = "0.1.9" source = { editable = "." } dependencies = [ { name = "aiohttp" }, { name = "httpx" }, { name = "jsonref" }, { name = "pydantic" }, - { name = "requests" }, ] [package.optional-dependencies] @@ -3503,7 +3502,6 @@ requires-dist = [ { name = "pydantic", specifier = ">=2.10.6,<3" }, { name = "pydantic-ai", marker = "extra == 'all'", specifier = ">=0.0.39" }, { name = "pydantic-ai", marker = "extra == 'pydantic-ai'", specifier = ">=0.0.39" }, - { name = "requests", specifier = ">=2.32.3" }, { name = "smolagents", marker = "extra == 'all'", specifier = ">=1.10.0" }, { name = "smolagents", marker = "extra == 'smolagents'", specifier = ">=1.10.0" }, ] diff --git a/python/thirdweb-mcp/pyproject.toml b/python/thirdweb-mcp/pyproject.toml index fc21068..66e786a 100644 --- a/python/thirdweb-mcp/pyproject.toml +++ b/python/thirdweb-mcp/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "thirdweb-mcp" -version = "0.1.12" +version = "0.1.13" description = "thirdweb MCP" authors = [{ name = "thirdweb", email = "support@thirdweb.com" }] requires-python = "~=3.10" diff --git a/python/thirdweb-mcp/src/mcp.py b/python/thirdweb-mcp/src/mcp.py index 78214e1..acfd5ce 100644 --- a/python/thirdweb-mcp/src/mcp.py +++ b/python/thirdweb-mcp/src/mcp.py @@ -1,10 +1,11 @@ import os import click -from mcp.server.fastmcp import FastMCP -from thirdweb_ai import Engine, Insight, Nebula +from thirdweb_ai import Engine, Insight, Nebula, Storage from thirdweb_ai.adapters.mcp import add_fastmcp_tools +from mcp.server.fastmcp import FastMCP + @click.command() @click.option( @@ -25,7 +26,7 @@ "--secret-key", type=str, default=lambda: os.getenv("THIRDWEB_SECRET_KEY"), - help="Your thirdweb API secret key for authentication. Required for nebula and insight services. Can be obtained from the thirdweb dashboard. Falls back to THIRDWEB_SECRET_KEY environment variable if not specified.", + help="Your thirdweb API secret key for authentication. Required for nebula, insight, and storage services. Can be obtained from the thirdweb dashboard. Falls back to THIRDWEB_SECRET_KEY environment variable if not specified.", ) @click.option( "--chain-id", @@ -69,7 +70,7 @@ def main( # determine which services to enable based on the provided options services = [] if secret_key: - services.extend(["nebula", "insight"]) + services.extend(["nebula", "insight", "storage"]) if engine_url and engine_auth_jwt: services.append("engine") @@ -88,6 +89,10 @@ def main( insight = Insight(secret_key=secret_key, chain_id=chain_ids) add_fastmcp_tools(mcp, insight.get_tools()) + if "storage" in services: + storage = Storage(secret_key=secret_key) + add_fastmcp_tools(mcp, storage.get_tools()) + if "engine" in services: engine = Engine( engine_url=engine_url,