π Android-MCP SDK: The Bridge Between LLMs and the Android App Ecosystem.
Extending the official MCP and using AIDL for transport, this SDK breaks down the isolation between AI agents and native Android applications. Whether you're building an LLM to orchestrate tools or an app to be invoked by AI, this SDK is your essential toolkit.
δΈζηREADME | π Quick Start
Transform Your Android Ecosystem into LLM Superpowers
// Your LLM can now do this across ANY Android app:
val result = mcpApi.callTool(
"com.weather.app/.WeatherService#get_forecast",
buildJsonObject { put("location", JsonPrimitive("Tokyo")) }
)
// And this:
mcpApi.callTool("com.calendar.app/.CalendarService#add_event", eventData)
// And this:
mcpApi.callTool("com.camera.app/.PhotoService#take_picture", cameraSettings)
- π€ AI App Developers: Build LLM assistants that control the entire Android ecosystem
- π± Android Developers: Expose your app's capabilities to the growing AI assistant market
- π’ Enterprise Teams: Create unified AI interfaces for internal Android app suites
- π¬ Researchers: Prototype cross-app AI interactions and automation workflows
Current State: Your LLM is trapped in a single app
- β Cannot access other Android apps' capabilities
- β Each app exists in isolation
- β Limited to built-in functions only
- β No standard way for apps to expose AI-callable functions
With Android MCP SDK: Your LLM becomes a system-wide AI assistant
- β Cross-App Communication: Call functions from any MCP-enabled Android app
- β Automatic Discovery: Find available tools across the entire system
- β Secure by Design: Android-native permission system with flexible policies
- β Production Ready: Built on Android's robust AIDL/Binder IPC architecture
- β Zero App Changes: Existing apps can add MCP support without architectural changes
1. Add Dependency
dependencies {
implementation("com.github.AnswerZhao:android-mcp-sdk:v0.0.1")
implementation("io.modelcontextprotocol:kotlin-sdk:0.6.0")
}
maven { url = uri("https://jitpack.io") }
2. Create Your MCP Service
class WeatherMCPService : MCPService() {
override fun getImplementation() = Implementation("weather-service", "1.0.0")
override fun getServerOptions() = ServerOptions(
capabilities = ServerCapabilities(tools = ServerCapabilities.Tools(listChanged = true))
)
override fun registerTools(server: Server) {
server.addTool(
name = "get_current_weather",
description = "Get current weather for a location"
) { request ->
val location = request.arguments["location"]?.jsonPrimitive?.content
CallToolResult(content = listOf(TextContent("Weather in $location: Sunny, 25Β°C")))
}
}
}
3. Declare in AndroidManifest.xml
<service android:name=".WeatherMCPService" android:exported="true" android:permission="zwdroid.mcp.sdk.permission.ACCESS_MCP_SERVICES">
<intent-filter>
<action android:name="zwdroid.mcp.sdk.TOOLS_SERVICE" />
</intent-filter>
<meta-data android:name="mcp.description" android:value="Weather tools service" />
<meta-data android:name="mcp.tools" android:resource="@raw/mcp_tools" />
</service>
1. Add Dependency
dependencies {
implementation("com.github.AnswerZhao:android-mcp-sdk:v0.0.1")
implementation("io.modelcontextprotocol:kotlin-sdk:0.6.0")
}
maven { url = uri("https://jitpack.io") }
2. Call Tools from Your LLM
val mcpApi = MCPApi.getInstance(context)
// Discover available tools
val tools = mcpApi.getAllAvailableTools()
// Call a specific tool
val result = mcpApi.callTool(
"com.example.weather/.WeatherMCPService#get_current_weather",
buildJsonObject { put("location", JsonPrimitive("San Francisco, CA")) }
)
3. Add Permissions
<uses-permission android:name="zwdroid.mcp.sdk.permission.ACCESS_MCP_SERVICES" />
<queries>
<intent>
<action android:name="zwdroid.mcp.sdk.TOOLS_SERVICE" />
</intent>
</queries>
This repository includes two fully functional demo apps:
- Provides weather tools (
get_current_weather
,get_weather_forecast
) - Demonstrates flexible security policies
- Shows proper tool registration and error handling
- OpenAI GPT integration example
- Real-time tool discovery and calling
- Clean MVVM architecture with Jetpack Compose UI
Try it yourself:
./gradlew :android-mcp-server:installDebug
./gradlew :android-mcp-client:installDebug
Imagine a voice assistant app that can control your entire phone:
π€ "Hey Assistant, what's the weather in San Francisco?"
β
π€ Voice App β calls β π€οΈ Weather App (via MCP) β returns weather data
π€ "Add a meeting for tomorrow at 3 PM"
β
π€ Voice App β calls β π
Calendar App (via MCP) β creates event
π€ "Take a photo and set it as wallpaper"
β
π€ Voice App β calls β πΈ Camera App (via MCP) β captures photo
β calls β π¨ Settings App (via MCP) β sets wallpaper
Before Android MCP SDK: Each app works in isolation With Android MCP SDK: One AI assistant can control all your apps
Built on proven Android technologies:
- Model Context Protocol - Industry standard for LLM-tool communication
- Official MCP Kotlin SDK - We extend this with Android capabilities
- Android AIDL/Binder IPC - System-level, secure cross-process communication
- Android Service Architecture - Standard Android patterns you already know
π€ LLM Application
β (MCPApi)
π± MCPClientManager β Discovers Services
β (AIDL/Binder IPC)
π§ MCPService (Your App) β Exposes Tools
β (Standard MCP)
βοΈ Your App Functions
Key Benefits:
- π 5-minute integration - Add MCP support to existing Android apps
- π Production security - Built-in permission system with 5 security policies
- β‘ High performance - Efficient Binder IPC with async coroutines
- π οΈ Zero dependencies - Apps only need the lightweight SDK
- Security-First: Android-native permission system with flexible access control
- Performance-Optimized: Coroutines-based async operations, efficient resource management
- Developer-Friendly: Intuitive APIs, extensive documentation, working examples
- Production-Ready: Comprehensive error handling, lifecycle management, memory leak prevention
LLM Application β MCPApi β MCPClientManager β MCPClient β BinderClientTransport
β
AIDL/Binder IPC
β
BinderServerTransport β MCPServer β MCPService β Your Implementation
- π Security-First: Configurable permission policies (Open, Permission-based, Signature-based, Whitelist, Custom)
- β‘ Performance-Optimized: Coroutines-based async operations, efficient resource management
- π§© Modular Design: Clean separation between transport, client, server, and common components
- π‘οΈ Production-Ready: Comprehensive error handling, lifecycle management, memory leak prevention
- π― Developer Experience: Intuitive APIs, extensive documentation, working examples
- MCP Kotlin SDK 0.6.0 - Official MCP protocol implementation
- Android AIDL/Binder IPC - Cross-process communication foundation
- Kotlin 2.2.0 with Coroutines for async operations
- Kotlinx Serialization for efficient JSON handling
- π οΈ Development Guide - Internal development instructions
We welcome contributions from the community! Here's how you can get involved:
- Report bugs using our issue template
- Request features or enhancements
- Ask questions about usage or implementation
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature
) - Commit your changes (
git commit -m 'Add amazing feature'
) - Push to the branch (
git push origin feature/amazing-feature
) - Open a Pull Request
- Improve existing documentation
- Add code examples and tutorials
- Translate documentation to other languages
git clone https://github.com/your-username/android-mcp-sdk.git
cd android-mcp-sdk
./gradlew build
This project is licensed under the MIT License - see the LICENSE file for details.
- Model Context Protocol for the excellent protocol specification
- Official MCP Kotlin SDK - This Android SDK extends their foundational work
- Android Team for the robust AIDL/Binder IPC mechanism
Built with β€οΈ for the Android & AI community
Extending the official MCP Kotlin SDK with Android AIDL/Binder support