{"id":48737243,"url":"https://github.com/zack-dev-cm/trendwatch","last_synced_at":"2026-04-12T05:10:03.444Z","repository":{"id":305197739,"uuid":"1022225422","full_name":"zack-dev-cm/trendwatch","owner":"zack-dev-cm","description":"Trendwatch YouTube Shorts pipeline and a small MCP server ","archived":false,"fork":false,"pushed_at":"2025-07-18T19:54:28.000Z","size":1028,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-07-18T21:53:35.626Z","etag":null,"topics":["mcp-server","youtube-api-v3","youtube-bot"],"latest_commit_sha":null,"homepage":"https://trendwatch-1095464065298.us-east1.run.app","language":"Jupyter Notebook","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/zack-dev-cm.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-07-18T17:06:24.000Z","updated_at":"2025-07-18T19:54:32.000Z","dependencies_parsed_at":"2025-07-18T22:05:57.100Z","dependency_job_id":null,"html_url":"https://github.com/zack-dev-cm/trendwatch","commit_stats":null,"previous_names":["zack-dev-cm/trendwatch"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/zack-dev-cm/trendwatch","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zack-dev-cm%2Ftrendwatch","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zack-dev-cm%2Ftrendwatch/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zack-dev-cm%2Ftrendwatch/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zack-dev-cm%2Ftrendwatch/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zack-dev-cm","download_url":"https://codeload.github.com/zack-dev-cm/trendwatch/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zack-dev-cm%2Ftrendwatch/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31704736,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-11T21:17:31.016Z","status":"online","status_checked_at":"2026-04-12T02:00:06.763Z","response_time":58,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["mcp-server","youtube-api-v3","youtube-bot"],"created_at":"2026-04-12T05:10:02.824Z","updated_at":"2026-04-12T05:10:03.437Z","avatar_url":"https://github.com/zack-dev-cm.png","language":"Jupyter Notebook","funding_links":[],"categories":[],"sub_categories":[],"readme":"# MCP Connector Integration Guide\n\n*(Trendwatch — July 2025)*\n\n---\n\n## 1 · Live Server Endpoints\n\n| Purpose                          | URL                                                                                                            |\n| -------------------------------- | -------------------------------------------------------------------------------------------------------------- |\n| **Web UI** (minimal search page) | [https://trendwatch-1095464065298.us-east1.run.app](https://trendwatch-1095464065298.us-east1.run.app)         |\n| **MCP SSE Endpoint**             | [https://trendwatch-1095464065298.us-east1.run.app/sse](https://trendwatch-1095464065298.us-east1.run.app/sse) |\n\n\u003e The server is deployed on Google Cloud Run from the included `Dockerfile`. If you’re self‑hosting, replace the URLs above with your own domain.\n\n---\n\n## 2 · Prerequisites\n\n* Deployed **Trendwatch** FastMCP server (see `Dockerfile` + `app/server.py`).\n* Publicly‑reachable **HTTPS** URL (Cloud Run or any reverse proxy).\n* (Optional) **Bearer token** set via `API_TOKEN` env var for authenticated access.\n\n---\n\n## 3 · Connecting From Popular AI Chat Providers\n\n### 3.1 · OpenAI ChatGPT (Deep Research Mode)\n\n1. Open **⋯ Settings → Beta features → Connectors** and click **➕ Add connector**.\n2. Paste the following JSON, then save:\n\n   ```jsonc\n   {\n     \"server_label\": \"Trendwatch Shorts\",\n     \"server_url\": \"https://trendwatch-1095464065298.us-east1.run.app\",\n     \"allowed_tools\": [\"search\", \"fetch\"],\n     \"require_approval\": \"never\" // or \"per-search\" if you want manual approval\n   }\n   ```\n\n![Connecting ChatGPT MCP](app/ui/static/mcp_chatgpt.png \"Connecting ChatGPT MCP\")\n3. Start a new chat, select **Deep Research** model (“o3‑mini‑deep‑research” or newer) and pick **Trendwatch Shorts** in the *Tools* dropdown.\n4. Test with: **“Find shorts about AI makeup tutorials.”**\n5. Inspect the trace link to confirm tool calls succeed.\n\n\u003e **Tip:** Add `\"require_approval\": \"auto\"` to force silent calls while still recording traces.\n\n#### Programmatic Usage\n\n```python\nfrom openai import OpenAI\nclient = OpenAI()\nresp = client.responses.create(\n    model=\"o3-mini-deep-research\",\n    tools=[{\n        \"type\": \"mcp\",\n        \"server_label\": \"trendwatch\",\n        \"server_url\": \"https://trendwatch-1095464065298.us-east1.run.app\",\n        \"allowed_tools\": [\"search\", \"fetch\"],\n        \"require_approval\": \"never\",\n    }],\n    input=[{\"role\": \"user\", \"content\": [{\"type\": \"input_text\", \"text\": \"Top skateboarding shorts uploaded this week\"}]}],\n)\nprint(resp.choices[0].message.content[0].text)\n```\n\n---\n\n### 3.2 · Anthropic Claude 3 (Messages API)\n\n\u003e **Claude 3 Opus** and later support MCP via the `anthropic-beta: mcp-client-2025-04-04` header.\n\n```bash\ncurl https://api.anthropic.com/v1/messages \\\n  -H \"x-api-key: $ANTHROPIC_API_KEY\" \\\n  -H \"anthropic-beta: mcp-client-2025-04-04\" \\\n  -H \"content-type: application/json\" \\\n  -d '{\n    \"model\": \"claude-3-opus-2025-07-15\",\n    \"system\": \"You are a research assistant.\",\n    \"tools\": [{\n      \"type\": \"mcp\",\n      \"server_url\": \"https://trendwatch-1095464065298.us-east1.run.app\",\n      \"allowed_tools\": [\"search\", \"fetch\"]\n    }],\n    \"messages\": [{\"role\":\"user\",\"content\":\"Give me viral cat shorts from the past 48 hours\"}]\n  }'\n```\n\nAnthropic automatically infers when to call `search`/`fetch` based on your prompt.\n\n---\n\n### 3.3 · ElevenLabs 11.ai (Voice \u0026 Chat Agents)\n\n1. Open **Dashboard → Agents → Tools (Beta)**.\n2. Click **Add MCP Server**, then enter:\n\n   * **Label:** `Trendwatch`\n   * **Server URL:** `https://trendwatch-1095464065298.us-east1.run.app`\n   * **Transport:** `SSE`\n   * **Allowed tools:** `search, fetch`\n3. Attach the toolset to your voice agent and deploy.\n4. Speak: *“Tell me about trending Pokémon shorts.”* 11.ai converts the request to text, triggers the MCP calls, and returns spoken results.\n\n\u003e ElevenLabs limits MCP calls to 30 req/min per agent. Use Cloud Run’s concurrency settings to scale accordingly.\n\n---\n\n## 4 · Testing \u0026 Troubleshooting\n\n| Symptom                    | Likely Cause                         | Fix                                                          |\n| -------------------------- | ------------------------------------ | ------------------------------------------------------------ |\n| **`401 Unauthorized`**     | Missing/incorrect `API_TOKEN` header | Supply `Authorization: Bearer \u003ctoken\u003e` or unset `API_TOKEN`. |\n| **`ToolNotFound: search`** | Connector allowed‑tools mismatch     | Ensure `allowed_tools` includes both `search` and `fetch`.   |\n| **Network timeout**        | Cloud Run cold start or egress block | Warm the service; check VPC egress rules.                    |\n| **Empty result list**      | Query too narrow                     | Confirm index contains matching titles/descriptions.         |\n\nCheck the raw endpoint manually:\n\n```bash\ncurl \"https://trendwatch-1095464065298.us-east1.run.app/search?query=ai\"\n```\n\n---\n\n## 5 · Security Checklist\n\n* **Input sanitization** – FastMCP escapes HTML; still validate prompt‑generated IDs.\n* **Rate limiting** – Apply Cloud Armor or FastMCP’s built‑in limits.\n* **Token scopes** – Issue least‑privilege API keys (read‑only access to this corpus).\n* **Prompt‑injection review** – Monitor traces for attacker‑controlled instructions.\n* **HTTPS everywhere** – Cloud Run terminates TLS; do **not** expose plain HTTP.\n\n---\n\n## 6 · Local Development Recap\n\n```bash\n# 1 – Install deps\npip install -r requirements.txt\n\n# 2 – Run the pipeline \u0026 create a parquet\npython -m app.pipeline --query \"AI\" --days 5 --out trend.csv\n\n# 3 – Serve locally (SSE on :8000)\nDATA_PATH=trend.csv python -m app.server\n```\n\nIf `DATA_PATH` is unset or the file is missing, the server will create a small\nexample dataset automatically.\n\nThen register `http://localhost:8000` as an MCP server in your test provider.\n\n---\n\n## 7 · References \u0026 Further Reading\n\n* **FastMCP Docs:** [https://github.com/jlowin/fastmcp](https://github.com/jlowin/fastmcp)\n* **OpenAI Cookbook – MCP examples:** [https://cookbook.openai.com/examples/partners/mcp_powered_voice_agents/mcp_powered_agents_cookbook](https://cookbook.openai.com/examples/partners/mcp_powered_voice_agents/mcp_powered_agents_cookbook)\n* **Building MCP Servers for Deep Research (PDF)** – see repo docs.\n\n---\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzack-dev-cm%2Ftrendwatch","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzack-dev-cm%2Ftrendwatch","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzack-dev-cm%2Ftrendwatch/lists"}