Python 从0到1构建MCP Server & Client
@GobinFan
About Python 从0到1构建MCP Server & Client
支持查询主流agent框架技术文档的MCP server(支持stdio和sse两种传输协议), 支持 langchain、llama-index、autogen、agno、openai-agents-sdk、mcp-doc、camel-ai 和 crew-ai
Config
Add this server to your MCP-compatible client using the configuration below.
{
"mcpServers": {
"python-mcp-server-client": {
"command": "uv",
"args": [
"init",
"mcp-server"
]
}
}
}Tools
No tools detected
We auto-extract tools from the README. The maintainer can list them under a ## Tools heading to populate this section.
Overview
What is Python 从0到1构建MCP Server & Client?
A hands-on tutorial and reference implementation for building Model Context Protocol (MCP) servers and clients in Python from scratch. It demonstrates how to expose a documentation-search tool through both local (Stdio) and remote (SSE) transports, and how to connect that server to MCP clients like Cursor, Cline, or a custom Python client.
How to use Python 从0到1构建MCP Server & Client?
Install UV, create a project directory, install dependencies (mcp[cli], httpx), and write a main.py file that defines the MCP server with the get_docs tool. Run the server locally with uv run main.py for Stdio, or uv run main.py --host 0.0.0.0 --port 8020 for SSE. Configure clients (Cline, Cursor) by adding a JSON block pointing uv --directory <path> run main.py to the MCP server definition.
Key features of Python 从0到1构建MCP Server & Client
- Implements both Stdio (local) and SSE (remote) transport protocols
- Provides a
get_docstool that searches and retrieves documentation for eight popular AI libraries - Uses the Serper API for Google search and BeautifulSoup for web page parsing
- Includes ready-to-use client configurations for Cursor and Cline
- Ships a complete custom Python MCP client using the OpenAI SDK
- Requires only the
mcpCLI package,httpx, andBeautifulSoupas dependencies
Use cases of Python 从0到1构建MCP Server & Client
- Quickly look up the latest LangChain, LlamaIndex, or CrewAI documentation from an AI assistant
- Build a local MCP server that agents (Claude, Cursor) can query for up-to-date framework docs
- Learn how to migrate from Function Call to MCP for tool calling across different LLM providers
- Deploy a cloud-hosted SSE-based MCP server that multiple remote clients can connect to
FAQ from Python 从0到1构建MCP Server & Client
What problem does this MCP server solve compared to traditional Function Call?
Before MCP, different LLM providers had inconsistent Function Call formats and each API tool required its own input/output wrapping. MCP acts as a universal "USB-C", standardizing function call formats across providers and unifying tool packaging.
What dependencies and runtime are required?
Python, the uv package manager, and the mcp[cli], httpx, and BeautifulSoup Python packages. A Serper API key must be set in the SERPER_API_KEY environment variable.
Which AI framework documentation sources are supported?
LangChain, LlamaIndex, AutoGen, Agno, OpenAI Agents SDK, MCP documentation, CAMEL-AI, and CrewAI.
What transport protocols are available?
Stdio for local use (requires CLI installation) and SSE (Server-Sent Events) for cloud deployment over HTTP long connections.
How do I configure the server with Cursor or Cline?
Create a .cursor/mcp.json file (Cursor) or configure the Cline plugin settings with the JSON: {"mcpServers": {"mcp-server": {"command": "uv", "args": ["--directory", "<path>", "run", "main.py"]}}}.
Frequently asked questions
What problem does this MCP server solve compared to traditional Function Call?
Before MCP, different LLM providers had inconsistent Function Call formats and each API tool required its own input/output wrapping. MCP acts as a universal "USB-C", standardizing function call formats across providers and unifying tool packaging.
What dependencies and runtime are required?
Python, the `uv` package manager, and the `mcp[cli]`, `httpx`, and `BeautifulSoup` Python packages. A Serper API key must be set in the `SERPER_API_KEY` environment variable.
Which AI framework documentation sources are supported?
LangChain, LlamaIndex, AutoGen, Agno, OpenAI Agents SDK, MCP documentation, CAMEL-AI, and CrewAI.
What transport protocols are available?
Stdio for local use (requires CLI installation) and SSE (Server-Sent Events) for cloud deployment over HTTP long connections.
How do I configure the server with Cursor or Cline?
Create a `.cursor/mcp.json` file (Cursor) or configure the Cline plugin settings with the JSON: `{"mcpServers": {"mcp-server": {"command": "uv", "args": ["--directory", "<path>", "run", "main.py"]}}}`.
Basic information
More AI & Agents MCP servers
21st.dev Magic AI Agent
21st-devIt's like v0 but in your Cursor/WindSurf/Cline. 21st dev Magic MCP server for working with your frontend like Magic
1MCP - One MCP Server for All
1mcp-appA unified Model Context Protocol server implementation that aggregates multiple MCP servers into one.

Competitor Tracker & Co.
Competitor Tracker & Co.Competitor Tracker & Co. watches your competitors' websites and tells you what changed. Every week it crawls their pricing, product, messaging and corporate pages, detects the changes that matter, and files a tagged, ran

Lumify Sports Intelligence
LumifyReal-time sports schedules, live scores, odds, betting splits, and AI bet intelligence for agents via MCP.
mcp-hfspace MCP Server 🤗
evalstateMCP Server to Use HuggingFace spaces, easy configuration and Claude Desktop mode.
Comments