
Ayrshare for Claude Code
PluginAyrshare's official plugin: post, schedule, reply to comments and see analytics on 13+ platforms (Instagram, LinkedIn, X, TikTok and more), with per-platform checks and your OK before publishing. Needs an Ayrshare API key (paid, 28-day trial); Claude Code only; X needs your own dev app.
Ayrshare for Claude Code
The unified social media API for AI agents. Publish, schedule, and analyze across 14+ networks directly from Claude Code, with post history for brand voice and validation against each platform's rules before every post. Powered by the Ayrshare API.
Install
claude plugin marketplace add ayrshare/ayrshare-social-media-api-claude-plugin
claude plugin install ayrshare@ayrshare
Requires Claude Code 2.1.119 or later. Then, inside Claude Code, run /plugin configure ayrshare@ayrshare and enter your API key, then run /reload-plugins (or restart Claude Code) so the tools load. Claude Code stores the key in your system's secure credential store. If you added Ayrshare from Claude's plugin directory on claude.ai instead, Claude Code knows it as ayrshare@synced, so run /plugin configure ayrshare@synced. Plugins from claude.ai appear in Claude Code 2.1.273 or later; on an older version, update Claude Code or install from this repository's marketplace as above. If your Claude Code doesn't open the settings from either command, run /plugin, open the Installed tab, select ayrshare, then Configure options. In the VS Code extension, type /plugins and click the gear icon on the ayrshare row. /ayrshare:setup walks you through it. Scopes and other install paths are under Installation below.
Then use the plugin by asking in plain English (e.g. "show my recent Instagram posts", "post this to LinkedIn tomorrow at 9am"); the tools fire on intent, and the trigger-skills route them. /ayrshare:setup is the only slash command, so there is no /ayrshare:post or /ayrshare:get_post_history to type.
Overview
The plugin lets an agent run the full social workflow without leaving Claude Code. Before publishing, the agent validates each post against the target network's rules and asks you to confirm, so avoidable rejections are caught before anything goes live. A single request publishes to Facebook, Instagram, LinkedIn, X, TikTok, YouTube, Pinterest, Reddit, Telegram, Threads, Bluesky, and others. Post history is available for matching a brand's voice, and analytics can be read back to inform the next post. Platform integrations are maintained by Ayrshare, so upstream API changes are handled outside your code. The API currently handles 30M+ calls per day.
The loop
- Learn. Retrieve a profile's post history for brand-voice context and review how past posts performed.
- Act. Publish and schedule across 13+ networks in a single call.
- Observe. Read live analytics to inform the next post.
- Stay safe. Validate each post against platform rules, then confirm before publishing.
Why use the API instead of a custom integration?
An LLM can generate an OAuth flow, but it does not cover Meta Tech Provider approval, X's pay-per-use API changes, or ongoing maintenance when a network changes its rules. The plugin handles:
- Pre-publish validation.
validate_postdry-runs content against each network's rules (length, format, media requirements) before you publish, andvalidate_mediachecks that a media URL is reachable before you attach it inmediaUrls. X BYOK is supported for the 2026 mandate, and platform integrations are maintained so an upstream API change does not break your integration. - One call, 13+ networks. A single request publishes to all connected platforms, each validated against its own rules.
- Multi-tenant. Post on behalf of many user profiles rather than a single brand.
- History API. Retrieve a profile's past posts for brand-voice context, and use historical performance data to inform future posts.
Safety
By default the plugin validates a post and requests confirmation before publishing. The agent prepares the draft; the user approves it.
A PreToolUse hook (hooks/hooks.json) also makes Claude Code ask you before it runs any tool with a live side effect. If you decline, the tool does not run and no request reaches Ayrshare. The hook covers these tools:
| Tool | Why it asks |
|---|---|
create_post, update_post, retry_post | Publishes, schedules, or changes a post on real social accounts. |
add_comment, reply_comment | Posts a comment in public. |
send_message | Sends a direct message. |
set_auto_response | Turns the DM auto-responder on or off, or changes its reply. |
create_profile | Creates a client profile, which uses profile quota and cannot be deleted through MCP. |
update_ad | Pauses, resumes, deletes, or archives a boosted ad, which changes real ad spend. The same status is also set on the ad's ad set and campaign, so other ads there change too. |
boost_post | Boosts a published post as a paid ad, which spends real money from the ad account. |
register_webhook, unregister_webhook | Changes where Ayrshare sends your account's events, including message and comment content. |
The hook matches each tool under both names Claude Code can give it: mcp__plugin_ayrshare_ayrshare__<tool> when the server comes from this plugin, and mcp__ayrshare__<tool> when you registered the server yourself under the name ayrshare.
Versions before 0.2.2 never showed this prompt for plugin installs, because the hook only listed the mcp__ayrshare__<tool> names. To update, run claude plugin marketplace update ayrshare, then claude plugin update ayrshare@ayrshare, and restart Claude Code.
Prerequisites
- Claude Code installed
- An Ayrshare account with an API key — get one at app.ayrshare.com under Settings → API Key or get a 28 day free trial here
Installation
Plugin installation scopes
The plugin scope controls where commands, agents, and skills are available. First register this repo as a marketplace (one time):
claude plugin marketplace add ayrshare/ayrshare-social-media-api-claude-plugin
Then install the ayrshare plugin (plugin@marketplace) at the scope you want:
| Scope | Command | Where it's available |
|---|---|---|
| Global (default) | claude plugin install ayrshare@ayrshare | Every project on this machine |
| This project only | claude plugin install ayrshare@ayrshare --scope local | Current project, not committed to git |
| This project (shared) | claude plugin install ayrshare@ayrshare --scope project | Current project, committed to git with the team |
Whatever scope you install at, the API key and the other settings are saved once per user on this machine and apply in every project where the plugin is enabled. To act as a different client in one project, pass profileKey on the call, or ask the agent to (see Optional Configuration). A project that needs a different Ayrshare account (its own API key) can't get it from the plugin's settings. In that project, disable the plugin (claude plugin disable ayrshare@ayrshare --scope local) and add the server directly with that account's key (claude mcp add ... --scope local, see MCP only). That project then has the raw tools only, without the plugin's skills, agents or confirmation prompt.
After installing, configure your API key inside Claude Code:
/plugin configure ayrshare@ayrshare
The dialog asks for your Ayrshare API key (required) and three optional settings: a Profile-Key and your X Consumer Key and X Consumer Secret (see Optional Configuration). Each value is masked as you type it and kept in your system's secure credential store, not in a settings file or the chat. claude plugin install run from a shell does not show this dialog, so open it from a session afterwards. /ayrshare:setup explains each field. After saving, and after any later change to these settings, run /reload-plugins (or restart Claude Code) so the server reconnects with the new values.
The command needs the plugin's full id. It is ayrshare@ayrshare when you installed from this repository's marketplace, as above, and ayrshare@synced when you added Ayrshare from Claude's plugin directory on claude.ai (which needs Claude Code 2.1.273 or later). claude plugin list shows which one you have.
Upgrading from 0.2.2 or earlier
Earlier versions read your key from the AYRSHARE_API_KEY environment variable (and the optional AYRSHARE_PROFILE_KEY, X_TWITTER_OAUTH1_API_KEY and X_TWITTER_OAUTH1_API_SECRET). Version 0.3.0 no longer reads them, and until you enter the key its tools do not load. After updating, run /plugin configure ayrshare@ayrshare (or /plugin configure ayrshare@synced if you added it from Claude's plugin directory) once, enter the same values, and run /reload-plugins. You can then delete the old variables from wherever you put them: the env block of ~/.claude/settings.json, ./.claude/settings.local.json or ./.claude/settings.json, or your shell profile. If the key was ever in a committed file such as ./.claude/settings.json, it stays in git history, so generate a new key at app.ayrshare.com.
Detailed walkthroughs
Global: available in all your projects
# 1. Register the marketplace (one time)
claude plugin marketplace add ayrshare/ayrshare-social-media-api-claude-plugin
# 2. Install the plugin globally (user is the default scope)
claude plugin install ayrshare@ayrshare
# 3. Enter your API key, then load it. Run inside Claude Code:
/plugin configure ayrshare@ayrshare
/reload-plugins
Commands, agents, and skills are available in every project. No project files are modified.
This project only: local, not committed
# 1. Register the marketplace (one time)
claude plugin marketplace add ayrshare/ayrshare-social-media-api-claude-plugin
# 2. Install scoped to the current project (not committed to git)
claude plugin install ayrshare@ayrshare --scope local
# 3. Enter your API key, then load it. Run inside Claude Code:
/plugin configure ayrshare@ayrshare
/reload-plugins
Commands, agents, and skills only appear in this project.
This project: committed with the team
# 1. Register the marketplace (one time)
claude plugin marketplace add ayrshare/ayrshare-social-media-api-claude-plugin
# 2. Install scoped to the project (committed to git)
claude plugin install ayrshare@ayrshare --scope project
# 3. Each developer enters their own API key, then loads it. Run inside Claude Code:
/plugin configure ayrshare@ayrshare
/reload-plugins
The plugin is committed to the repo so the whole team gets it automatically. The repo holds no key: each developer enters their own, and it stays in that developer's secure credential store.
MCP only (no plugin)
If you only want the raw MCP tools without commands, agents, or skills:
claude mcp add ayrshare --transport http \
https://api.ayrshare.com/mcp \
--header "Authorization: Bearer YOUR_API_KEY"
Add --scope local to limit it to the current project. The key is stored permanently in Claude Code's config — run once and you are done. Unlike the plugin's settings, this keeps the key as plain text in Claude Code's config file, and the command itself can show up in shell history.
Installing without a dialog (CI / headless)
On Claude Code 2.1.285 or later, install the plugin, then pass the values in a JSON file on standard input, so the key never appears on a command line:
claude plugin marketplace add ayrshare/ayrshare-social-media-api-claude-plugin
claude plugin install ayrshare@ayrshare
claude plugin configure ayrshare@ayrshare --values-stdin < values.json
values.json holds a JSON object such as {"api_key": "<your Ayrshare API key>"}. Have your CI system write it from its secret store as a file only the job can read, and delete it once the command has run. Saved values stay in that Claude Code configuration between runs, and sending an empty value does not clear one. On a shared or reused runner, export CLAUDE_CONFIG_DIR as a fresh folder before the commands above, so a Profile-Key saved by an earlier job is never reused; the job then needs its own Claude Code sign-in. When the job ends, run claude plugin uninstall ayrshare@ayrshare, which removes the saved values, then delete the folder.
The keys are api_key, profile_key, x_api_key and x_api_secret; keys you leave out keep their saved values. Older Claude Code versions only take each setting as --config KEY=VALUE on claude plugin install. A value on the command line can show up in shell history and in the process list, so use --config only on a machine nobody else uses.
Credentials by surface
The plugin has one API key setting (api_key, required) and three optional ones (profile_key, x_api_key, x_api_secret). Where you can enter them depends on the surface, and the fully supported surface today is Claude Code:
| Surface | How credentials are supplied | Profile-Key | X BYOK |
|---|---|---|---|
| Claude Code (CLI / IDE / desktop "Code" tab) | The plugin's settings dialog: /plugin configure ayrshare@ayrshare | profile_key setting, or per-call profileKey argument | x_api_key + x_api_secret settings |
| Cowork / claude.ai desktop app | Not supported yet. The skills install, but Cowork does not prompt for plugin settings, so the plugin's MCP server does not load there. Needs OAuth (see Roadmap). | not available yet | not available yet |
| CI / headless | claude plugin configure --values-stdin (2.1.285+), or --config on claude plugin install | profile_key | x_api_key + x_api_secret |
Cowork and the desktop app (not supported yet)
The plugin's skills install in Cowork and the claude.ai desktop app, but its API tools cannot authenticate there yet, so you cannot actually use them. This is a platform limitation, not a setting you can change today:
- Cowork does not prompt for a plugin's settings, and it skips an MCP server that needs a setting with no default. The API key has no default, so the plugin's server does not load in Cowork.
- Adding Ayrshare as a claude.ai / org connector loads the tools but offers no field for an
Authorizationheader, so every call returns403(code 102). - A Claude Code
managed-mcp.json(an admin/enterprise managed-MCP config file; see the managed MCP docs) does not apply to Cowork; it is a Claude Code feature. Deploying one will not help Cowork, and it takes exclusive, machine-wide control of MCP that suppresses this plugin's own server and your other MCP servers in Claude Code. Do not use it for Cowork.
The fix is per-user OAuth on the MCP endpoint (see Roadmap). Until it ships, use the plugin in Claude Code (CLI, IDE, or the desktop Code tab).
Commands
| Command | Description |
|---|---|
/ayrshare:setup | Configure or rotate your API key |
The former /ayrshare:post, /ayrshare:analytics, and /ayrshare:profiles commands were consolidated into the social-manager and profile-manager agents and the trigger-based skills below.
Skills
Trigger-based skills activate automatically on intent (even when you don't name Ayrshare) and teach Claude how to drive the MCP tools correctly: the auth model (API key, plus optional profile selection by Profile-Key header or per-call profileKey argument), retry safety, and platform quirks. They cover 27 of the server's 33 tools. The six ads tools (list_ad_accounts, list_ads, get_ad_history, search_ad_targeting, update_ad, boost_post) do not have a skill yet. Start with getting-started; every group skill cross-links to it.
| Skill | Tools | Use when |
|---|---|---|
getting-started | (cross-cutting) | Installing/configuring the plugin, any 401/403, "which credential do I use", onboarding a client, or a missing API key. Home of the auth model (API key, plus Profile-Key header or per-call profileKey argument), onboarding sequence, retry/explain_error rules, and the free-trial link. |
post | create_post, validate_post, get_post, update_post, retry_post | Validating, posting, scheduling, editing, fetching, or retrying social content. |
history | get_post_history, get_platform_history | Listing posts sent via Ayrshare, or native posts (incl. ones not made via Ayrshare) and finding native Social Post IDs. |
analytics | get_post_analytics, get_post_analytics_by_social_id, get_social_network_analytics | Per-post analytics (by Ayrshare or native Social Post ID) or account/network analytics (followers, reach, impressions). |
comments | get_comments, add_comment, reply_comment | Reading, adding, or replying to comments on a post. |
messages | get_messages, send_message, get_auto_response, set_auto_response | Reading/sending direct messages (Facebook, Instagram, X) or configuring the DM auto-responder. |
profiles | list_profiles, create_profile, generate_jwt_social_linking_url | Creating or listing client profiles (account-level), or minting a client's social-account linking URL for the target profile (set by the profileKey argument or Profile-Key header; Business/Enterprise plan). |
media | validate_media | Checking a media URL is reachable before posting (media is referenced by URL; there is no upload/library/resize tool). |
generate | generate_post, recommend_hashtags | Drafting AI post copy (never publishes) or suggesting hashtags for a keyword (TikTok-sourced; uses the targeted profile's linked TikTok account). |
webhooks | register_webhook, unregister_webhook, list_webhooks | Subscribing to push notifications (e.g. when a scheduled post publishes) instead of polling. |
errors | explain_error | Decoding an Ayrshare error code into a plain-English cause + fix. |
draft-in-brand-voice | (workflow: get_platform_history/get_post_history → get_post_analytics → generate_post → validate_post) | Writing on-brand content by matching a profile's established voice from its post history; drafts only. |
plan-and-schedule-campaign | (workflow: validate_post → create_post per post, with scheduleDate) | Planning and scheduling a multi-post, multi-platform campaign or content calendar, validating each post first. |
The last two are multi-step workflow skills: they orchestrate the tools above rather than adding new ones. Skills and agents refer to tools by their short mcp__ayrshare__<action> name (e.g. mcp__ayrshare__create_post). When the server comes from this plugin, Claude Code names the same tool mcp__plugin_ayrshare_ayrshare__<action>.
Optional Configuration
The API key is the plugin's api_key setting, which the ayrshare server's .mcp.json puts into its Authorization header (Bearer ${user_config.api_key}). Profile scoping has two equivalent inputs: a Profile-Key connection header (the default for every call) or an optional profileKey tool argument on a profile-scoped tool call (the argument wins when both are set; a few utility/AI tools such as generate_post and recommend_hashtags are excluded, see getting-started). The per-call argument lets an agent act as a client it learns at runtime without changing settings or restarting.
The optional Profile-Key and X BYOK headers come from settings that default to empty, so you turn each one on by filling it in with /plugin configure ayrshare@ayrshare and running /reload-plugins. Leave a setting empty and its header goes out empty, which the server treats as not provided. No .mcp.json editing, and nothing to redo after claude plugin update.
Act as a specific client profile (profile_key setting or profileKey argument)
Fill in the Profile-Key setting to default the whole connection to one client; the bundled Profile-Key: ${user_config.profile_key} header carries it. With it empty, calls act on the account's primary profile.
To go back to the primary profile, remove the plugin and add it again. Clearing the field doesn't work: a blank field in the settings dialog keeps the saved value, and so does an empty value sent with --values-stdin. Claude Code deletes saved values only when it removes the plugin's last installed scope, so uninstall it at every scope claude plugin list shows, for example claude plugin uninstall ayrshare@ayrshare --scope project (the default is --scope user). Then install it again at the same scopes and re-enter your API key, plus your X Consumer Key and Secret if you use X. Uninstalling and reinstalling at --scope project edits the project's committed .claude/settings.json; reinstall before you commit, so teammates keep the plugin. For a plugin added from Claude's plugin directory, remove it on claude.ai, add it again, and re-enter your settings. To act as a client for a single call instead, pass profileKey as a tool argument on a profile-scoped call (it takes precedence over the header, no restart needed). The generate_jwt_social_linking_url tool uses the same target-profile value (required for that tool, via either input). You do not pass a private key or domain (the server derives them from your authenticated account), but the account must still have a provisioned social-linking domain (Business/Enterprise); without one the call returns a "No social-linking domain is provisioned for this account" error.
Bring-your-own X/Twitter app (BYOK)
Any X/Twitter call (posting, analytics, messages) requires your own X Developer App (the X BYO-key mandate, effective March 31, 2026). After linking X with your app's credentials, fill in both settings with /plugin configure ayrshare@ayrshare (values are never logged):
- X Consumer Key (
x_api_key): your X app's Consumer Key (also called API Key), from the X Developer Console under OAuth 1.0 Keys; sent as theX-Twitter-OAuth1-Api-Keyheader. - X Consumer Secret (
x_api_secret): your X app's Consumer Secret (also called API Key Secret); sent as theX-Twitter-OAuth1-Api-Secretheader.
These are the only X BYO headers Ayrshare uses: one key pair per Ayrshare account, sent on every X-targeting request (the same pair for all sub-profiles). Ayrshare does not use OAuth 2.0 client credentials here. Set both or neither: with neither set, an X/Twitter request returns error 419 (x_credentials_required); with only one set, it returns error 400.
Supported Platforms
Facebook, Instagram, LinkedIn, X (Twitter), TikTok, YouTube, Pinterest, Reddit, Telegram, Threads, Bluesky, Snapchat, and Google Business Profile — depending on your Ayrshare plan and connected profiles.
Roadmap
- Zero-config per-user auth (MCP OAuth 2.1): our top auth priority. This is the only path that makes Cowork and the claude.ai desktop app first-class surfaces, so it is the next major auth investment for this plugin. We plan to add MCP-spec OAuth 2.1 (PKCE, dynamic client registration, authorization-server and protected-resource metadata) to
api.ayrshare.com/mcp. Once shipped, an org-installed plugin authenticates per user on the first tool call ("Connect to Ayrshare", a dashboard login, a per-user token) on every surface, with no manual key step and no files. Claude Code already supports this flow via/mcpauthenticate, so setup collapses to "install, then click Connect" everywhere. Until it lands, Claude Code is the supported surface (via the plugin's settings dialog), and Cowork and the claude.ai desktop app are not supported, because the plugin's bearer-header MCP server cannot authenticate there.
Privacy
The plugin sends your requests, and the API key and optional settings above, only to the Ayrshare API at https://api.ayrshare.com/mcp. See the Ayrshare privacy policy.
Resources
Related resources

Marketing Skills
PluginMarketing skills for technical marketers and founders: 50 skills covering conversion optimization, copywriting, SEO and AI search, paid ads, email and cold outreach, pricing, customer research and launch strategy, all sharing one product-marketing context.
coreyhaines31/marketingskills63.7k
Marketing Team Skills
PluginMarketing team plugin with 40+ skills for copy and content, SEO and AI search optimization, conversion optimization, email and social, paid ads, growth strategy and competitor analysis, plus Python analysis scripts. Most need no account; a few, like YouTube transcripts, need API keys.
alirezarezvani/claude-skills30.7k
Aaron Marketing Skills
PluginOne plugin with 120 marketing skills across brand story, SEO/GEO, social, email, paid ads, influencers and launches. Paste your own data to get plans and scored audits; it plans but never posts for you. Basics need no API key; just describe your goal with /aaron-marketing:auto.
aaron-he-zhu/aaron-marketing-skills3.2k
Digital Marketing Pro
PluginOpen-source plugin for agencies and brand teams: 163 skills and 24 specialist agents follow a 12-stage strategy flow to produce positioning, growth plans, multichannel campaigns, content, ad copy and reports, with claims and compliance checks before publishing. Multi-brand; uses many tokens.
indranilbanerjee/digital-marketing-pro993
Marketing Skills
SkillMarketing skill collection: 50 skills covering SEO audits, conversion optimization, landing page copy, pricing, paid ads, email and social media, all sharing a common product marketing context. Supports Claude Code, Codex and more.
coreyhaines31/marketingskills63.7k
Postiz
MCPMCP built into the open-source social media scheduler Postiz: agents draft, schedule and publish posts and view analytics across 30+ platforms including X, LinkedIn, Instagram and YouTube. The cloud version uses browser OAuth, no API key (paid after a 7-day trial); self-hosting is free.
gitroomhq/postiz-app42.7k