Intro to the Model Context Protocol READY LAYER ONE MATT MCKENNA #DCNY25 Matt McKenna #dcny25
WHOISBEINGASKEDTOUSEMOREAIATWORK?
WHOLIKESIT?
WHATWE’LLCOVERTODAY High level view of LLMs and AI Agents What is the Model Context Protocol Android Device control with AI
TAKEAWAYS Demystify the Model Context Protocol Enable you all to build your own MCP Servers!
WHATISALARGELANGUAGEMODEL(LLM)
- Sequence prediction at a massive scale WHATISALARGELANGUAGEMODEL(LLM)
- Sequence prediction at a massive scale - Trained on broad data, fi ne tuned on task speci fi c patterns WHATISALARGELANGUAGEMODEL(LLM)
- Sequence prediction at a massive scale - Trained on broad data, fi ne tuned on task speci fi c patterns - Interfaces WHATISALARGELANGUAGEMODEL(LLM)
- Sequence prediction at a massive scale - Trained on broad data, fi ne tuned on task speci fi c patterns - Interfaces - Chat - Code Completion - APIs WHATISALARGELANGUAGEMODEL(LLM)
HOWDOESANLLMWORK?
- You give the model some text (this is a prompt) HOWDOESANLLMWORK?
- You give the model some text (this is a prompt) - It tries to predict what comes next a piece at a time HOWDOESANLLMWORK?
- You give the model some text (this is a prompt) - It tries to predict what comes next a piece at a time - It doesn’t “think” or “know”, but follows patterns HOWDOESANLLMWORK?
The android developer
The android developer predict next
The android developer predict next invalidates
The android developer predict next invalidates
The android developer predict next invalidates caches
The android developer predict next caches invalidates
The android developer predict next caches invalidates and
The android developer predict next caches and invalidates
The android developer predict next restarts caches and invalidates
The android developer predict next invalidates caches and restarts
LLMSINACTION
- Let’s do something with the Android Debug Bridge! (ADB) LLMSINACTION
- Let’s do something with the Android Debug Bridge! (ADB) - Hey can you write some adb commands for me to launch the Bluesky android app and input text saying “hey from droidcon new york!” and then post it? LLMSINACTION
HUMAN LLM TASK PROMPT
HUMAN LLM TASK PROMPT
HUMAN LLM TASK RESPONSE
HUMAN LLM TASK RESPONSE
HUMAN LLM TASK ACTION
HUMAN LLM TASK ACTION
HUMAN LLM TASK PROMPT
HUMAN LLM TASK PROMPT
HUMAN LLM TASK RESPONSE
HUMAN LLM TASK RESPONSE
HUMAN LLM TASK ACTION
HUMAN LLM TASK ACTION
IS GREAT THIS
IS GREAT THIS ’NT
WEARESTILLDOINGGRUNTWORK!
ENTERAIAGENTS
WHATISANAIAGENT? A system that uses a language model to complete tasks autonomously or semi-autonomously
WHATISANAIAGENT?
- A language model WHATISANAIAGENT?
- A language model - Tools it can call WHATISANAIAGENT?
- A language model - Tools it can call - A planner to decide on and sequence actions WHATISANAIAGENT?
CODENAMEGOOSE
CLAUDEDESKTOP
GEMINIINANDROIDSTUDIO
AIAGENTSNEEDTOOLS
- Tools are the capabilities of the agent AIAGENTSNEEDTOOLS
- Tools are the capabilities of the agent - Structured input / output AIAGENTSNEEDTOOLS
- Tools are the capabilities of the agent - Structured input / output - Need to describe - What’s available - When to use - How to use AIAGENTSNEEDTOOLS
HOWDOWEMAKETOOLS?
THEMODELCONTEXTPROTOCOL
THEMODELCONTEXTPROTOCOL
- A JSON based protocol for tool description and invocation THEMODELCONTEXTPROTOCOL
- A JSON based protocol for tool description and invocation - Share contextual information with LLMs THEMODELCONTEXTPROTOCOL
- A JSON based protocol for tool description and invocation - Share contextual information with LLMs - Expose tools and capabilities THEMODELCONTEXTPROTOCOL
- A JSON based protocol for tool description and invocation - Share contextual information with LLMs - Expose tools and capabilities - Build composable integrations and work fl ows THEMODELCONTEXTPROTOCOL
- A JSON based protocol for tool description and invocation - Share contextual information with LLMs - Expose tools and capabilities - Build composable integrations and work fl ows - Enables tools to describe themselves THEMODELCONTEXTPROTOCOL
- A JSON based protocol for tool description and invocation - Share contextual information with LLMs - Expose tools and capabilities - Build composable integrations and work fl ows - Enables tools to describe themselves THEMODELCONTEXTPROTOCOL
MCPFEATURES
- Resources - File-like data that can be read by clients MCPFEATURES
- Resources - File-like data that can be read by clients - Prompts - Pre-written templates that help Users accomplish speci fi c tasks MCPFEATURES
- Resources - File-like data that can be read by clients - Prompts - Pre-written templates that help Users accomplish speci fi c tasks - Tools - Functions that can be called by the LLM MCPFEATURES
MCPSERVERS
- Easy to build! MCPSERVERS
- Easy to build! - Expose Resource, Tools, and Prompts via primitives MCPSERVERS
- Easy to build! - Expose Resource, Tools, and Prompts via primitives - Can work with local processes and/or remote services MCPSERVERS
ARCHITECTURE AI AGENT / HOST ADB Weather Calendar Remote Data Source Local Data Source Local Data Source
ARCHITECTURE AI AGENT / HOST ADB MCP Weather MCP Calendar MCP Remote Data Source Local Data Source Local Data Source Mode l Cont ext Proto col
LET’SBUILD!
ADB
ADB Kotlin
fun adb(vararg args: String): String { }
fun adb(vararg args: String): String { val command = listOf("adb") + args }
fun adb(vararg args: String): String { val command = listOf("adb") + args val process = Runtime.getRuntime().exec(command.toTypedArray()) }
fun adb(vararg args: String): String { val command = listOf("adb") + args val process = Runtime.getRuntime().exec(command.toTypedArray()) return process.inputStream.bu ff eredReader().readText() }
ADB Kotlin
ADB Kotlin MCP
ADB Kotlin MCP ADB Kotlin Interface
ADB Kotlin MCP ADB Kotlin Interface
SERVERSETUP
fun main(args: Array<String>) { val command = args. fi rstOrNull() ?: "--sse-server-ktor" val port = args.getOrNull(1)?.toIntOrNull() ?: 3001 when (command) { "--stdio" -> runMcpServerUsingStdio() "--sse-server-ktor" -> runSseMcpServerUsingKtorPlugin(port) "--sse-server" -> runSseMcpServerWithPlainCon fi guration(port) else -> { System.err.println("Unknown command: $command") } } }
fun runSseMcpServerUsingKtorPlugin(port: Int): Unit = runBlocking { println("Starting sse server on port $port") println("Use inspector to connect to the http://localhost:$port/sse") embeddedServer(CIO, host = "0.0.0.0", port = port) { MCP { return@MCP con fi gureServer() } }.start(wait = true) }
fun con fi gureServer(): Server { val def = CompletableDeferred<Unit>() val server = Server( Implementation( name = "mcp-server-android", version = "0.1.0" ), ServerOptions( capabilities = ServerCapabilities( prompts = ServerCapabilities.Prompts(listChanged = true), resources = ServerCapabilities.Resources(subscribe = true, listChanged = true), tools = ServerCapabilities.Tools(listChanged = true), ) ), onCloseCallback = { def.complete(Unit) } ) //...
fun con fi gureServer(): Server { //... // Create AdbManager instance val deviceManager = AdbManager() //...
fun con fi gureServer(): Server { //... // Create AdbManager instance val deviceManager = AdbManager() // Create AndroidToolsRegistry instance and register all tools val toolsRegistry = AndroidToolsRegistry(deviceManager) toolsRegistry.registerTools(server) //...
fun con fi gureServer(): Server { //... // Add Android device control prompt server.addPrompt( name = "Android Device Control", description = "Control and interact with Android devices through MCP.", arguments = listOf() ) { _ -> // prompt of all tools } return server }
LETSCODE!
TIPSFORDESIGNINGMCPSERVERS
- Start with work fl ows, not raw endpoints DESIGNTOOLSFROMWORKFLOWS
- Start with work fl ows, not raw endpoints - Combine steps into a single high level Tool DESIGNTOOLSFROMWORKFLOWS
- Tool names and params ARE prompts PROMPTFRIENDLYTOOLDESIGN
- Tool names and params ARE prompts - Better Tool descriptions mean better tool use PROMPTFRIENDLYTOOLDESIGN
- LLMs context is limited PROTECTTHECONTEXTWINDOW
- LLMs context is limited - Running out of context window is costly PROTECTTHECONTEXTWINDOW
- LLMs context is limited - Running out of context window is costly - MCPs can help PROTECTTHECONTEXTWINDOW
MORERESOURCES
- Join the community on Bluesky BLUESKY go.bsky.app/Etd57t6
- Kotlin Multiplatform implementation of MCP MCPKOTLINSDK MODEL CONTEXT PROTOCOL github.com/modelcontextprotocol/kotlin-sdk
- A local, open source AI agent, automating engineering tasks seamlessly. GOOSE AI AGENT BY BLOCK block.github.io/goose/
- Best practices and learnings for designing MCP Servers DESIGNINGMCPSERVERS BLOCK’S PLAYBOOK FOR engineering.block.xyz/blog/blocks-playbook-for-designing-mcp-servers
- bsky.app/pro fi le/ botteaap.bsky.social/post/ 3lsezmlhco22j DRUMMCP HUGO VISSER
- Enable Android apps to provide MCP server access to AI tools in development environments ANDROID-MCP-SDK JASON PEARSON’S github.com/kaeawc/android-mcp-sdk
- Introducing Trailblaze, a natural language AI driven test framework. AIMOBILETESTING - BLAZINGTHETRAILATBLOCK SAM EDWARDS + BRIAN GARDNER STAGE 2 Catch the VOD
THANKYOU
Q/A

Ready Layer One: Intro to the Model Context Protocol