Skip to content
Merged
13 changes: 13 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ args = ["package-name", "optional-arg"]
| [Fetch](https://github.com/modelcontextprotocol/servers/tree/main/src/fetch) | `mcp-server-fetch` | `uvx` | HTTP fetch / web scraping |
| [SQLite](https://github.com/modelcontextprotocol/servers/tree/main/src/sqlite) | `mcp-server-sqlite` | `uvx` | Query local SQLite databases |
| [Puppeteer](https://github.com/modelcontextprotocol/servers/tree/main/src/puppeteer) | `@modelcontextprotocol/server-puppeteer` | `npx` | Browser automation |
| [Threads](https://github.com/baguskto/threads-mcp) | `threads-mcp-server` | `npx` | Publish/manage Meta Threads posts (needs access token) |

> Find more servers at the [MCP server registry](https://github.com/modelcontextprotocol/servers) and [mcp.so](https://mcp.so/).

Expand All @@ -142,6 +143,17 @@ command = "npx"
args = ["-y", "@brave/brave-search-mcp-server"]
[mcp_servers.env]
BRAVE_API_KEY = "your-brave-api-key"

# Meta Threads — publish posts and read replies (requires long-lived access token)
# Token setup: Facebook Developers → Create App → add Threads API product →
# request threads_basic / threads_content_publish / threads_manage_replies /
# threads_read_replies → generate token under Threads API → Access Tokens
[[mcp_servers]]
name = "threads"
command = "npx"
args = ["-y", "threads-mcp-server"]
[mcp_servers.env]
THREADS_ACCESS_TOKEN = "your-long-lived-access-token"
```

#### Tool Naming
Expand Down Expand Up @@ -207,6 +219,7 @@ src/
- [x] Setup wizard (web UI + CLI) for guided `config.toml` creation
- [x] Agent skill writer (`write_skill_file` tool — creates/updates skill files from within the agent)
- [x] Agent skill reload (`reload_skills` tool — hot-reloads skill registry without restart)
- [x] Meta Threads MCP integration (setup wizard entry, config example, token setup guide)

### Planned

Expand Down
19 changes: 19 additions & 0 deletions config.example.toml
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,25 @@ directory = "skills"
# GOOGLE_WORKSPACE_REFRESH_TOKEN = "your-refresh-token" # from step 4 above
# GOOGLE_WORKSPACE_ENABLED_CAPABILITIES = '["drive","docs","gmail","calendar","sheets","slides"]'

# Example: Meta Threads MCP server (publish posts, read replies, analytics)
#
# Token setup:
# 1. Go to https://developers.facebook.com/apps → Create App → Business type
# → add the "Threads API" product from the dashboard
# 2. Under Threads API → Permissions → request:
# threads_basic, threads_content_publish,
# threads_manage_replies, threads_read_replies
# Add your Threads account as a Test User under App Roles → Roles
# 3. Under Threads API → Access Tokens → Generate Token for your test user
# → copy the long-lived token (valid ~60 days; regenerate before expiry)
#
# [[mcp_servers]]
# name = "threads"
# command = "npx"
# args = ["-y", "threads-mcp-server"]
# [mcp_servers.env]
# THREADS_ACCESS_TOKEN = "your-long-lived-access-token"

# Example: Web search MCP server with environment variables
# [[mcp_servers]]
# name = "brave-search"
Expand Down
117 changes: 117 additions & 0 deletions docs/plans/2026-02-21-threads-mcp-integration-design.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
# Threads MCP Integration — Design

**Date:** 2026-02-21
**Status:** Approved

## Goal

Add Meta Threads publishing support to RustFox via the `baguskto/threads-mcp` MCP server. The integration must match the existing Google Workspace MCP pattern: catalog entry in the setup wizard, a guideline popup modal for token setup, a commented example in `config.example.toml`, and a README update.

## Chosen MCP

**`baguskto/threads-mcp`** — npm package `threads-mcp-server`

- Runner: `npx -y threads-mcp-server`
- Single environment variable: `THREADS_ACCESS_TOKEN`
- Capabilities: publish posts, read replies, delete posts, analytics, search
- Fits existing `npx` launcher model used throughout the catalog
- Reference: https://github.com/baguskto/threads-mcp

Why not the alternatives:
- **ThreadsMcpNet**: requires .NET 8 + Redis; not compatible with the npx/uvx launcher model
- **Apify scrapers**: read-only, no publishing capability

## Files Changed

### 1. `setup/index.html`

**MCP Catalog entry** — new object added to `MCP_CATALOG` array under a new `"Social Media"` category:

```js
{
name: 'threads',
category: 'Social Media',
desc: 'Publish and manage Meta Threads posts',
runner: 'npx',
args: ['-y', 'threads-mcp-server'],
envVars: ['THREADS_ACCESS_TOKEN'],
setupGuide: '__THREADS_GUIDE_BUTTON__',
link: 'https://github.com/baguskto/threads-mcp'
}
```

**New modal** — `#threads-modal` following the exact same HTML/CSS structure as `#oauth-modal`:

- Title: "Meta Threads — Access Token Setup"
- Subtitle: "Follow these 4 steps to get your access token. You only need to do this once."
- 4 numbered steps:
1. Create a Meta Developer App at developers.facebook.com
2. Add the Threads API product to the app
3. Configure permissions: `threads_basic`, `threads_content_publish`, `threads_manage_replies`, `threads_read_replies`
4. Generate a long-lived access token and paste into `THREADS_ACCESS_TOKEN`
- Warning box: note about token expiry (long-lived tokens last ~60 days) and need to refresh

**JS functions:**
- `openThreadsModal()` — adds `.open` class to `#threads-modal`, sets `overflow:hidden`
- `closeThreadsModal(event)` — removes `.open` class, restores overflow
- Escape key handler extended to also close `#threads-modal`

**Catalog rendering** — add `else if` branch for `__THREADS_GUIDE_BUTTON__` in the `guideHtml` block

### 2. `config.example.toml`

New commented block after the Google Workspace section:

```toml
# Example: Meta Threads MCP server (publish posts, read replies, analytics)
#
# Token setup:
# 1. Go to https://developers.facebook.com → My Apps → Create App
# → select "Business" type → add "Threads API" product
# 2. Under Threads API → Permissions → add:
# threads_basic, threads_content_publish,
# threads_manage_replies, threads_read_replies
# 3. Under Threads API → Access Tokens → Generate Token
# → copy the long-lived token (valid ~60 days; refresh before expiry)
#
# [[mcp_servers]]
# name = "threads"
# command = "npx"
# args = ["-y", "threads-mcp-server"]
# [mcp_servers.env]
# THREADS_ACCESS_TOKEN = "your-long-lived-access-token"
```

### 3. `README.md`

**Popular MCP Servers table** — new row:

| [Threads](https://github.com/baguskto/threads-mcp) | `threads-mcp-server` | `npx` | Publish & manage Meta Threads posts (needs access token) |

**Threads example block** — added to the Examples section:

```toml
# Meta Threads — publish posts and read replies
[[mcp_servers]]
name = "threads"
command = "npx"
args = ["-y", "threads-mcp-server"]
[mcp_servers.env]
THREADS_ACCESS_TOKEN = "your-long-lived-access-token"
```

## CSS / Styling

No new CSS is needed. The existing `.modal-overlay`, `.modal-box`, `.oauth-steps`, `.oauth-step`, `.oauth-step-num`, `.oauth-step-body`, `.oauth-step-title`, `.oauth-step-desc`, `.scope-list`, `.oauth-warning`, and `.btn-guide` classes are reused as-is for the Threads modal.

## No Rust / Backend Changes

All changes are in static files (`setup/index.html`, `config.example.toml`, `README.md`). No Rust source code changes are required because RustFox's MCP manager (`mcp.rs`) already handles any stdio-based MCP server generically.

## Testing Notes

- Open `setup/index.html` directly in a browser (or via `./setup.sh`)
- Navigate to Step 5 (MCP Tools) — verify "Social Media" category appears with a "threads" card
- Check the card when selected: `THREADS_ACCESS_TOKEN` field appears, "Threads Setup Guide" button opens the modal
- Verify modal closes via X button, Escape key, and clicking outside
- Verify config preview in Step 6 includes the threads block with correct env var
Loading