diff --git a/.claude/rules/integrations.md b/.claude/rules/integrations.md index a79ab815..986b47ed 100644 --- a/.claude/rules/integrations.md +++ b/.claude/rules/integrations.md @@ -18,6 +18,7 @@ | **Omie** | API | ERP — clients, invoices (NF-e), financials | | **Bling** | API (OAuth2 auto-refresh) | Brazilian ERP — products, orders, NF-e, contacts, stock. Run `make bling-auth` once to connect | | **Asaas** | API | Brazilian payments — Pix, boleto, credit card, subscriptions, marketplace split | +| **MercadoPago** | MCP | Latin American payment gateway — 7 countries (Brazil, Argentina, Mexico, Chile, Colombia, Peru, Uruguay), payment links, QR codes, subscriptions, webhooks | | **YouTube** | API (OAuth) | Channel analytics | | **Instagram** | API (OAuth) | Profile analytics | | **LinkedIn** | API (OAuth) | Profile/org analytics | diff --git a/.claude/skills/int-youtube/SKILL.md b/.claude/skills/int-youtube/SKILL.md index 79359a2e..3aa0e3f5 100644 --- a/.claude/skills/int-youtube/SKILL.md +++ b/.claude/skills/int-youtube/SKILL.md @@ -9,7 +9,21 @@ YouTube integration to monitor Evolution channels and others. Supports multiple ## Setup -Accounts configured via `make social-auth` (OAuth login) or manually in `.env`: +### Conta Principal (autenticada via OAuth) + +Configurada via `.env` (gitignored): + +```env +YOUTUBE_OAUTH_CLIENT_ID=.apps.googleusercontent.com +YOUTUBE_OAUTH_CLIENT_SECRET= +YOUTUBE_REFRESH_TOKEN= +``` + +Scopes: `youtube`, `youtube.readonly`, `yt-analytics.readonly`, `yt-analytics-monetary.readonly` + +### Contas adicionais (SOCIAL_YOUTUBE_N_*) + +Configuráveis via `make social-auth` (OAuth login) ou manualmente no `.env`: ```env SOCIAL_YOUTUBE_1_LABEL=Evolution API SOCIAL_YOUTUBE_1_ACCESS_TOKEN=ya29... @@ -17,6 +31,38 @@ SOCIAL_YOUTUBE_1_CHANNEL_ID=UC9kZHm3TnEt41ztGOLyQO9g SOCIAL_YOUTUBE_1_REFRESH_TOKEN=1//0h... ``` +### Auth Helper + +```python +import os, urllib.request, urllib.parse, json + +def get_youtube_token() -> str: + data = urllib.parse.urlencode({ + "client_id": os.environ["YOUTUBE_OAUTH_CLIENT_ID"], + "client_secret": os.environ["YOUTUBE_OAUTH_CLIENT_SECRET"], + "refresh_token": os.environ["YOUTUBE_REFRESH_TOKEN"], + "grant_type": "refresh_token", + }).encode() + req = urllib.request.Request( + "https://oauth2.googleapis.com/token", data=data, + headers={"Content-Type": "application/x-www-form-urlencoded"}, + ) + return json.loads(urllib.request.urlopen(req).read())["access_token"] + +def ytapi(path: str) -> dict: + at = get_youtube_token() + req = urllib.request.Request( + f"https://www.googleapis.com/youtube/v3{path}", + headers={"Authorization": f"Bearer {at}"} + ) + return json.loads(urllib.request.urlopen(req).read()) + +# Canal próprio +# ytapi("/channels?part=snippet,statistics&mine=true") +# Últimos vídeos +# ytapi("/search?part=snippet&forMine=true&type=video&order=date&maxResults=10") +``` + ## API Client ```bash diff --git a/.mcp.json b/.mcp.json index cdc1a9cb..846b3c06 100644 --- a/.mcp.json +++ b/.mcp.json @@ -35,6 +35,13 @@ "intercom": { "type": "http", "url": "https://mcp.intercom.com/mcp" + }, + "mercadopago": { + "type": "http", + "url": "https://mcp.mercadopago.com/mcp", + "headers": { + "Authorization": "Bearer ${MERCADOPAGO_TOKEN}" + } } } }