Log inStart Free Trial
easyCoexistence Official APIs

Give a Claude API app Instagram, Facebook, TikTok and WhatsApp tools with the MCP connector

A Claude API app gets Instagram, Facebook, TikTok and WhatsApp tools by passing easyCoexistence's MCP server, https://easycoexistence.com/api/mcp, in mcp_servers with an OAuth access token and adding a matching mcp_toolset to tools, under the mcp-client-2025-11-20 beta header. Claude then publishes, schedules, replies to comments and DMs and reads insights through each network's official API, with no Meta app review or TikTok audit on your side.

mcp-client-2025-11-20

The beta header the Messages API needs for mcp_servers and mcp_toolset; the earlier mcp-client-2025-04-04 version is deprecated.

Tool calls only

What the MCP connector supports of the MCP specification; the server must be public over Streamable HTTP or SSE.

authorization_token

The field that carries the OAuth access token; Anthropic expects your app to obtain it and refresh it as needed.

S256

The PKCE method easyCoexistence's authorization server accepts, beside dynamic client registration at /api/oauth/register.

1 hour

Life of an easyCoexistence MCP access token; the 60-day refresh token returns a new refresh token with each new access token.

Not ZDR

The MCP connector sits outside zero data retention; tool definitions and results follow Anthropic's standard retention policy.

external_ref

Your customer's id on a Partner API connect session, returned on the channel, on its events and as a filter on each list.

How do you add easyCoexistence to a Claude API request?

With two entries in the same Messages API call, on the beta endpoint. mcp_servers describes the server: type url, the address https://easycoexistence.com/api/mcp, a name you choose and the OAuth access token in authorization_token. tools then needs an mcp_toolset whose mcp_server_name repeats that name; a server in mcp_servers without its toolset is a validation error. Send the mcp-client-2025-11-20 beta, which the Python SDK takes as betas on client.beta.messages.create.

Anthropic connects to the server and runs each tool call itself, so your code holds no MCP client and no loop for these tools. The response carries an mcp_tool_use block for each call, with the tool's name and input, and an mcp_tool_result block with what easyCoexistence returned, beside Claude's text. The tool list follows the networks available to your easyCoexistence account, and each call takes an account_id from list_social_accounts, so a request that names the account lets Claude pick the right one.

A Messages API call with easyCoexistence's MCP server
import os
import anthropic

client = anthropic.Anthropic()

response = client.beta.messages.create(
    model="claude-opus-5-5",
    max_tokens=16000,
    betas=["mcp-client-2025-11-20"],
    system=(
        "You run Harbor Coffee's social accounts. Call list_social_accounts first. "
        "TikTok replies are public; Instagram DMs go only to people who wrote in the last 24 hours."
    ),
    mcp_servers=[
        {
            "type": "url",
            "url": "https://easycoexistence.com/api/mcp",
            "name": "easycoexistence",
            "authorization_token": os.environ["EC_MCP_ACCESS_TOKEN"],  # OAuth, valid for 1 hour
        }
    ],
    tools=[{"type": "mcp_toolset", "mcp_server_name": "easycoexistence"}],
    messages=[{"role": "user", "content": "Reply to the new questions under our latest Instagram Reel."}],
)

for block in response.content:
    if block.type == "mcp_tool_use":
        print("tool:", block.name, block.input)
    elif block.type == "text":
        print(block.text)

How does your app get the OAuth access token and keep it fresh?

Your app runs easyCoexistence's sign-in once, then refreshes on its own. Anthropic's connector does not sign in for you: it sends whatever authorization_token the request carries. easyCoexistence's MCP endpoint takes only OAuth 2.1 access tokens from its own authorization server, which publishes its endpoints at /.well-known/oauth-authorization-server and supports dynamic client registration and PKCE with S256. An ec_live_ API key gets a 401 there; it belongs to the REST API.

