How to integrate Metaads MCP with Kimi Code

Connect Kimi Code to Metaads MCP. Get ad performance insights for last week, create a new campaign for summer sale, and more using natural language, with authentication handled for you.

Metaads logoMetaads
Oauth2Api Key

Metaads is Meta's official Ads API that lets you manage, analyze, and optimize your Facebook and Instagram ad campaigns. Streamline ad operations and gain deeper insights with robust automation.

99 Tools

How to integrate Metaads MCP with Kimi Code

Kimi Code is Moonshot AI's open-source coding agent, powered by Kimi K2.6. It runs in your terminal, reads and edits code, executes shell commands, and plans multi-step tasks, with native MCP support for extending it to outside tools.

In this guide, I will explain the easiest and most secure way to connect your Metaads account to Kimi Code via Composio Connect, so it can get ad performance insights for last week, create a new campaign for summer sale, pause all ads in underperforming campaigns, and more without ever putting your account credentials at risk.

For exact tool slugs and parameter tables, see the tool catalog in the Composio docs.

Also integrate Metaads with

Why use Composio?

Composio provides:

  • Access to 1,700+ managed apps from a single MCP endpoint. This makes it convenient for agents to run cross-app workflows.
  • Managed OAuth. You do not have to worry about authentication and authorization flows for every app.
  • Programmatic tool calling. Allows LLMs to write code in a remote workbench to handle complex tool chaining. This reduces back-and-forth for frequent tool calls.
  • Large tool response handling outside the LLM context. This minimizes context bloat from large tool responses.
  • Dynamic just-in-time access to thousands of tools across hundreds of apps. Composio loads the tools your agent needs, so LLMs are not overwhelmed by tools they do not need.

Connect Metaads to Kimi Code

Kimi Code is a TypeScript agent distributed through npm. It acts as an MCP client and reads server definitions from an mcp.json file, and it can also add and authenticate servers conversationally through /mcp-config. Composio is a remote HTTP server that authenticates with OAuth, so no API key is stored anywhere.

1. Install Kimi Code

The quickest way is the official install script, which requires no pre-installed Node.js and places the kimi executable on your PATH.

bash
# macOS or Linux
curl -fsSL https://code.kimi.com/kimi-code/install.sh | bash

# Windows PowerShell
irm https://code.kimi.com/kimi-code/install.ps1 | iex

# Confirm the installation
kimi --version

2. Log in

Start Kimi Code in your project directory, then sign in from the interactive UI:

bash
kimi

Run /login and choose Kimi Code OAuth using the device-code flow, or use a Moonshot API key.

3. Add Composio with /mcp-config

In current versions of Kimi Code, MCP servers are managed inside the app, not with a shell subcommand. From the interactive UI, run:

bash
/mcp-config
Kimi Code MCP config flow for adding the Composio MCP server

Tell it the server name and URL in plain language. For example:

Server name is Composio, and here is the server URL: https://connect.composio.dev/mcp

Kimi Code asks whether to add it globally, at ~/.kimi-code/mcp.json, or project-local for the current checkout, then writes the entry for you:

bash
{
  "mcpServers": {
    "Composio": {
      "url": "https://connect.composio.dev/mcp"
    }
  }
}

There is no transport field to set. Kimi Code infers HTTP from the url.

4. Restart the session

The new server is picked up on a fresh session, not the current one. Start a new session:

bash
/new

On the new session, Kimi Code detects that the server needs authorization and prompts you to run:

bash
/mcp-config login Composio

5. Authorize with OAuth

Run the command Kimi suggests:

bash
/mcp-config login composio

Kimi Code opens Composio's authorization page or surfaces a URL. Approve access, then return to the session. You should see confirmation that the Composio MCP server is connected.

Composio authorization page for Kimi Code MCP setup

Check the connection status any time with /mcp. Composio should appear as connected with its tools listed.

Kimi Code showing Composio connected after OAuth authorization

Connect your Metaads account

Back in a Kimi Code session, ask the agent to connect to Metaads or give it any Metaads-related task.

For example, ask it to:

  • "Get ad performance insights for last week"
  • "Create a new campaign for summer sale"
  • "Pause all ads in underperforming campaigns"

It will prompt you to authenticate and authorize access to Metaads.

That is it. Composio tools are now available in Kimi Code, and your Metaads account is ready to use.

Conclusion

You have successfully connected Metaads to Kimi Code using Composio Connect. Your agent can now manage Metaads from the terminal with natural language, without exposing credentials in prompts or local scripts.

Since the same Composio endpoint exposes 1,700+ apps, you can add Slack, Calendar, Linear, and more to the same server and chain them into cross-app workflows.

TOOLS

Supported Tools

Every Metaads action and event your agent gets out of the box.

Copy Ad Object

Copy a Meta Campaign, Ad Set, or Ad while explicitly selecting its resource type and supported copy options.

Create Ad

