How to Build an AI Assistant in Termux With Python
You can build a simple AI assistant directly from your Android phone using Termux and Python. You do not need a computer or a complicated development setup. With a Python script, an AI API, and a few packages, you can create an assistant that accepts your questions and returns AI-generated responses from the terminal. In this guide, we will build a simple version from scratch and run it inside…
Build a Runnable MCP Loop in Python (stdio → streamable-http → LLM tool choice)
The tutorial demonstrates building a Runnable MCP (Microservice Coordination Protocol) loop in Python, using stdio as the transport mechanism. The guide emphasizes the importance of establishing a reliable discover → bind → call → feedback loop before deciding on the LLM (Large Language Model) that will be used.
The environment for this tutorial requires Python 3.13.5 or higher, with a preference for uv or pip installation. The author uses the mcp package, which provides FastMCP v1, with the community FastMCP having moved to v2. It recommends trying both versions while learning.
The tutorial begins with a minimal FastMCP server example that supports prompts, resources, and tools using stdio transport. The code includes type hints, return types, and docstrings, which serve as the model-facing tool descriptions later.
Step 1 focuses on creating a minimal FastMCP server with stdio transport. It defines a greet_user function that greets a user with a specified style, a greeting_resource function that returns a simple greeting, a get_config function that returns static configuration data, an async get_date function that returns the current date, and an async get_weather function that returns weather information for a given city. The server is run with stdio transport using the mcp.run() function.
Step 2 introduces the StdioClient with ClientSession. The client launches the server as a subprocess via StdioServerParameters, specifying the command, args, and cwd. The run() function creates an async connection using stdio_client and ClientSession, initializes the session, lists available prompts and tools, reads a resource, and calls a tool (add) with arguments.
Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.
This story
This is one outlet's version. Read the fullest account.
