A practical guide to agent development based on mcphost

Written by
Clara Bennett
Updated on:July-12th-2025
Recommendation

Using the lightweight CLI tool mcphost, you can easily develop MCP Server agents.

Core content:
1. Features and advantages of the lightweight CLI tool mcphost
2. MCP Server configuration and basic usage based on mcphost
3. Practical example: using mcp-go SDK to crawl specific URLs and parse content

Yang Fangxian
Founder of 53AI/Most Valuable Expert of Tencent Cloud (TVP)
During the development and debugging of MCP Server, in addition to the graphical tool MCP Host, I recommend using the lightweight CLI tool mcphost (project address: mark3labs/mcphost ).
This zero-dependency tool, which is only 5MB, supports the three major model platforms of Anthropic, Ollama, and OpenAI, providing developers with flexible choices.
Configuration and basic usage
For example, I use Alibaba's Qianwen model here, and the command is roughly as follows:
export  OPENAI_API_KEY=xxxxx.  # Set the Qianwen API keyexport  OPENAI_URL= 'https://dashscope.aliyuncs.com/compatible-mode/v1'
mcphost \    --openai-url  $OPENAI_URL  \    --model openai:qwen-max \    --config ./mcp.json
When the program starts, you can see output similar to
Practical case analysis

The MCP Server built by mark3labs/mcp-go SDK implements specific URL crawling and content parsing, and finally formats the output. The specific steps are as follows:


1. Tool definition: Create a Python execution tool description, the main contents of the description are:
Execute Python code in an isolated environment. Can be used for web scraping with Playwright and headless browsers. Use this tool when you need real-time information, don't have it in-house, and no other tool can provide it. Since all output is returned only via stdout or stderr, be sure to use print statements! Note that all code is run in a temporary container, so modules and code are not preserved!
2. Execution process:
  • Receive Python code and dependency list generated by large model
  • Execute code in a separate Docker environment
  • Capture stdout/stderr and return the result

3. Operation effect
  • Question 1:  Get the latest 10 Go open source projects with > 50 stars

  • Additional question 2:  Describe the first project in detail

As you can see from the above two tasks, the system automatically triggers the python-executor tool and completes the corresponding URL crawling and content output in turn.


Well, our sample program has been completed. You can see that using mcphost can quickly integrate the existing mcp server, which greatly reduces the difficulty of developing smart cli programs.