Create a new ad within an ad set using the Meta Marketing API, with image, video, or carousel creative content.

Create Ad Creative

Create a new ad creative using the Meta Marketing API.

Create Ad Set

Create a new ad set within a campaign using the Meta Marketing API.

Create Ad Study

Create a Meta A/B test or other ad study under a business, including its cells and tested ad entities.

Create Ad Video

Upload an ad video asset; Meta may keep processing it after returning its ID.

Create Campaign

Create a new advertising campaign using the Meta Marketing API.

Create Catalog Product Set

Create a persistent product set in a Meta product catalog and return its ID.

Create Custom Audience

Create a new custom audience using the Meta Marketing API.

Create Custom Conversion

Create a persistent custom-conversion definition in a Meta ad account and return its ID.

Create Lead Form

Create a persistent lead-generation form owned by a Facebook Page and return its ID.

Create Test Lead

Submit a disposable test lead to an existing Meta lead-generation form for delivery verification.

Delete Ad Object

Delete an Ad Set, Ad, or Ad Creative by ID; the supplied object type is not verified, so the ID determines the object targeted.

Delete Campaign

Delete an advertising campaign using the Meta Marketing API.

Estimate Ad Delivery

Estimate monthly audience delivery for targeting and optimization settings in a Meta ad account.

Estimate Targeting Reach

Estimate the audience-size range for a Meta ad account and structured targeting specification containing at least one country.

Generate Ad Previews

Render previews for a provider-native creative specification in a Meta ad account and return the generated HTML bodies.

Get Ad Accounts

Retrieve one page of directly assigned ad accounts for the authenticated user, including account IDs, names, and other requested account details.

Get Ad Creative

Get Ad Creative

Get Ad Preview

Render a placement-specific preview for an existing Meta Ad or Ad Creative.

Get Ad Study

Get one Meta ad study by ID, including projected cells and timing.

Get Catalog Event Stats

Read one page of product-match event statistics for a Meta product catalog.

Get Current Meta App

Return selected metadata for the Meta application associated with the connected access token.

Get Insights

Get insights data for a Meta Ads object (ad account, campaign, ad set, or ad) using the Meta Marketing API.

Get Multiple Meta Objects

Retrieve selected fields for up to 50 distinct Meta Marketing API objects.

Get Meta Object

Retrieve data for a Meta Marketing API object by numeric ID, an act_-prefixed numeric ID, or me.

Get Page Accounts

Retrieve pages managed by the authenticated user, including page access tokens when requested.

Get Pixel Event Stats

Read recent Pixel event-count and processing statistics, optionally restricted to server events and one event name, to verify aggregate ingestion.

Get User

Tool to retrieve information about the authenticated user from Meta (Facebook) Graph API.

List Activities

List activity history for a Meta ad account or ad set.

List Ad Account Pixels

List the Pixels and consolidated datasets associated with an ad account so a usable data-source ID can be selected for Conversions API events.

List Ad Account Recommendations

Return one page of Meta recommendations for an advertising account.

List Ad Creatives

List one page of ad creatives under a Meta Ads account to view or analyze creative assets.

List Ad Images

List one page of image assets in a Meta ad account, optionally restricted to exact image hashes.

List Ad Network Analytics

Tool to retrieve ad network analytics for a Meta Business using the Meta Marketing API.

List Ad Network Analytics Results

Tool to retrieve ad network analytics results for Facebook Audience Network.

List Ad Rule History

Return one page of historical changes and executions for a Meta Automated Rule.

List Ads

List a page of ads under a Meta ad account, with optional selection of returned fields.

List Ad Studies

List one page of A/B tests and other ad studies owned by a Meta business, including projected cells.

List Ad Videos

List one page of video assets in a Meta ad account, optionally filtered by title, dimensions, duration, or aspect ratio.

List Agencies

Tool to retrieve agencies associated with a Meta Business or Ad Account.

List Assigned Pages

Tool to retrieve Facebook Pages assigned to a business user via Meta Marketing API.

List Assigned Users

Tool to list users assigned to a Facebook Page or Ad Account within a specific business context.

List Business Ad Accounts

Retrieve a page of ad accounts owned by a specific Business Manager, including account IDs, names, and status.

List Businesses

List a page of Business Managers accessible to the authenticated Meta principal via /me/businesses.

List Business Invoices

Tool to retrieve business invoices from Meta Marketing API.

List Business Users

List active human users associated with a Meta Business Manager.

List Campaigns

List one page of campaigns belonging to a Meta ad account.

List Catalog Product Feeds

Return one page of product feeds configured for a Meta product catalog.

List Catalog Products

Return one filtered page of products from a Meta product catalog.

List Catalog Product Sets

Return one filtered page of product sets from a Meta product catalog.

List Client Ad Accounts

List one page of client ad accounts shared with a Meta Business Manager.

List Client Apps

Tool to retrieve client apps associated with a Meta Business using the Marketing API.

List Client Instagram Assets

