[TOO-192] Update tdk to add figma typed oauth (#711)

Closes TOO-192

<!-- CURSOR_SUMMARY -->
---

> [!NOTE]
> Adds a Figma OAuth2 auth provider and wires it through TDK and MCP
server, with tests updated and package versions bumped.
> 
> - **Auth**:
> - Add `Figma` OAuth2 provider in
`libs/arcade-core/arcade_core/auth.py`.
> - **Exports**:
> - Expose `Figma` in
`libs/arcade-mcp-server/arcade_mcp_server/auth/__init__.py` and
`libs/arcade-tdk/arcade_tdk/auth/__init__.py` (`__all__`).
> - **Tests**:
> - Add Figma auth requirement test case in
`libs/tests/tool/test_create_tool_definition.py` and import `Figma`.
> - **Versioning**:
>   - Bump `arcade-mcp-server` to `1.10.2` and `arcade-tdk` to `3.2.0`.
> 
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
2bacfdc5695b3e7fc5e4532dbd360c3b2263130e. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->

---------

Co-authored-by: Francisco Liberal <francisco@arcade.dev>
This commit is contained in:
jottakka 2025-12-05 16:38:12 -03:00 committed by GitHub
parent 4118df073a
commit 178c194ef2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 43 additions and 3 deletions

View file

@ -78,6 +78,15 @@ class Dropbox(OAuth2):
super().__init__(id=id, scopes=scopes)
class Figma(OAuth2):
"""Marks a tool as requiring Figma authorization."""
provider_id: str = "figma"
def __init__(self, *, id: Optional[str] = None, scopes: Optional[list[str]] = None): # noqa: A002
super().__init__(id=id, scopes=scopes)
class GitHub(OAuth2):
"""Marks a tool as requiring GitHub App authorization."""

View file

@ -4,6 +4,7 @@ from arcade_core.auth import (
ClickUp,
Discord,
Dropbox,
Figma,
GitHub,
Google,
Hubspot,
@ -27,6 +28,7 @@ __all__ = [
"ClickUp",
"Discord",
"Dropbox",
"Figma",
"GitHub",
"Google",
"Hubspot",

View file

@ -4,7 +4,7 @@ build-backend = "hatchling.build"
[project]
name = "arcade-mcp-server"
version = "1.9.2"
version = "1.10.2"
description = "Model Context Protocol (MCP) server framework for Arcade.dev"
readme = "README.md"
authors = [{ name = "Arcade.dev" }]

View file

@ -4,6 +4,7 @@ from arcade_core.auth import (
ClickUp,
Discord,
Dropbox,
Figma,
GitHub,
Google,
Hubspot,
@ -28,6 +29,7 @@ __all__ = [
"Discord",
"Dropbox",
"GitHub",
"Figma",
"Google",
"Hubspot",
"Linear",

View file

@ -1,6 +1,6 @@
[project]
name = "arcade-tdk"
version = "3.1.0"
version = "3.2.0"
description = "Arcade TDK - Toolkit Development Kit for building Arcade tools"
readme = "README.md"
license = {text = "MIT"}

View file

@ -19,7 +19,7 @@ from arcade_core.schema import (
from arcade_core.utils import snake_to_pascal_case
from arcade_tdk import tool
from arcade_tdk.annotations import Inferrable
from arcade_tdk.auth import GitHub, Google, OAuth2, Slack, X
from arcade_tdk.auth import Figma, GitHub, Google, OAuth2, Slack, X
### Tests on @tool decorator
@ -128,6 +128,17 @@ def func_with_github_auth_requirement():
pass
@tool(
desc="A function that requires Figma authorization",
requires_auth=Figma(
id="my_figma_provider123",
scopes=["file_read"],
),
)
def func_with_figma_auth_requirement():
pass
@tool(
desc="A function that requires Slack user authorization",
requires_auth=Slack(
@ -451,6 +462,22 @@ def func_with_complex_return() -> dict[str, str]:
},
id="func_with_github_auth_requirement",
),
pytest.param(
func_with_figma_auth_requirement,
{
"requirements": ToolRequirements(
authorization=ToolAuthRequirement(
provider_id="figma",
provider_type="oauth2",
id="my_figma_provider123",
oauth2=OAuth2Requirement(
scopes=["file_read"],
),
)
)
},
id="func_with_figma_auth_requirement",
),
pytest.param(
func_with_slack_user_auth_requirement,
{