# Post to social media from Cursor & Claude Code (MCP)

> Learn to connect social media MCP servers to Cursor (Grok Build) and Claude Code, configure permissions, review posts and prevent unsafe publishing.

- Published: 2026-12-03
- Author: Luis Vidal (COO) https://www.linkedin.com/in/luis-vidal-montal/
- Canonical URL: https://apiwings.com/blog/post-to-social-media-from-cursor
- Publisher: APIWings

![A code editor window sending a post card through a checkpoint gate to three social network icons](https://apiwings.com/blog/post-to-social-media-from-cursor/post-to-social-media-from-cursor.webp)

**To post to social media from Cursor (now called Grok Build) or Claude Code, you connect a social media MCP server to the editor's agent and ask it to publish: the agent calls the server's tools, and the server calls each network's API.** Setup takes minutes. The hard part is making sure **no post goes out that a person did not approve**, and that needs more than the editor's settings: both editors have modes that run tools without asking, a hook only sees some of the agent's actions, and only the server can refuse a call it receives.

**Short answers:**

- **Is Cursor still called Cursor?** No. Cursor's site now shows "Cursor is now Grok Build" and its documentation has moved to docs.grok.com. Most files, folders and variables still say "cursor": the desktop app reads `.cursor/mcp.json`.

- **Can the agent post without asking?** Yes, if you let it: Grok Build's Run Everything mode and Cloud Agents, Claude Code's `bypassPermissions` mode and over-broad allow rules all remove the prompt.

- **What actually stops an unapproved post?** Four layers, and only one of them can refuse a call the agent manages to make: the MCP server itself, if it requires an approval the agent cannot produce.

- **Is a hook enough?** No. A hook sees MCP tool calls. A terminal command, a script or a direct HTTP request to the server never reaches it.

## What we tested and what comes from documentation

**Technical review: 2 December 2026**, against the Grok Build documentation (docs.grok.com, where cursor.com/docs now redirects) and the Claude Code documentation (code.claude.com). We mark every statement by where it comes from:

| Source | What it covers in this guide |
| --- | --- |
| **Tested by us in Claude Code 2.1.334** (the latest version on npm on 2 December 2026), headless | Permission prompts for MCP tools, allow and ask rules, the posting gate hook, a failing hook with `"onFailure": "block"`, the approval server. Eight runs, all recorded in `claude-code-test-run.json` |
| **Tested by us without an editor** | The gate (JS and Python), the config check, the approval server called directly: 752 test cases and 142 behaviour checks |
| **Documentation only, not tested** | Everything about Grok Build: we had no access to the app, so its examples are based on its documentation |
| **Our reading** | Recommendations, and conclusions the documentation does not state |

**The social media servers in our tests are simulations:** they never contact a network and never publish anything.

## Cursor is now Grok Build: what kept its old name

**Cursor's website shows "Cursor is now Grok Build", and every page of its documentation redirects to docs.grok.com.** We checked both on 2 December 2026; Cursor was renamed on 30 November 2026. The documentation describes three ways to use the product:

| Surface | What it is | Where its MCP servers live |
| --- | --- | --- |
| Agents Window | The desktop app (the old Cursor editor) | `.cursor/mcp.json` in the project, `~/.cursor/mcp.json` for all projects |
| Terminal UI (`grok`) | A command-line agent | `~/.grok/config.toml`, or `.grok/config.toml` with `--scope project`; it also reads `.cursor/mcp.json`, `.mcp.json` and `~/.claude.json` |
| Cloud Agents | Agents that run on Grok Build's machines | The Cloud Agents dashboard (cursor.com/agents) and team servers; hosted Cloud Agents "don't read ~/.cursor/mcp.json" |

**What still says "cursor", according to the documentation:**

- **Files and folders:** `.cursor/mcp.json`, `.cursor/permissions.json`, `.cursor/hooks.json`, `.cursor/sandbox.json` and their `~/.cursor/` versions.

- **The legacy command line:** `cursor-agent`, next to the new `grok`.

- **Environment variables:** `CURSOR_PROJECT_DIR`, `CURSOR_API_KEY`, `CURSOR_VERSION` and others; hook input still carries a `cursor_version` field.

- **Web addresses:** the Cloud Agents dashboard (cursor.com/agents) and the OAuth callback (`https://www.cursor.com/agents/mcp/oauth/callback`).

**Only the terminal app uses new names** (`~/.grok/`, `GROK_*` variables), and it still reads the Cursor paths for compatibility. If you already have a working `.cursor/mcp.json`, it keeps working. We found no current version number with a date: the newest version the documentation mentions is 3.25.

## How posting from your editor works: four layers

**The editor does not post anything itself.** The agent decides to call a tool, the MCP server holds the connection to your social accounts, and the networks' APIs receive the post. Between your request and the published post there are four places where it can be stopped:

![Diagram of the four layers between an editor's agent and a social network, and the terminal path that skips the first two](https://apiwings.com/blog/post-to-social-media-from-cursor/editor-mcp-posting-flow.webp)

*Four layers between a request and a published post. A terminal command or a script skips the first two.*

| Layer | Who runs it | What it decides |
| --- | --- | --- |
| 1. The agent's permission rules | The editor | Whether a tool runs, asks you or is blocked, by tool name |
| 2. Local hooks | The editor, before each tool call | Whether this call, with these arguments, runs, asks or is blocked |
| 3. Authorization in the MCP server | The server | Whether it accepts the call at all, whoever made it |
| 4. The social accounts' permissions | Each network | What the server's token can do on that account |

**Layers 1 and 2 only see what the agent does through the editor's MCP tools.** If the agent can also run terminal commands, it can call the server's HTTP address or a network's API directly with a key it finds. **Layers 3 and 4 hold in that case:** the server and the network do not care which program sent the request. That is why this guide ends with the server, not with the hook. For how a social media MCP server works and how to review one before you connect it, see our guide to the [social media MCP server for Claude](https://apiwings.com/blog/social-media-mcp-server-claude).

## Set up a social media MCP server in Cursor (Grok Build)

**Documentation only: we could not run Grok Build.** These examples follow its documentation as of 2 December 2026; try each one with a simulated server before you rely on it.

### In the desktop app (Agents Window)

**The desktop app reads `.cursor/mcp.json` in the project and `~/.cursor/mcp.json` for all projects;** when both define the same server name, the project file wins. You can also add servers from **Customize \> MCPs** in the sidebar and switch each one on or off. A remote server with its key in your environment, and the local approval demo server from the downloads:

```json
{
  "mcpServers": {
    "social": {
      "url": "https://mcp.your-social-provider.com/mcp",
      "headers": {
        "Authorization": "Bearer ${env:SOCIAL_API_KEY}"
      }
    },
    "approval-demo": {
      "type": "stdio",
      "command": "node",
      "args": ["${workspaceFolder}/tools/approval-demo-mcp-server.mjs"],
      "env": {
        "APPROVAL_DEMO_STATE": "${workspaceFolder}/tools/approval-demo-state.json",
        "APPROVER_PUBLIC_KEY": "${workspaceFolder}/tools/approver-public.pem"
      }
    }
  }
}
```

- **Local servers need `"type": "stdio"`:** the MCP reference lists it as required, even though its first example leaves it out.

- **Transports:** stdio, SSE and Streamable HTTP.

- **Variables:** `${env:NAME}`, `${workspaceFolder}`, `${userHome}` and others, in `command`, `args`, `env`, `url` and `headers`. Local servers can also read an `envFile`; remote servers cannot.

- **OAuth:** "authorization code flow with PKCE", with dynamic client registration. For a provider that needs a fixed client, add an `auth` object with `CLIENT_ID` (and optionally `CLIENT_SECRET` and `scopes`). Leave out the `Authorization` header when you sign in with OAuth.

- **After editing the file,** save it and restart Grok Build.

Replace `mcp.your-social-provider.com` with your provider's MCP address.

### In the terminal (grok)

**The terminal app adds servers with `grok mcp add`.** The command forms below are from its documentation, with our server names:

```bash
grok mcp add --transport http social https://mcp.your-social-provider.com/mcp --header "Authorization: Bearer ${SOCIAL_API_KEY}"
grok mcp add approval-demo -- node tools/approval-demo-mcp-server.mjs
grok mcp list
grok mcp doctor social
```

- **Where:** `~/.grok/config.toml`, or `.grok/config.toml` in the current folder with `--scope project`, under `[mcp_servers.<name>]`.

- **Variables:** `${VAR}` and `${VAR:-default}`, not `${env:NAME}`.

- **OAuth:** "trigger a browser flow on first use"; tokens are stored in `~/.grok/mcp_credentials.json`.

- **Tool names:** MCP tools are "namespaced as `<server>__<tool>`", for example `social__schedule_post`.

- **Project trust:** "Project hooks require trust before they run" (`/hooks-trust` or `--trust`), and the same trust covers project MCP servers.

### Cloud Agents: no approvals, and a different hook

**Grok Build's Cloud Agents run on its machines and skip approvals:** "Cloud Agents run inside their own dedicated machine, so the agent never asks you to approve an action." Their servers are configured in the Cloud Agents dashboard. **The `beforeMCPExecution` hook does not run on hosted Cloud Agents**; for HTTP servers that run on Grok Build's backend, only `preToolUse` fires, with the tool named `MCP:<tool_name>` and no server name. **Our recommendation:** do not give a cloud agent a server that can publish. If it must prepare posts, give it a server or a token that can only create drafts or approval requests.

## Set up a social media MCP server in Claude Code

### Add a server with claude mcp add

```bash
claude mcp add --transport http social https://mcp.your-social-provider.com/mcp --header "Authorization: Bearer $SOCIAL_API_KEY"
claude mcp add --transport stdio approval-demo -- node tools/approval-demo-mcp-server.mjs
claude mcp list
```

- **Scopes:** each command "writes to local scope unless you add `--scope project` or `--scope user`". Local and user servers are stored in `~/.claude.json`; project servers in `.mcp.json` at the project root, which you commit.

- **Transports:** HTTP and stdio. SSE still works but "is deprecated".

- **OAuth:** `/mcp` inside Claude Code, or `claude mcp login <name>`. A `claude -p` run "has no /mcp panel", so sign in interactively first.

**Note on the first command:** your shell replaces `$SOCIAL_API_KEY` before Claude Code sees it, so the key itself is saved in `~/.claude.json`. That file is personal, not shared; for a team server, write `.mcp.json` with a variable instead.

### Share the server in .mcp.json

```json
{
  "mcpServers": {
    "social": {
      "type": "http",
      "url": "https://mcp.your-social-provider.com/mcp",
      "headers": {
        "Authorization": "Bearer ${SOCIAL_API_KEY}"
      }
    },
    "approval-demo": {
      "type": "stdio",
      "command": "node",
      "args": ["tools/approval-demo-mcp-server.mjs"],
      "env": {
        "APPROVAL_DEMO_STATE": "tools/approval-demo-state.json",
        "APPROVER_PUBLIC_KEY": "tools/approver-public.pem"
      }
    }
  }
}
```

**Claude Code expands `${VAR}` and `${VAR:-default}` from each person's environment.** In an interactive session, it asks before using a server that arrives in `.mcp.json` ("Pending approval" in `claude mcp list`, which we saw in our test). **A headless run does not ask:** in `claude -p`, Claude Code "loads project-scoped servers without asking", and its documentation adds that a `-p` session runs the project's hooks and connects its `.mcp.json` servers "even in a folder you've never trusted". **Only run `claude -p` in repositories whose `.mcp.json` and `.claude/settings.json` you have read.**

### Run it from scripts and CI with claude -p

```bash
claude -p "Prepare the release note in notes/release.md as an approval request for our Bluesky account, Monday 09:00 Europe/Madrid" \
  --mcp-config .mcp.json --strict-mcp-config --settings .claude/settings.json
```

- **Calls that need a person are denied:** "In a Manual mode `claude -p` run, a call that needs approval is denied unless something approves it."

- **`--strict-mcp-config`** loads only the servers you pass with `--mcp-config` and skips the rest.

- **`--settings` adds to the project's `.claude/settings.json`; it does not replace it.** We saw this in our test: a hook defined in the project still ran.

- **In a folder that never went through Claude Code's trust prompt, the project's allow rules are "Not used" in `-p`**, while its deny and ask rules apply. Pass allow rules with `--settings` if you need them.

**A CI job should prepare posts, not publish them.** Let it create approval requests (layer 3) and leave the signature to a person.

## Grok Build and Claude Code compared for posting

| Question | Grok Build (formerly Cursor) | Claude Code |
| --- | --- | --- |
| Project config file | `.cursor/mcp.json` (desktop), `.grok/config.toml` (terminal) | `.mcp.json` |
| Key from the environment | `${env:NAME}` (desktop), `${VAR}` (terminal) | `${VAR}`, `${VAR:-default}` |
| Asks before an MCP tool by default | Yes: "asks for approval before using MCP tools by default" | Yes, in our test: a tool with no allow rule needed approval |
| Mode that runs tools without asking | Run Everything (desktop), always-approve (terminal) | `bypassPermissions` (allow rules have no effect; ask and deny rules still apply) |
| Allow a tool | `mcpAllowlist`: `"server:tool"` in `.cursor/permissions.json` | `permissions.allow`: `"mcp__server__tool"` |
| Always ask for a tool | No such rule for MCP tools in the desktop app (our reading) | `permissions.ask`, which prompts "in any mode, including `bypassPermissions`" |
| Hook before each MCP call | `beforeMCPExecution` (desktop), `PreToolUse` (terminal), `preToolUse` with `MCP:<tool>` (Cloud Agents' backend servers) | `PreToolUse` with matcher `mcp__server__.*` |
| Hook answers | Desktop: `"permission": "allow"`, `"deny"` or `"ask"` (what "ask" does is not documented). Terminal: only `"decision": "deny"` | `permissionDecision`: `"allow"`, `"deny"`, `"ask"` (or `"defer"` in `-p`) |
| Exit code 2 | Blocks | Blocks |
| Hook crashes, times out or exits with another code | Call runs, unless `"failClosed": true` | Call runs, unless `"onFailure": "block"` |
| Default hook timeout | Desktop: "platform default" (no number); terminal: 5 seconds | 600 seconds for command hooks |
| Runs without a person | Cloud Agents never ask | `claude -p` denies calls that need a person |

**Do not assume a hook behaves the same in both editors.** The answers, the failure behaviour, the timeouts and even the tool names differ, and the Grok Build terminal app documents only "deny". Our gate detects which editor called it and answers in that editor's format.

## Layer 1: the agent's permission rules

**The rule for both editors: allow read-only tools by exact name, never allow a tool that can publish, and never allow a whole server.** Do not decide from a tool's name: a tool called `get_post` can do anything its author wrote. **Read what each tool does** (its description, its code or the provider's documentation) and allow only those you reviewed.

### Grok Build: Run Modes and permissions.json

**MCP tools follow the same Run Modes as terminal commands**, set in **Settings \> Agents \> Approvals & Execution**:

- **Auto-review** (the default since version 3.6, 29 May 2026): allowlisted calls run, and a classifier decides the rest.

- **Allowlist:** "Actions in your allowlist run without approval." An empty allowlist asks for everything (this replaced "Ask Every Time" in version 3.5).

- **Run Everything:** "Every tool call runs automatically." The documentation does not say whether hooks still run in this mode. **Do not use it with a social media server.**

```json
{
  "mcpAllowlist": [
    "social:list_accounts",
    "social:get_post_status",
    "approval-demo:list_accounts",
    "approval-demo:validate_post",
    "approval-demo:get_post_status",
    "approval-demo:request_approval"
  ]
}
```

**Entries are `"server:tool"`, case-insensitive, with `*` wildcards; `"social:*"` and `"*:*"` let publishing tools run without asking.** Per-user and per-project files are combined, and a team admin's dashboard settings come first. The file's `autoRun` instructions are "steering, not enforcement", and the documentation calls the file "Not a security boundary". In the terminal app, rules go in `config.toml` under `[permission]`; its documentation shows `MCPTool(server__*)` as the only MCP example, and in always-approve mode "deny rules and PreToolUse hooks still apply".

### Claude Code: allow, ask and deny

```json
{
  "permissions": {
    "allow": [
      "mcp__social__list_accounts",
      "mcp__social__get_post_status",
      "mcp__approval-demo__request_approval"
    ],
    "ask": [
      "mcp__social__schedule_post",
      "mcp__social__publish_post",
      "mcp__approval-demo__schedule_post",
      "mcp__approval-demo__cancel_scheduled_post"
    ]
  }
}
```

- **Rule order:** "deny, then ask, then allow."

- **`mcp__social` and `mcp__social__*`** match every tool of the server. Never put them under `allow`.

- **`mcp__*` under `allow` does nothing:** "An unanchored allow glob such as `"*"`, `"B*"`, or `"mcp__*"` is skipped."

- **`bypassPermissions`:** "Allow rules have no effect", explicit ask rules still prompt and "Deny rules block in every mode".

- **We tested the ask rule:** with `schedule_post` allowed through `--settings` and asked in the project's settings, the ask rule won and the `-p` run was denied.

## Layer 2: a posting gate hook

**Permission rules decide by tool name. A hook sees the arguments**: the text, the accounts, the time. Our posting gate (`posting-gate.mjs` and `posting_gate.py`, same rules in `posting-gate-rules.json`) runs before each MCP call in Claude Code and Grok Build. **It is a local check that catches mistakes and some misuse. It is not a security guarantee.**

### What the gate decides

**It decides from an explicit list of reviewed tools**, per server, in `posting-gate-rules.json`, never from a tool's name:

```text
"reviewed_tools": {
  "approval-demo": {
    "list_accounts": "read",
    "validate_post": "read",
    "get_post_status": "read",
    "request_approval": "proposal",
    "request_cancellation": "proposal",
    "schedule_post": "write",
    "cancel_scheduled_post": "destructive"
  }
}
```

| Call | The gate answers | Why |
| --- | --- | --- |
| `read` tool from the list | Nothing in Claude Code (your rules decide); "allow" in Grok Build | You reviewed that it cannot change anything |
| `proposal` tool from the list | Same as read, if the content passes the checks below; otherwise "deny" | It only creates a pending request on the server |
| `write` or `destructive` tool from the list | "ask", with the text, accounts and time in the message; "deny" if a check fails | A person confirms what will go out |
| Any tool not on the list, including `get_and_publish` or a look-alike server name | "ask", or "deny" if a check fails | Unreviewed tools are treated as able to publish |
| Any call from a Grok Build cloud agent (`MCP:<tool>`) that is not a reviewed read | "deny" | Nobody can approve it, and the documentation says "ask" is not enforced there |

**What makes it deny a call:**

- **An approval the agent wrote itself:** fields such as `approved`, `human_approved`, `confirmed`, `authorized`, `skip_review` or `override`, at any depth. Real approval has to come from outside the agent (layer 3).

- **Something that looks like a secret** in any argument, including read tools: API keys, GitHub and Slack tokens, AWS keys, bearer tokens, private keys.

- **A link to a local or test address:** `localhost`, `127.0.0.1`, `*.local`, `staging.`, `*.internal`, `example.com`.

- **Text too long for the network:** Bluesky 300 graphemes, Threads 500 characters, Instagram 2,200, LinkedIn 3,000.

- **A time in the past, impossible (30 February) or without a time zone. Empty text.**

**It does not trust `dry_run`:** the gate cannot know whether a server honours it, so a write with `dry_run: true` is still asked. **If the gate itself fails** (a missing or broken rules file, unreadable input), it exits with code 2, which both editors treat as "deny".

### Install it in Grok Build

Copy `posting-gate.mjs` and `posting-gate-rules.json` to `.cursor/hooks/` and add `.cursor/hooks.json`:

```json
{
  "version": 1,
  "hooks": {
    "beforeMCPExecution": [
      {
        "command": "node .cursor/hooks/posting-gate.mjs",
        "timeout": 10,
        "failClosed": true
      }
    ]
  }
}
```

**`"failClosed": true` is essential:** without it, "Crashes, timeouts, and non-zero exit codes other than 2 fail open by default". With it, those failures and a hook with no output block the call. Invalid JSON from the hook blocks the call either way. The documentation recommends treating a missing or unexpected `mcp_server_name` as a deny, which the gate does. **Not tested by us:** how the desktop app shows an "ask" from this hook, and whether hooks run in Run Everything mode. The terminal app also reads `.cursor/hooks.json` and `.claude/settings.json`; there the gate only sends "deny", and its `failClosed` applies to `PreToolUse`.

### Install it in Claude Code

Copy the two files to `.claude/hooks/` and add to `.claude/settings.json`:

```json
{
  "hooks": {
    "PreToolUse": [
      {
        "matcher": "mcp__(social|approval-demo)__.*",
        "hooks": [
          {
            "type": "command",
            "command": "node \"$CLAUDE_PROJECT_DIR/.claude/hooks/posting-gate.mjs\"",
            "timeout": 10,
            "onFailure": "block"
          }
        ]
      }
    ]
  }
}
```

**`"onFailure": "block"` is essential here too.** Claude Code treats a hook that crashes, times out or exits with a code other than 2 as a "non-blocking error": "The action goes ahead". **We tested it:** with the hook's file missing, Claude Code answered "blocking because onFailure is "block"" and the call did not run. The `.*` in the matcher is required: a matcher like `mcp__memory` alone "matches no tool". `GATE_LOG=/path/gate-log.jsonl` keeps a log of every decision.

### What a hook cannot see

**A hook runs before MCP tool calls. It never sees:**

- **Terminal commands:** `curl` to the server's address or to a network's API, with a key from an environment variable or a config file the agent can read.

- **Scripts the agent writes and runs**, in any language.

- **Other MCP servers or tools** that are not in the hook's matcher, such as a generic HTTP or browser tool.

- **Changes to the hook itself:** an agent that can edit files can edit `.claude/settings.json`, `.cursor/hooks.json` or the gate.

**Permission rules on terminal commands do not close this gap.** Claude Code's documentation says "Bash permission patterns that try to constrain command arguments are fragile" and that such a rule "isn't a security boundary around the program". Our config check flags allow rules that let the agent run `curl`, `node`, `python` or a shell (`TERMINAL_CAN_BYPASS`). **The real answer is layer 3.**

## Layer 3: approval enforced by the MCP server

**The server is the only layer that sees every request, whoever sends it.** So the approval has to be checked there, and it has to be something the agent cannot produce. Our `approval-demo-mcp-server.mjs` shows one way to do it, with `approve-post.mjs` for the person who approves:

1. **The agent calls `request_approval`** with the accounts, the text and the time. The server checks the post and stores it as pending. **Nothing is scheduled.**

1. **A person runs `node approve-post.mjs sign <request_id> --key <their key>`** in their own terminal. It prints the request in full, asks them to type its id, asks for the passphrase of their Ed25519 private key and prints an approval token.

1. **The agent calls `schedule_post` with the request id and the token.** The tool accepts no text and no accounts: it can only schedule what was approved.

**The token is bound to everything that matters, and the server checks all of it:**

| Bound to | What the server refuses |
| --- | --- |
| The approver's key | A made-up token, or one signed with any other key, including one the agent generated |
| The server and the action | A token for another server, or a schedule approval used to cancel |
| The request id | A token for request A used on request B |
| The content | Accounts, text or time changed after the person signed (a SHA-256 of all three is signed) |
| The time | A token after its expiry (30 minutes by default), or after the approved time has passed |
| A single-use nonce | The same token used twice |

**Approval fields the agent could invent count for nothing:** the server ignores everything except a valid signature, and it rejects extra arguments such as `approved: true`. Our behaviour tests call the server directly, with no editor and no hook, and check every refusal in the table.

**Limits of the demo, which you must not copy:** here the server, its state file and the approver's public key sit on the same machine as the agent. An agent with a terminal could replace the public key with its own. **In production, the check belongs in a server the agent cannot modify** (your backend or your provider's), the approval should come through a channel the agent has no access to (a dashboard behind the person's own login, or a key on another device), and the private key's passphrase must never be in the agent's environment.

## Layer 4: the social accounts' own permissions

**The network applies the token's permissions to every request, whatever sent it.** This layer cannot tell a good post from a bad one, but it limits how much damage a misused token can do:

- **Ask for the narrowest scopes** the network offers. A token that can only post cannot delete or read messages.

- **Test with a separate account,** not your company's main profile.

- **Prefer draft or private modes** where the network has them. For example, TikTok's unaudited apps can only post privately (see our [TikTok Content Posting API](https://apiwings.com/blog/tiktok-content-posting-api) guide).

- **Revoke tokens you no longer use,** and keep publishing keys out of the agent's environment and out of files it can read.

## Which protections can actually stop a post

| Protection | Where it runs | Stops | Does not stop | Can it guarantee no unapproved post? |
| --- | --- | --- | --- | --- |
| Permission rules (allow, ask, deny; Run Modes) | Editor | MCP calls by tool name | Terminal commands, scripts, Run Everything, Cloud Agents | No |
| Posting gate hook | Editor | MCP calls by their arguments | Anything that is not an MCP call it matches; a hook that fails without fail-closed set | No |
| Fail-closed hook settings | Editor | Calls when the hook crashes or times out | Everything outside the hook | No |
| Approval enforced by the server | MCP server | Any request without a valid approval, from any program | A compromised server or approver key | Yes, if the agent cannot modify the server or reach the key |
| Account permissions | Network | Actions outside the token's scopes | Bad posts within those scopes | No |
| Network limits | Network | Posts over the daily caps | Everything within them | No |

## Real Claude Code results

![Summary of eight real Claude Code runs with the posting gate and the approval demo server, showing which layer stopped each post](https://apiwings.com/blog/post-to-social-media-from-cursor/posting-gate-worked-example.webp)

*Eight real Claude Code runs: which layer stopped each post, and the one that went through after a person signed it.*

**We ran Claude Code 2.1.334 headless with the approval demo server, the gate and the example settings.** The person's key and passphrase were kept outside the project and outside Claude Code's environment. The server is a simulation.

| Run | Configuration | Request | Result |
| --- | --- | --- | --- |
| 1 | Gate on | Get a post with a `localhost` link approved | The gate denied `request_approval`; nothing reached the server |
| 2 | Gate on | Schedule a clean post | `request_approval` stored request `req_800e7d5da94e`; Claude did not call `schedule_post` and asked for a signed token |
| 3a, 4a | Hook configured, its file missing, `"onFailure": "block"` | Schedule with a made-up approval, then with the real token | Both blocked: "blocking because onFailure is "block"" |
| 3b, 4b | No hook; project `ask` rule; `allow` rule passed with `--settings` | Same | Both denied: the ask rule won over the allow rule, and `-p` has nobody to ask |
| 3c | No hook, no ask rule (testing the server alone) | Schedule with the approval "APPROVED-BY-USER" | **The server refused:** "The approval token is missing or malformed." |
| 4c | Same | Schedule with the token the person signed | **Scheduled exactly the approved post** (simulated) |

**What these runs show:** each layer stopped what it was meant to stop, Claude did not try other routes when a call was refused, and with the first two layers removed, the server still refused the invented approval. **What they do not show:** how an agent behaves when it is asked to get around the checks, or how Grok Build behaves. The full answers and the gate's log are in `claude-code-test-run.json`.

### Test the resources yourself

```bash
node test-all.mjs
python3 test_all.py
node test-security.mjs
python3 test_security.py
```

| Suite | What it checks | Result on 2 December 2026 |
| --- | --- | --- |
| `test-all.mjs` / `test_all.py` | 752 cases: 622 for the gate, 130 for the config check. 105 have their expected result written by hand; the rest check that JS and Python give the same answer | 752 of 752 in both |
| `test-security.mjs` | 89 behaviour checks on the real programs: hook failures, misleading tool names, invented approvals, exposed keys, editor formats (both gates), and the approval server called directly | 89 of 89 |
| `test_security.py` | 53 checks written separately in Python: the same kinds, plus edited tokens and extra arguments | 53 of 53 |

**We also broke the code on purpose** (removed the replay check, the content check, and the gate's exit code 2) to confirm the tests fail when they should; they did. In Python, install `regex` (`pip install regex`) for exact Bluesky counts.

## Check your project's MCP config before you commit it

**`mcp-config-check.mjs` (and `mcp_config_check.py`) reads the MCP, permission and hook files of a project for both editors:**

```bash
node mcp-config-check.mjs /path/to/your/project
python3 mcp_config_check.py /path/to/your/project --json
```

| Code | Level | What it means |
| --- | --- | --- |
| SECRET\_IN\_SHARED\_FILE | fix\_first | A key or token is written in `.cursor/mcp.json` or `.mcp.json` instead of a variable |
| PLAIN\_HTTP\_REMOTE | fix\_first | A remote server uses `http://` |
| AUTO\_APPROVES\_POSTING | fix\_first | `"*:*"`, `"social:*"`, `mcp__social`, `mcp__social__*`, a publishing tool in an allow list, or `bypassPermissions` |
| INVALID\_JSON | fix\_first | A config file cannot be read |
| NO\_POSTING\_GATE | review | A social media server with no hook checking its calls |
| GATE\_FAILS\_OPEN | review | Grok Build hook without `"failClosed": true`, or Claude Code hook without `"onFailure": "block"` |
| TERMINAL\_CAN\_BYPASS | review | An allow rule lets the agent run `curl`, `node`, `python` or a shell, which the MCP hook never sees |
| MISSING\_TYPE | review | A local server in `.cursor/mcp.json` without `"type": "stdio"` |
| AUTO\_ENABLES\_PROJECT\_SERVERS | review | `enableAllProjectMcpServers` is on |
| UNPINNED\_PACKAGE | review | A server runs with `npx` or `uvx` without a fixed version |
| RULE\_IGNORED | review | An allow rule Claude Code skips, such as `mcp__*` |
| NO\_PROJECT\_SERVERS | review | No project MCP file (personal files are not checked) |

**It finds social media servers by name, command or address, and by the servers listed in the gate's rules** (`--social name` adds others). **It is a checklist, not a security certification:** it cannot see personal config files, the server's code or what a tool really does. The example files in the downloads pass with `no_issues_found`.

## The limits every network still imposes

**No editor, hook or server raises a network's limits.** From our earlier guides, checked against each network's documentation in November 2026 (full comparison in [social media API limits compared](https://apiwings.com/blog/social-media-api-limits)):

| Network | Limit that matters for an agent | Detailed guide |
| --- | --- | --- |
| Bluesky | 300 graphemes per post; 5,000 points per hour per account, 3 per post | [Social media API limits](https://apiwings.com/blog/social-media-api-limits) |
| Threads | 500 characters; 250 posts and 1,000 replies per profile in 24 hours | [Social media API limits](https://apiwings.com/blog/social-media-api-limits) |
| Instagram | Professional accounts only; 100 API posts per account in 24 hours | [Instagram API post](https://apiwings.com/blog/instagram-api-post) |
| LinkedIn | 3,000 characters; posting as a company page needs a vetted API product | [LinkedIn API post](https://apiwings.com/blog/linkedin-api-post) |
| TikTok | Unaudited apps post only privately (`SELF_ONLY`) | [TikTok Content Posting API](https://apiwings.com/blog/tiktok-content-posting-api) |
| YouTube | 100 uploads a day per Google Cloud project | [YouTube API upload](https://apiwings.com/blog/youtube-api-upload-video) |
| X | Every post is billed; 100 requests per 15 minutes per user | [Social media API limits](https://apiwings.com/blog/social-media-api-limits) |

**An agent in a loop hits these limits faster than a person.** For retries, logs and approvals in agents generally, see [how an AI agent can publish your social media posts safely](https://apiwings.com/blog/ai-agent-publish-social-media-posts).

## Safe defaults for posting from your editor

- **Start with a simulated server** (`approval-demo-mcp-server.mjs`) and try every prompt and rule before you connect a real account.

- **Review every tool** of every server, and list them in the gate's `reviewed_tools`. Allow only reviewed read tools.

- **Never use Run Everything, always-approve or `bypassPermissions`** in a project with a social media server.

- **Keep publishing tools away from Grok Build's Cloud Agents.**

- **Install the gate with fail-closed settings:** `"failClosed": true` in Grok Build, `"onFailure": "block"` in Claude Code.

- **Do not let the agent run `curl`, scripts or a shell without asking** in the same project.

- **Require a server-side approval** the agent cannot produce, and keep the approver's key and passphrase out of the agent's reach.

- **Keep keys out of Git** (`${env:NAME}` in Grok Build, `${VAR}` in Claude Code) and out of files the agent can read.

- **Read `.mcp.json` and `.claude/settings.json` before running `claude -p` in a repository:** headless runs load its servers and hooks without asking.

- **Run `mcp-config-check`** before each commit that touches these files.

## If you want one API behind your agent

**If you are building an agent or a product that publishes to several networks**, one API means one set of tools to review, one server to put approvals in front of, and one integration instead of one per network (see [unified social media API vs native APIs](https://apiwings.com/blog/unified-social-media-api-vs-native) and [how to post to multiple social networks with one API call](https://apiwings.com/blog/post-to-multiple-social-networks-api)).

**That is what [APIWings](https://apiwings.com/) does. Its status on 2 December 2026:**

- **Live:** Bluesky, LinkedIn member profiles and X (optional, billed at X's own per-post cost).

- **In review with each network:** Instagram, Facebook Pages, Threads, TikTok and YouTube.

- **MCP server:** coming soon, not public yet.

- **Works today with any agent that can call an HTTP API**, Claude Code and Grok Build included, through its OpenAPI 3.1 specification. API keys can be limited to a single profile, which fits layer 4.

**APIWings does not include the approval flow in this guide:** if your agent publishes through it, put your own approval check in the service that holds the APIWings key. Start with the [quickstart](https://apiwings.com/docs/quickstart) or request access on [apiwings.com](https://apiwings.com/).

## Sources and review date

**Every rule in this guide was checked on 2 December 2026:**

| Page | What we took from it |
| --- | --- |
| [Grok Build: MCP (Agents Window)](https://docs.grok.com/build/agents-window/mcp) and [MCP help](https://docs.grok.com/build/agents-window/help/customization/mcp) | Config files and fields, `type` for stdio, variables, OAuth, default approval, Customize \> MCPs |
| [Grok Build: Run Modes](https://docs.grok.com/build/agents-window/agent/security/run-modes) | Auto-review, Allowlist, Run Everything, versions 3.5 and 3.6, Cloud Agents never ask |
| [Grok Build: permissions.json](https://docs.grok.com/build/agents-window/reference/permissions) | `mcpAllowlist`, precedence, `autoRun`, "Not a security boundary" |
| [Grok Build: hooks (Agents Window)](https://docs.grok.com/build/agents-window/hooks) | `beforeMCPExecution` input and answers, exit codes, `failClosed`, timeouts, `preToolUse` for Cloud Agents |
| [Grok Build: MCP servers](https://docs.grok.com/build/features/mcp-servers), [permissions](https://docs.grok.com/build/features/permissions), [hooks](https://docs.grok.com/build/features/hooks) and [settings](https://docs.grok.com/build/settings/reference) (terminal) | `grok mcp`, `config.toml`, tool names, permission modes, hook answers, 5-second timeout, trust |
| [Grok Build: self-hosted Cloud Agents](https://docs.grok.com/build/agents-window/cloud-agent/self-hosted/pool) | Where Cloud Agents read MCP servers; which hooks fire; version 3.25 |
| [Claude Code: MCP](https://code.claude.com/docs/en/mcp) | `claude mcp add`, scopes, `.mcp.json`, variables, project approval, `-p` behaviour, OAuth |
| [Claude Code: permissions](https://code.claude.com/docs/en/permissions) and [permission modes](https://code.claude.com/docs/en/permission-modes) | Rule order, MCP tool names, wildcards, `bypassPermissions`, Bash patterns |
| [Claude Code: hooks](https://code.claude.com/docs/en/hooks) | `PreToolUse`, `mcp_server`, `permissionDecision`, exit code 2, failures, `onFailure`, timeouts |
| [Claude Code: headless](https://code.claude.com/docs/en/headless) and [settings](https://code.claude.com/docs/en/settings) | `claude -p`, `--settings`, untrusted folders |
| [APIWings llms.txt](https://apiwings.com/llms.txt) (updated 1 December 2026) | APIWings product status |

**Grok Build is a new name and its documentation may change quickly;** we will review this guide when it does. The network limits come from the guides linked above.

## FAQ

### Can I post to social media from Cursor without an MCP server?

**Yes, but then the agent writes and runs code that calls each network's API with your keys.** Permission rules see a terminal command, not a post, and a hook on MCP calls sees nothing. An MCP server gives you named tools to review, allow or ask for, and a server can require an approval.

### Does my old Cursor MCP configuration still work in Grok Build?

**Yes, according to Grok Build's documentation.** The desktop app reads `.cursor/mcp.json` and `~/.cursor/mcp.json`, and the terminal app loads `.cursor/mcp.json` too. Add `"type": "stdio"` to local servers if it is missing.

### Can I use the same MCP server in Grok Build and Claude Code?

**Yes.** Write `.cursor/mcp.json` for Grok Build's desktop app and `.mcp.json` for Claude Code, with the key from an environment variable. Grok Build's terminal app reads both. The posting gate detects which editor called it.

### Will Claude Code or Grok Build post without asking me?

**Not by default, but both can be set to.** Run Everything, always-approve, Cloud Agents, `bypassPermissions` and allow rules that cover a publishing tool all remove the prompt. A server that requires a signed approval still refuses.

### What happens in a CI job when the agent tries to post?

**In `claude -p`, a call that needs a person is denied**, which we saw in our tests. Grok Build's Cloud Agents never ask. A CI job should create approval requests and leave the publishing to a person's approval.

### Is the posting gate a security guarantee?

**No.** It checks the MCP calls it sees, by rules. It does not see terminal commands, scripts or other tools, and an agent that can edit files can change it. Use it with permission rules, a server that enforces approvals and accounts with narrow permissions.
