canva

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

canva

canva

Use this skill when you need to work with canva through its generated async Python app, call its MCP-backed functions from code, or inspect available functions with the mcp-skill CLI.
当你需要通过生成的异步Python应用操作Canva、从代码中调用基于MCP的函数,或使用mcp-skill CLI查看可用函数时,请使用此技能。

Authentication

身份验证

This app can use the MCP client's built-in OAuth flow when the server requires it. In most cases, the default constructor is enough. Tokens are persisted to
~/.mcp-skill/auth/
so subsequent runs reuse the same credentials automatically.
python
app = CanvaApp()
If you need a custom OAuth provider, pass it via the
auth
argument:
python
app = CanvaApp(auth=my_oauth_provider)
此应用可以在服务器要求时使用MCP客户端内置的OAuth流程。在大多数情况下,默认构造函数就足够了。令牌会持久化到
~/.mcp-skill/auth/
目录,因此后续运行会自动重用相同的凭据。
python
app = CanvaApp()
如果你需要自定义OAuth提供程序,请通过
auth
参数传入:
python
app = CanvaApp(auth=my_oauth_provider)

Dependencies

依赖项

This skill requires the following Python packages:
  • mcp-skill
Install with uv:
bash
uv pip install mcp-skill
Or with pip:
bash
pip install mcp-skill
此技能需要以下Python包:
  • mcp-skill
使用uv安装:
bash
uv pip install mcp-skill
或使用pip安装:
bash
pip install mcp-skill

Python Usage

Python使用方法

Use the generated app directly in async Python code:
python
import asyncio
from canva.app import CanvaApp


async def main():
    app = CanvaApp()
    result = await app.upload_asset_from_url(url="example", name="example", user_intent="example")
    print(result)


asyncio.run(main())
在异步Python代码中直接使用生成的应用:
python
import asyncio
from canva.app import CanvaApp


async def main():
    app = CanvaApp()
    result = await app.upload_asset_from_url(url="example", name="example", user_intent="example")
    print(result)


asyncio.run(main())

Async Usage Notes

异步使用注意事项

  • Every generated tool method is
    async
    , so call it with
    await
    .
  • Use these apps inside an async function, then run that function with
    asyncio.run(...)
    if you are in a script.
  • If you forget
    await
    , you will get a coroutine object instead of the actual tool result.
  • Be careful when mixing this with other event-loop environments such as notebooks, web servers, or async frameworks.
  • 每个生成的工具方法都是
    async
    的,因此请使用
    await
    调用它。
  • 在异步函数内使用这些应用,如果是在脚本中,请使用
    asyncio.run(...)
    运行该函数。
  • 如果你忘记使用
    await
    ,你将得到一个协程对象而不是实际的工具结果。
  • 在与其他事件循环环境(如笔记本、Web服务器或异步框架)混合使用时要小心。

Discover Functions with the CLI

使用CLI发现函数

Use the CLI to find available apps, list functions on an app, and inspect a function before calling it:
bash
uvx mcp-skill list-apps
uvx mcp-skill list-functions canva
uvx mcp-skill inspect canva upload_asset_from_url
Important: Add
.agents/skills
to your Python path so imports resolve correctly:
python
import sys
sys.path.insert(0, ".agents/skills")
from canva.app import CanvaApp
Or set the
PYTHONPATH
environment variable:
bash
export PYTHONPATH=".agents/skills:$PYTHONPATH"
Preferred: use
uv run
(handles dependencies automatically):
bash
PYTHONPATH=.agents/skills uv run --with mcp-skill python -c "
import asyncio
from canva.app import CanvaApp

async def main():
    app = CanvaApp()
    result = await app.upload_asset_from_url(url="example", name="example", user_intent="example")
    print(result)

asyncio.run(main())
"
Alternative: use
python
directly
(install dependencies first):
bash
pip install mcp-skill
PYTHONPATH=.agents/skills python -c "
import asyncio
from canva.app import CanvaApp

async def main():
    app = CanvaApp()
    result = await app.upload_asset_from_url(url="example", name="example", user_intent="example")
    print(result)

asyncio.run(main())
"
使用CLI查找可用应用、列出应用上的函数,并在调用函数前查看函数详情:
bash
uvx mcp-skill list-apps
uvx mcp-skill list-functions canva
uvx mcp-skill inspect canva upload_asset_from_url
重要提示:
.agents/skills
添加到Python路径中,以便正确解析导入:
python
import sys
sys.path.insert(0, ".agents/skills")
from canva.app import CanvaApp
或设置
PYTHONPATH
环境变量:
bash
export PYTHONPATH=".agents/skills:$PYTHONPATH"
推荐:使用
uv run
(自动处理依赖):
bash
PYTHONPATH=.agents/skills uv run --with mcp-skill python -c "
import asyncio
from canva.app import CanvaApp

async def main():
    app = CanvaApp()
    result = await app.upload_asset_from_url(url="example", name="example", user_intent="example")
    print(result)

asyncio.run(main())
"
替代方案:直接使用
python
(先安装依赖):
bash
pip install mcp-skill
PYTHONPATH=.agents/skills python -c "
import asyncio
from canva.app import CanvaApp

async def main():
    app = CanvaApp()
    result = await app.upload_asset_from_url(url="example", name="example", user_intent="example")
    print(result)

asyncio.run(main())
"