social-ops-mcp
by Ar5en1c
README.md
# social-ops-mcp
An MCP server that lets an AI assistant read your creator and founder analytics, and draft posts for you, without ever posting on its own.
It talks to seven platforms through their official APIs: Google Search Console, YouTube, Instagram, LinkedIn, X, Reddit and GitHub. It uses plain `fetch`, with no browser automation, no scraping and no big SDKs, so the production install is about 26 MB.
## Why an approval gate
Give an agent a "post to LinkedIn" tool and sooner or later it posts something you never read. A bad draft, a wrong account, a thread that goes out twice because a call timed out and the agent retried. Auto-posting to Reddit is also a quick way to get an account banned.
So this server has no tool that posts directly. Publishing is two steps:
1. A stage tool checks platform limits, lints the copy, saves a local draft and returns a short preview, a one-time `draft_id` and an `approval_hash`. Nothing leaves your machine.
2. `publish_approved_draft` posts only when it gets the `draft_id`, the exact `approval_hash` and `confirm_human_approved: true`. It refuses drafts that expired, were already published, or were edited after staging.
Read tools (analytics, rules, stats) run directly and never change anything.
Reddit is read-only on purpose. The server can pull a subreddit's live rules and a post's metrics, and that's all. It has no code path that submits, comments or votes, and a test fails if one appears.
## Tools
| Tool | Kind | What it does |
| --- | --- | --- |
| `connector_status` | read | Shows which platforms have credentials right now. Prints env var names, never values. |
| `gsc_performance` | read | Search Console clicks, impressions, CTR, average position, top queries and pages. |
| `gsc_sitemaps` | read | Submitted sitemaps with status, warnings and errors. |
| `youtube_channel_stats` | read | Subscribers, views, recent uploads with likes and comments, plus Analytics totals. |
| `instagram_account_stats` | read | Followers, recent posts with likes, comments and reach, and the publishing quota. |
| `linkedin_profile_info` | read | Which member the token belongs to and the author URN posts will use. |
| `x_account_stats` | read | Followers and recent posts with engagement for you or any public handle. |
| `reddit_subreddit_rules` | read | Live rules and settings of a subreddit, so you can check them before posting by hand. |
| `reddit_post_metrics` | read | Score, upvote ratio, comment count and top comments of one post. |
| `github_repo_stats` | read | Stars, forks, open issues and PRs, recent commits, and traffic if your token can see it. |
| `lint_copy` | read | Runs the copy linter without staging anything. |
| `list_drafts` | read | Lists local drafts and their status. Never shows approval hashes. |
| `stage_post` | stage | Generic step 1 for x, linkedin, instagram and youtube. |
| `x_stage_post` | stage | Step 1 for one X post or a thread. |
| `linkedin_stage_post` | stage | Step 1 for a LinkedIn post, with an optional first comment. |
| `instagram_stage_post` | stage | Step 1 for an Instagram image or Reel. |
| `youtube_stage_draft` | stage | Step 1 for a video upload. Private by default. |
| `discard_draft` | stage | Marks a staged draft as discarded. |
| `publish_approved_draft` | publish | Step 2. The only tool that can post anything. |
Stage tools only write a JSON file in the state directory. `publish_approved_draft` is the single tool marked destructive, so MCP clients that ask before running destructive tools will ask before it.
## Quickstart
You need Node 20.12 or newer. Add only the platforms you use. A platform without credentials just reports that it isn't configured.
The package isn't on npm yet. Until it is, build it from a checkout:
```bash
git clone https://github.com/Ar5en1c/social-ops-mcp.git
cd social-ops-mcp
npm install
npm run build
```
Then use `node /absolute/path/to/social-ops-mcp/dist/index.js` wherever the examples below say `npx -y social-ops-mcp`.
Get tokens for the platforms you want from [SETUP.md](SETUP.md), then register the server.
### Claude Code
```bash
claude mcp add social-ops \
-e GSC_ACCESS_TOKEN=... -e GSC_SITE_URL=sc-domain:example.com \
-e GITHUB_TOKEN=... \
-- npx -y social-ops-mcp
```
### Claude Desktop
Edit `claude_desktop_config.json` (Settings, Developer, Edit Config):
```json
{
"mcpServers": {
"social-ops": {
"command": "npx",
"args": ["-y", "social-ops-mcp"],
"env": {
"SOCIAL_OPS_ENV_FILE": "/absolute/path/to/.social-ops.env"
}
}
}
}
```
`SOCIAL_OPS_ENV_FILE` points at a dotenv file, so your tokens stay out of the client config. You can also put each variable straight into `env`.
### Cursor
Add the same block to `.cursor/mcp.json` in your project, or `~/.cursor/mcp.json` for every project.
### T3 Code
T3 Code runs on top of Claude Code or Codex, so register the server the way that agent expects. For Claude Code that's the `claude mcp add` command above.
### First run
Ask the assistant to call `connector_status`. Then try something read-only, like "how did my site do in Search Console this month". For posting, ask it to stage a draft and show you the preview. Only say yes when you've read it.
## Security model
What the gate guarantees:
- Nothing posts without all three of `draft_id`, `approval_hash` and `confirm_human_approved: true`.
- The `approval_hash` is a SHA-256 over the draft id, platform, exact content, expiry and a random nonce. Change one character of the draft file and publishing is refused. With `SOCIAL_OPS_APPROVAL_SECRET` set it becomes an HMAC, so nobody can forge a matching hash from the file alone.
- Drafts expire after 60 minutes by default (`SOCIAL_OPS_DRAFT_TTL_MINUTES`).
- Five wrong hashes lock a draft.
- Each draft publishes at most once. A lock file and a `publishing` status are written before any API call, so a crash or a retry can't produce a second post. A draft that fails partway is closed, and the error says what already went out.
- Every stage, refusal, publish and failure is appended to `audit.jsonl` in the state directory. It holds ids, platforms and hash prefixes, never your tokens or post text.
- YouTube uploads are private unless you pass `privacy_status: "public"` together with `allow_public: true`.
- Credentials come from environment variables only. Secret values are scrubbed from error messages, and `connector_status` lists names, never values.
What it doesn't do on its own:
- The hash proves that what gets published is what was previewed. It doesn't prove a human looked. An agent holding the hash can call `publish_approved_draft` right after staging. The real human checkpoint is your MCP client's approval prompt, so keep per-call approval on for `publish_approved_draft` and don't allowlist it.
- It doesn't rate limit the platforms. Their own limits and your token's scopes still apply.
- Anyone who can read your state directory can read your drafts. The directory is created with owner-only permissions.
Set `SOCIAL_OPS_DRY_RUN=1` to rehearse. Every gate runs, nothing is sent, and the draft stays publishable.
## Copy linter
Staging runs a linter on the outbound text.
- Hard limits always block: X 280 weighted characters (URLs count 23, emoji count 2), LinkedIn 3000, Instagram caption 2200, YouTube title 100 and description 5000 bytes, Instagram 30 hashtags, YouTube 15.
- Style checks warn: em dashes and en dashes, and more hashtags than reads naturally (X 2, LinkedIn 5, Instagram 10).
`SOCIAL_OPS_LINT=strict` turns warnings into blockers. `SOCIAL_OPS_LINT=off` hides the style warnings but keeps the hard limits, since the platforms would reject those posts anyway.
## Configuration
Every setting is an environment variable. [.env.example](.env.example) lists all of them and [SETUP.md](SETUP.md) shows where each token comes from.
| Variable | Default | Purpose |
| --- | --- | --- |
| `SOCIAL_OPS_STATE_DIR` | `~/.social-ops-mcp` | Drafts and the audit log |
| `SOCIAL_OPS_DRAFT_TTL_MINUTES` | `60` | How long a staged draft stays publishable (1 to 1440) |
| `SOCIAL_OPS_APPROVAL_SECRET` | unset | Makes approval hashes an HMAC |
| `SOCIAL_OPS_DRY_RUN` | off | Run every check, send nothing |
| `SOCIAL_OPS_LINT` | `warn` | `warn`, `strict` or `off` |
| `SOCIAL_OPS_ENV_FILE` | unset | Dotenv file loaded at startup |
## Development
```bash
npm install
npm run typecheck
npm test # offline, fetch is mocked, the real network is blocked
npm run build
npm run smoke # live stdio handshake against dist/
```
The tests cover every adapter with a mocked `fetch`, the approval gate (wrong hash, replay, expiry, tampering, Reddit writes), the linter, secret handling, and the `tools/list` schema. Every tool and every argument must have a description or the suite fails.
Adding a platform means a file in `src/adapters/` that exports tool definitions, plus a publisher if it can post. Registering a publisher for a read-only platform throws.
## License
MIT, see [LICENSE](LICENSE).
This server cannot be deployed
Maintenance
ActivityMaintained
ResponsivenessNo recent community issues