The usual path for a backend: register your app as a client, send the account owner through the authorization URL once, exchange the code for tokens and keep the refresh token in a secret store. An access token lasts 1 hour and a refresh token 60 days, and each refresh returns a new refresh token, so save the new one every time. A password change, a reset or "log out of all other devices" on easyCoexistence ends the connection, and the owner signs in again. For a quick test, the MCP Inspector (npx @modelcontextprotocol/inspector) runs its Quick OAuth Flow against the server and shows an access token to paste.

Discovery, then a refresh before each hour runs out
# Where to register, authorize and trade codes for tokens
curl https://easycoexistence.com/.well-known/oauth-authorization-server

# A new access token and a new refresh token: store both
curl -X POST https://easycoexistence.com/api/oauth/token \
  -d grant_type=refresh_token \
  -d refresh_token="$EC_REFRESH_TOKEN"

{ "access_token": "…", "token_type": "Bearer", "expires_in": 3600, "refresh_token": "…", "scope": "mcp" }

How do you limit which easyCoexistence tools Claude can call?

With the toolset's default_config and configs. Set default_config.enabled to false and switch on, by name, only the tools the request needs: an allowlist. Or leave the tools on and set enabled to false on the ones to block, a denylist, which Anthropic suggests for write tools in a read-only assistant. Names in configs are the bare tool names, without the server's name, and a name the account does not see is logged as a warning rather than refused.

The allowlist below suits a reporting assistant: it reads accounts, posts, comments, insights and the posts queue, and cannot publish, reply or send a DM. For a support desk, add reply_to_comment and send_social_dm; for publishing, add publish_instagram_post, publish_facebook_post and publish_tiktok_post, each of which takes scheduled_at for a time 1 minute to 90 days ahead. easyCoexistence's server has more than 30 tools, so when the full set stays on, defer_loading, which keeps a tool's description out of the first prompt, pairs with Anthropic's tool search tool.

A read-only toolset: reports, no publishing or replies
tools = [
    {
        "type": "mcp_toolset",
        "mcp_server_name": "easycoexistence",
        "default_config": {"enabled": False},
        "configs": {
            "list_social_accounts": {"enabled": True},
            "list_social_posts": {"enabled": True},
            "list_social_comments": {"enabled": True},
            "get_social_insights": {"enabled": True},
            "list_scheduled_posts": {"enabled": True},
        },
    }
]

What if your customers connect their own Instagram, Facebook or TikTok accounts?

Then the accounts come in through easyCoexistence's Partner API, and tenancy stays in your code. Your backend creates a session with POST /connect-sessions, naming the channel and your customer's id as external_ref; the customer signs in with Instagram, Facebook or TikTok on a hosted page, phones included, and returns to your redirect_url with a channel_id. They need no easyCoexistence account, email or card, and the connection belongs to your account.

One MCP sign-in reaches each channel on that account, customers' channels included, and a toolset filters tools, not accounts. So in a product where each customer talks to Claude, give Claude tools of your own that call the REST API with your ec_live_ key and the channel_id your code looked up for the signed-in customer, such as a post tool on POST /channels/{id}/posts. Keep the MCP connector for accounts you operate yourself, such as your brand or an agency's clients, and for internal tools.

MCP connectorYour own tools on the REST API
CredentialOAuth access token, refreshed each hourOne ec_live_ key on your backend
ReachEach channel on the easyCoexistence accountThe channel_id your code passes
Who runs the callAnthropic, on easyCoexistence's MCP serverYour backend, after Claude returns tool_use
FitsYour own accounts, an agency's clients, internal toolsA SaaS where each customer has their own accounts

How does a new comment or DM reach your Claude app?

Through your own endpoint, because a Messages API call runs only when your code makes it. Two routes exist on each Instagram, Facebook or TikTok channel. The webhook relay, PUT /channels/{id}/webhook, POSTs comments, mentions and DMs to your URL as they arrive, with TikTok reporting its comments within about 5 minutes, signed per account with X-EC-Signature. Answer 2xx at once and process from a queue, since relayed events are passed on once, without a stored copy or retries.

