---
name: gitea-issue-attachments
description: Upload files (screenshots, logs, etc.) to Gitea issues as attachments via the REST API. Use when attaching any file to a Gitea issue or comment.
---

# Gitea Issue Attachments

Attach files to Gitea issues via the REST API:

1. Get the Gitea API token from the running MCP docker process:
    ```bash
    GITEA_PID=$(ps aux | grep 'gitea-mcp-server' | grep -v grep | awk '{print $2}')
    GITEA_TOKEN=$(cat /proc/$GITEA_PID/environ | tr '\0' '\n' | grep GITEA_ACCESS_TOKEN | cut -d= -f2)
    ```
2. Upload the file as an issue attachment:
    ```bash
    curl -s -X POST "https://gitbase.de/api/v1/repos/{owner}/{repo}/issues/{index}/assets" \
      -H "Authorization: token $GITEA_TOKEN" \
      -F "attachment=@path/to/file"
    ```
    This returns JSON with a `uuid` field.
3. Reference the attachment in the issue or comment body:
    ```markdown
    ![Description](attachments/{uuid})
    ```
