About mcp-server
mcp-server is a Python MCP server example for developers. It exposes BMI calculation and current-weather lookup by city as tools.
Key features
- 01BMI calculation from weight and height
- 02Current weather lookup by city
Use cases
- 01Calculate BMI from metric measurements
- 02Retrieve current weather for a city
MCP support
It exposes BMI calculation and city weather lookup as tools for MCP clients.
Configuration
Local server config is the same for every client. Copy it into your client’s MCP config file.
We haven’t collected a package or remote endpoint for this server. Follow the instructions in the project README.
Tools
Local servers expose tools only once running on your machine, and the maintainer has not provided a tool list.
Details
From the project READMEmcp-server
Python 기반 MCP 서버 예제
주요 기능
- BMI 계산: 체중(kg)과 키(m)를 입력받아 BMI(체질량지수)를 계산합니다.
- 날씨 조회: 도시명을 입력받아 해당 도시의 현재 날씨 정보를 조회합니다.
사용 예시
1. BMI 계산
@mcp.tool()
def calculate_bmi(weight_kg: float, height_m: float) -> float:
""" Calculate the BMI given weight in kg and height in meters"""
return weight_kg / (height_m ** 2)
2. 날씨 조회
@mcp.tool()
async def fetch_weather(city: str) -> str:
""" Fetch current weather for a city"""
async with httpx.AsyncClient() as client:
response = await client.get(f"https://api.weather.com/{city}")
return response.text
실행 방법
- 의존성 설치
pip install httpx fastmcp - 서버 실행
python server.py
Comments
New to MCP?
From what the protocol is to installing your first server, these answers cover most first questions.
An open protocol that defines how AI applications connect to external tools and data in a uniform way. Clients talk to the model; MCP servers provide tools, resources and prompt templates. They exchange standard messages, so one server can be reused by many clients.