Add STDIO Tool to AI Agent
Quick Start
1
Create a client file
Create a new file
calculator_client.py with the following code:The command string is shell-split, so a multi-word string can be combined with
args=[...] — MCP("npx -y @modelcontextprotocol/server-filesystem", args=["/tmp"]) appends the extra args after the tokens from the string. All three forms in Passing runtime arguments produce the same subprocess.2
Set Up STDIO MCP Server
Create a file
calculator_server.py with the following code:3
Install Dependencies
Make sure you have the required packages installed:
4
Export API Key
5
Run the Agent
Run the agent which will automatically start the calculator server:
Requirements
- Python 3.10 or higher
- MCP package
Alternative LLM Integrations
Using Groq with STDIO
Using Ollama with STDIO
Gradio UI Integration
Create a Gradio UI for your calculator service:Features
Simple Integration
Use standard input/output for easy integration with any tool or service.
Cross-Platform
Works on any operating system that supports Python.
Multiple LLM Options
Use with OpenAI, Groq, Ollama, or other supported LLMs.
Gradio UI
Create user-friendly interfaces for your STDIO integrations.

