Integrate Android SDK with AI
Offload much of the AppsFlyer Android SDK integration work to AppsFlyer’s SDK MCP server by using an AI-powered coding tool, such as OpenAI Codex, Git Hub Co-Pilot, or Cursor.
Step 1: Get ready
- Your AppsFlyer Dev key
- Your Android app project.
- Your AI-powered coding tool is installed and set up for your project
- Android Studio is installed to sync and run the app
Step 2: Add the AppsFlyer SDK MCP server
To add the AppsFlyer SDK MCP server:
Codex
- In Codex, go to Settings > MCP Servers.
- Click + Add server.
- In the Name box, give your server a name.
- In Command to launch, enter
npx. - In Arguments, enter the following arguments, each in a different field:
-y(to install and update your MCP each run).@appsflyer/sdk-mcp-server(the server name as listed on the NPM registry).
- In the Environment variables, add: the variables
DEV_KEYand APP_ID, and their values. - Restart Codex to load the new MCP server.
- In Codex, open Settings > MCP Servers and confirm that the AppsFlyer SDK MCP server is turned on.
Cursor
-
In Cursor, go to Cursor > Settings… > Cursor settings > Tools & MCP.
-
Click New MCP server.
-
Add a new MCP server entry in mcp.json:
"appsFlyer-sdk-mcp": { "command": "npx", "args": [ "-y", "@appsflyer/sdk-mcp-server" ], "env": { "APP_ID": "com.appsflyer.onelink.appsflyeronelinkbasicapp", "DEV_KEY": "sQ84wpdxRTR4RMCaE9YqS4" } }, -
Restart Cursor to apply the changes.
-
In Cursor, go to Cursor > Settings… > Cursor settings > Tools & MCP.
-
Find the MCP server entry you added.
-
Confirm it’s marked with a green dot. This indicates the MCP server is working.
GitHub Co-pilot
-
In Android Studio, open Settings and go to Tools > GitHub Copilot> Model Context Protocol (MCP).
-
In the Model Context Protocol (MCP) settings, click Configure.
-
In mcp.json, add the AppsFlyer SDK MCP server settings:
"appsFlyer-sdk-mcp": { "command": "npx", "args": [ "-y", "@appsflyer/sdk-mcp-server" ], "env": { "APP_ID": "com.appsflyer.onelink.appsflyeronelinkbasicapp", "DEV_KEY": "sQ84wpdxRTR4RMCaE9YqS4" } }, -
Restart Android Studio to apply the changes.
-
In Android Studio, click
to open the GitHub Copilot Chat. -
At the bottom of the Copilot Chat panel, select Agent from the agents dropdown.
-
Click
(the displayed MCP Tools button). -
In the Configure Tools dialog, for the appsFlyer-sdk-mcp tool, click Start.
-
To confirm that the server is running, in the left sidebar, click
the GitHub Copilot MCP Log button. In the displayed MCP log panel, you should see that the server is running.
Step 3: Prompt the AI to integrate the SDK
- In the chat, type Integrate the AppsFlyer SDK using MCP.
- Review the changes in your codebase in your editor, and verify that the integrated code matches your project requirements and coding standards. If anything looks unfamiliar, ask the AI follow-up questions.
Step 4: Prompt the AI to verify the integration
- Open Android Studio.
- Sync the project.
- Run your app.
- In the chat, prompt to verify the AppsFlyer SDK integration. The AI agent will use the MCP tool to read logs from your device and confirm whether the integration succeeded.
- If errors are detected, the tool will explain what went wrong and suggest fixes.
- If everything looks good, you’ll see confirmation of a successful integration.
Updated 1 day ago