To answer with Claude, an automation's call_webhook step is shorter. easyCoexistence POSTs the event, signed, with the chat's recent messages for a DM; your endpoint calls the Messages API; and a JSON reply returned within 20 seconds goes out as a DM, the comment's private reply, or a public TikTok reply cut to 150 characters. The platforms' windows still apply: a DM reply within 24 hours of the person's last message, and one private reply per comment within 7 days.

1Comment or DMOn Instagram, Facebook or TikTok
2call_webhook stepPOSTs the event, signed with X-EC-Signature
3Your endpointCalls the Messages API
4{"reply": "..."}Returned within 20 seconds
5easyCoexistence sends itDM, private reply or public TikTok reply

How to set it up

  1. Connect the accountsIn easyCoexistence, choose New connection and sign in with Instagram, Facebook or TikTok, or let customers connect through the Partner API's hosted sessions.
  2. Get an access tokenRun easyCoexistence's OAuth sign-in from your app, or the MCP Inspector's Quick OAuth Flow for a test, and store the refresh token.
  3. Add the server and its toolsetPass easyCoexistence in mcp_servers with authorization_token, add an mcp_toolset with the same name to tools, and send the mcp-client-2025-11-20 beta.
  4. Refresh and runRefresh the access token before each hour ends, and log the mcp_tool_use and mcp_tool_result blocks to see what Claude did.

Common mistakes

  • Listing easyCoexistence in mcp_servers without an mcp_toolset of the same name in tools. The Messages API rejects the request, since each server must be referenced by exactly one toolset.
  • Putting an ec_live_ API key in authorization_token. easyCoexistence's MCP endpoint accepts OAuth access tokens only and answers 401; the key is for the REST API.
  • Keeping the first refresh token instead of the newest. Each refresh returns one with a fresh 60 days; reuse only the first, and the app must sign in again 60 days after the original sign-in.
  • Asking Claude to publish a file that sits on your server. The publishing tools fetch media from a public HTTPS link, so upload the file first and pass its URL.
Doing this with EasyCoexistence

easyCoexistence gives apps on the Claude API reach to Instagram, Facebook, TikTok and WhatsApp: one MCP server with more than 30 tools for the MCP connector, a REST API for tools of your own and a Partner API for your customers' accounts, on a Meta Tech Provider app and its own TikTok app, with each connection monitored. New networks join the same API at the same price per connection. US$ 9 to US$ 0.75 per connection a month, falling as you add connections, with the first 3 days free.

easyCoexistence is a multichannel API and MCP server that connects AI agents such as Claude and ChatGPT to WhatsApp, Instagram, TikTok, Facebook, Google Business Profile and more. On WhatsApp it uses Coexistence: the business keeps using its number in the WhatsApp Business app while the AI works through Meta's official API.

Frequently asked questions

Can the MCP connector use an easyCoexistence API key instead of OAuth?

No. The MCP endpoint accepts only OAuth access tokens and answers 401 to an ec_live_ key. Use the key when Claude calls tools you define on top of easyCoexistence's REST API.

Can a Claude API app read Instagram and Facebook insights?

Yes, through the get_social_insights tool, which reads metrics such as reach, views and engagement for the account or one post. The REST API has no insights endpoint for Instagram or Facebook, so a backend reads them over MCP; TikTok metrics come from the same tool.

Does the MCP connector work on Amazon Bedrock or Vertex AI?

Anthropic lists the MCP connector in beta on the Claude API, Claude Platform on AWS, Claude Models on Google Cloud (Anthropic managed) and Microsoft Foundry. Elsewhere, run an MCP client in your own code, or call easyCoexistence's REST API from tools you define.

How much does easyCoexistence cost for a Claude API app?

A flat fee per connected account, US$ 9 down to US$ 0.75 a month as your total grows, the same on each network, with nothing charged per tool call. Anthropic bills the model usage, and the first 3 days are free.

Keep reading

Connect your first channel in two minutes.

No platform reviews to wait for. Connect WhatsApp, Instagram, TikTok or another channel, then ask your AI to post, reply or report, and watch it work.

  • 3 days free
  • Cancel any time
  • Official APIs only
  • Monitored 24/7

Verified on