Created
August 18, 2025 00:04
-
-
Save lethargicpanda/99907e23406c2906791c2e2b3ace7b68 to your computer and use it in GitHub Desktop.
AI Agent using Gemini 2.5 Pro and a custom ADB MCP server
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import asyncio | |
import os | |
from mcp_use import MCPAgent, MCPClient | |
from langchain_anthropic import ChatAnthropic | |
from langchain_openai import ChatOpenAI | |
from langchain_google_genai import ChatGoogleGenerativeAI | |
async def main(): | |
print("hello!") | |
config = { | |
"mcpServers": { | |
"demo": { | |
"command": "/path/to/venv/bin/uv", | |
"args": [ | |
"run", | |
"--with", | |
"mcp[cli]", | |
"mcp", | |
"run", | |
"/path/to/server.py" | |
] | |
} | |
} | |
} | |
client = MCPClient.from_config_file( | |
os.path.join(os.path.dirname(__file__), "android_mcp.json") | |
) | |
agent = MCPAgent( | |
llm = ChatGoogleGenerativeAI(model="gemini-2.5-pro"), | |
client=client | |
) | |
result = await agent.run("Fetch the list of app installed to the android device connected to the laptop and review the list of packagesto check if the Trainline app installed on the device and if it is, open the app") | |
print("--------------------------------") | |
print(result) | |
if __name__ == "__main__": | |
asyncio.run(main()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment