---
name: {{ skill_name }}
description: "{{ description | replace('"', '\\"') }}"
metadata:
  short-description: "{{ short_description | replace('"', '\\"') }}"
---

# {{ skill_name }}

{{ description }}

## Authentication

{% if auth_type == "none" %}
No authentication required.

```python
app = {{ class_name }}()
```

Passing an `auth` argument is accepted but has no effect and will emit a warning.
{% elif auth_type == "bearer" %}
This MCP server uses **Bearer token** authentication. The API key is persisted
to `~/.mcp-skill/auth/` after first use, so subsequent runs can omit it.

```python
# First use — provide and persist the key
app = {{ class_name }}(auth="YOUR_API_KEY")

# Subsequent uses — loaded from disk automatically
app = {{ class_name }}()
```

The key is sent as `Authorization: Bearer <auth>` on every request.
{% elif auth_type == "header" %}
This MCP server uses a custom **`{{ auth_header }}`** header for authentication.
The API key is persisted to `~/.mcp-skill/auth/` after first use, so subsequent
runs can omit it.

```python
# First use — provide and persist the key
app = {{ class_name }}(auth="YOUR_API_KEY")

# Subsequent uses — loaded from disk automatically
app = {{ class_name }}()
```

The key is sent as `{{ auth_header }}: <auth>` on every request.
{% elif auth_type == "oauth" %}
This app uses the MCP client's built-in OAuth 2.1 Authorization Code + PKCE flow.
By default, FastMCP uses dynamic client registration when the server supports it.
Tokens are persisted to `~/.mcp-skill/auth/` so subsequent runs reuse the same
credentials automatically.

```python
app = {{ class_name }}()
```

If your provider requires a pre-registered OAuth client instead of dynamic
client registration, pass the client details directly:

```python
app = {{ class_name }}(
    oauth_client_id={{ oauth_client_id|tojson if oauth_client_id else '"YOUR_CLIENT_ID"' }},
{% if oauth_scopes %}
    oauth_scopes={{ oauth_scopes|tojson }},
{% else %}
    oauth_scopes="tweet.read users.read offline.access",
{% endif %}
)
```

`oauth_client_secret` is also supported for confidential clients, and
`oauth_client_metadata_url` can be used when the provider expects a hosted
client metadata document instead of dynamic registration.

If you need full control, pass a custom FastMCP/OpenAuth provider via `auth`:

```python
app = {{ class_name }}(auth=my_oauth_provider)
```
{% endif %}

## 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 Usage

Use the generated app directly in async Python code:

```python
import asyncio
from {{ module_name }}.app import {{ class_name }}


async def main():
{% if auth_type in ('bearer', 'header') %}
    app = {{ class_name }}(auth="YOUR_API_KEY")
{% else %}
    app = {{ class_name }}()
{% endif %}
    result = await app.{{ tools[0].safe_method if tools else 'list_tools' }}({{ tools[0].example_args if tools else '' }})
    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.

## Discover Functions with the 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 {{ module_name }}
uvx mcp-skill inspect {{ module_name }} {{ tools[0].safe_method if tools else 'function_name' }}
```

**Important:** Add `.agents/skills` to your Python path so imports resolve correctly:

```python
import sys
sys.path.insert(0, ".agents/skills")
from {{ module_name }}.app import {{ class_name }}
```

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 {{ module_name }}.app import {{ class_name }}

async def main():
{% if auth_type in ('bearer', 'header') %}
    app = {{ class_name }}(auth='YOUR_API_KEY')
{% else %}
    app = {{ class_name }}()
{% endif %}
    result = await app.{{ tools[0].safe_method if tools else 'list_tools' }}({{ tools[0].example_args if tools else '' }})
    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 {{ module_name }}.app import {{ class_name }}

async def main():
{% if auth_type in ('bearer', 'header') %}
    app = {{ class_name }}(auth='YOUR_API_KEY')
{% else %}
    app = {{ class_name }}()
{% endif %}
    result = await app.{{ tools[0].safe_method if tools else 'list_tools' }}({{ tools[0].example_args if tools else '' }})
    print(result)

asyncio.run(main())
"
```