Tool to retrieve Instagram assets that are shared with a business as a client using the Meta Marketing API.

List Client Offsite Signal Container Business Objects

Retrieve one page of client offsite signal container business objects for a business using the Meta Marketing API.

List Client Pages

Tool to retrieve client pages associated with a Meta business.

List Clients

Tool to retrieve client businesses associated with a Meta Business Manager.

List Collaborative Ads Collaboration Requests

Tool to retrieve collaborative ads collaboration requests for a Meta Business using the Marketing API.

List Collaborative Ads Suggested Partners

Tool to retrieve collaborative ads suggested partners for a business from Meta Marketing API.

List Comments

Return one page from the comments edge of a Page-owned post, photo, video, comment, or reply.

List Custom Audiences

List one page of custom audiences in a Meta ad account, with field projection and optional business, primary-audience, or Pixel constraints.

List Custom Conversions

List one page of custom-conversion definitions in a Meta ad account, with field projection and opaque cursor pagination.

List Initiated Audience Sharing Requests

Tool to retrieve initiated audience sharing requests for a business using the Meta Marketing API.

List Leads

List one page of leads belonging to a Meta Ad or Leadgen Form.

List Managed Partner Ads Funding Source Details

Tool to retrieve managed partner ads funding source details for a Meta Business.

List Owned Apps

Tool to retrieve apps owned by a business from Meta Marketing API.

List Owned Businesses

Tool to retrieve businesses owned by a parent Business Manager from Meta Marketing API.

List Owned Instagram Assets

Tool to list Instagram accounts/assets owned by a Meta Business.

List Owned Offsite Signal Container Business Objects

Retrieve one page of owned offsite signal container business objects associated with a specific business ID from the Meta Marketing API.

List Owned Pages

Retrieve a page of Facebook Pages owned by a Business Manager from the Meta Marketing API.

List Owned Product Catalogs

Return one page of product catalogs owned by a Meta Business Manager.

List Pending Client Ad Accounts

Tool to retrieve pending client ad account access requests for a Business Manager from Meta Ads.

List Pending Client Apps

Tool to retrieve pending client apps for a Meta Business.

List Pending Client Pages

Tool to retrieve pending client pages for a Business Manager using the Meta Marketing API.

List Pending Shared Offsite Signal Container Business Objects

Tool to retrieve pending shared offsite signal container business objects from Meta Marketing API.

List Pending Owned Ad Accounts

Tool to retrieve pending owned ad accounts for a Business Manager account from Meta Marketing API.

List Pending Owned Pages

Tool to retrieve Pages with pending ownership status for a Business Manager from Meta Marketing API.

List Pending Users

Tool to retrieve pending users from a Business Manager in Meta Marketing API.

List Promotable Pages

Return one page of Facebook Pages available for promotion from a Meta ad account.

List Received Audience Sharing Requests

Retrieve a page of received audience sharing requests for a business using the Meta Marketing API.

List Subscribed Apps

List one page of applications subscribed to a Meta ad account.

List System Users

List one page of system users associated with a Meta Business Manager account, with pagination information when returned.

List Targeting Search

Tool to search for targeting options in Meta Ads Marketing API.

List Targeting Suggestions

Return Meta targeting options related to a provider-native seed targeting list for an ad account.

List User Permissions

Inspect permission names and grant statuses for the connected Meta user, optionally filtered by permission or status.

List Video Tags

Return one page of TaggableSubject entries from a Video's `/tags` edge.

List Video Thumbnails

List one page of available thumbnail variants for a Meta video.

Read Ad Sets

Retrieve ad sets from a Meta ad account using the Marketing API.

Rename Ad Object

Rename an existing Meta campaign, ad set, ad, or ad creative.

Send Conversion Events

Irreversibly submit 1-1,000 validated server conversion events to a Meta Pixel or dataset.

Set Ad Object Status

Set an Ad, Ad Set, or Campaign to ACTIVE or PAUSED, or destructively ARCHIVE or DELETE it.

Start Async Insights Report

Start an asynchronous Meta Ads Insights report for an ad account, campaign, ad set, or ad and return its report-run ID.

Submit Catalog Item Batch

Submit an asynchronous batch of catalog item create, update, or delete mutations and return its processing handles.

Update Ad Creative

Update the name or status of an ad creative by ID.

Update Ad Set Targeting

Replace the targeting specification of an existing Meta Ad Set.

Update Ad Study

Update mutable Meta ad-study settings, including replacing its study cells.

Update Campaign

Update an existing advertising campaign using the Meta Marketing API.

Upload Ad Image

Upload an image for use in Meta ad creatives using the Marketing API.

Upsert Catalog Product

Create one Meta catalog product, or explicitly allow updating an item with the same retailer ID, and return its ID.

FAQ

Frequently asked questions

Start with Metaads.It takes 30 seconds.

Managed auth, hosted MCP servers, and every Metaads tool your agent needs.Free to start.

Start building