mcp-server
Provides instructions and code to set up an MCP server using FastMCP, enabling tool creation for LLM interaction, with an example project for extracting product information from Amazon links.
README
MCP-Server
This repo includes instruction and code to set up a MCP (Model Context Protocol) Server and add tools to it and interact with it with an LLM (Large Language Model).
Intro about MCP
The Model Context Protocol (MCP) is a new, standardized way to provide context and tools to your LLMs. In this repo, we will use FastMCP which makes building MCP servers and clients simple and intuitive.
FastMCP 2.0 is the #1 github trending repo, with over 10k stars and 600 forks as of May 2025.
Create tools, expose resources, define prompts, and more with clean, Pythonic code:
from fastmcp import FastMCP
mcp = FastMCP("Demo 🚀")
@mcp.tool()
def add(a: int, b: int) -> int:
"""Add two numbers"""
return a + b
if __name__ == "__main__":
mcp.run()
What is MCP?
The Model Context Protocol lets you build servers that expose data and functionality to LLM applications in a secure, standardized way. It is often described as “the USB-C port for AI”, providing a uniform way to connect LLMs to resources they can use. It may be easier to think of it as an API, but specifically designed for LLM interactions.
MCP servers can:
- Expose data through Resources (think of these sort of like GET endpoints; they are used to load information into the LLM’s context)
- Provide functionality through Tools (sort of like POST endpoints; they are used to execute code or otherwise produce a side effect)
- Define interaction patterns through Prompts (reusable templates for LLM interactions)
- And more!
There is a low-level Python SDK available for implementing the protocol directly, but FastMCP aims to make that easier by providing a high-level, Pythonic interface.
Why FastMCP?
The MCP protocol is powerful but implementing it involves a lot of boilerplate - server setup, protocol handlers, content types, error management. FastMCP handles all the complex protocol details and server management, so you can focus on building great tools. It’s designed to be high-level and Pythonic; in most cases, decorating a function is all you need.
While the core server concepts of FastMCP 1.0 laid the groundwork and were contributed to the official MCP SDK, FastMCP 2.0 (this project) is the actively developed successor, adding significant enhancements and entirely new capabilities like a powerful client library, server proxying, composition patterns, and much more.
FastMCP aims to be:
🚀 Fast: High-level interface means less code and faster development
🍀 Simple: Build MCP servers with minimal boilerplate
🐍 Pythonic: Feels natural to Python developers
🔍 Complete: FastMCP aims to provide a full implementation of the core MCP specification
Set up
We uv which, a rust package management tool, much faster than pip.
If you don't have it already, install it:
curl -LsSf https://astral.sh/uv/install.sh | sh
The advantages of uv over Pipenv/Pipfile include:
- Faster dependency resolution and installation times.
- Better integration with modern Python ecosystems like Poetry.
- Reduced overhead in virtual environment management.
- Enhanced security when resolving environment variables, though this also introduces new considerations (discussed later).
You may need to update your $PATH to reflex where uv gets installed.
Example for MacOS: /Users/<user>/.local/bin/
You can update your .bash_profile as follow:
# Setting PATH for uv
PATH="/Users/<user>/.local/bin/:${PATH}"
export PATH
Create a virtual environment
To create a default virtual env that will go in .venv, run:
uv venv
Activate your environment
source .venv/bin/activate
Install the dependencies
uv add fastmcp==2.4.0 --frozen
Verify the version
fastmcp version
You should see something like that:
FastMCP version: 2.4.0
MCP version: 1.9.1
Python version: 3.11.9
Platform: macOS-15.4.1-x86_64-i386-64bit
FastMCP root path: /Users/Fab/Git/mcp-server/.venv/lib/python3.11/site-packages
Projects
MCP Server for extracting info from a Web Page from Amazon
This project demonstrates how to use FastMCP to build a simple MCP server and client with AI-assisted tool orchestration. The workflow operates as follows:
- The user sends a message like "Fetch product info from this Amazon link."
- The MCP client checks for a registered tool that can handle that task
- The client sends a structured request to the MCP server
- The MCP server executes the appropriate action (e.g., launching a headless browser)
- The server returns structured results to the MCP client
- The client forwards the results to the LLM, which presents them to the user
Features
This server offer two tools:
fetch_page: to download HTMLextract_info: extract organized information.
For more info see readme
Quickstart - FastMCP Server and Tools
See Quickstart - creating an server and tool
FastMCP Server
To Learn about the core FastMCP server class and how to run it, refer to: FastMCP server
FastMCP Client
To Learn about the core FastMCP server class and how to run it, refer to: FastMCP client
Usage
uv run main.py
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。