mcp-server-examples
This project includes examples of Model Context Protocol (MCP) servers, implementing functionalities like BMI calculation and weather information retrieval.
MCP Server Examples
์ด ํ๋ก์ ํธ๋ Model Context Protocol (MCP) ์๋ฒ ์์ ๋ค์ ํฌํจํ๊ณ ์์ต๋๋ค. BMI ๊ณ์ฐ๊ณผ ๋ ์จ ์ ๋ณด ์กฐํ ๊ธฐ๋ฅ์ ์ ๊ณตํ๋ MCP ์๋ฒ๋ฅผ ๊ตฌํํฉ๋๋ค.
ํ๋ก์ ํธ ๊ตฌ์กฐ
mcp-server-examples/
โโโ .venv/ # Python ๊ฐ์ํ๊ฒฝ
โโโ server.py # MCP ์๋ฒ ๊ตฌํ (BMI ๊ณ์ฐ๊ธฐ, ๋ ์จ ์ ๋ณด ์กฐํ)
โโโ config.json # ์๋ฒ ์ค์ ํ์ผ
์ ๊ณตํ๋ ๋๊ตฌ๋ค
-
BMI ๊ณ์ฐ๊ธฐ
- ํค(m)์ ๋ชธ๋ฌด๊ฒ(kg)๋ฅผ ์ ๋ ฅ๋ฐ์ BMI ์ง์๋ฅผ ๊ณ์ฐ
calculate_bmi
๋๊ตฌ ์ฌ์ฉ
-
๋ ์จ ์ ๋ณด ์กฐํ
- ๋์ ์ด๋ฆ์ ์ ๋ ฅ๋ฐ์ ํด๋น ๋์์ ๋ ์จ ์ ๋ณด๋ฅผ ์กฐํ
fetch_weather
๋๊ตฌ ์ฌ์ฉ
ํ๋ก์ ํธ ์ค์ ๋ฐ ์คํ ๋ฐฉ๋ฒ
1. Python ๊ฐ์ํ๊ฒฝ ์์ฑ
# venv ๋ชจ๋์ ์ฌ์ฉํ์ฌ ๊ฐ์ํ๊ฒฝ ์์ฑ
python -m venv .venv
# ๊ฐ์ํ๊ฒฝ ํ์ฑํ
# Windows์ ๊ฒฝ์ฐ:
.venv\Scripts\activate
# macOS/Linux์ ๊ฒฝ์ฐ:
source .venv/bin/activate
2. ํ์ํ ํจํค์ง ์ค์น
# MCP ํจํค์ง ์ค์น (CLI ๋๊ตฌ ํฌํจ)
pip install "mcp[cli]"
# HTTP ํด๋ผ์ด์ธํธ ๋ผ์ด๋ธ๋ฌ๋ฆฌ ์ค์น (๋ ์จ API ํธ์ถ์ฉ)
pip install httpx
3. ์๋ฒ ์คํ
๊ฐ๋ฐ ๋ชจ๋๋ก ์๋ฒ๋ฅผ ์คํํ๊ฑฐ๋ Claude Desktop์ ์ค์นํ ์ ์์ต๋๋ค:
# ๊ฐ๋ฐ ๋ชจ๋๋ก ์๋ฒ ์คํ
mcp dev server.py
# Claude Desktop์ ์๋ฒ ์ค์น
mcp install server.py
์์กด์ฑ ํจํค์ง
mcp
: Model Context Protocol ๊ตฌํ์ ์ํ ํต์ฌ ํจํค์งhttpx
: ๋น๋๊ธฐ HTTP ํด๋ผ์ด์ธํธ ๋ผ์ด๋ธ๋ฌ๋ฆฌ (๋ ์จ API ํธ์ถ์ฉ)
์๋ฒ ์ฌ์ฉ ๋ฐฉ๋ฒ
์๋ฒ๊ฐ ์คํ๋๋ฉด Claude Desktop์์ ๋ค์๊ณผ ๊ฐ์ ๋๊ตฌ๋ค์ ์ฌ์ฉํ ์ ์์ต๋๋ค:
-
BMI ๊ณ์ฐํ๊ธฐ:
- ํค(๋ฏธํฐ)์ ๋ชธ๋ฌด๊ฒ(ํฌ๋ก๊ทธ๋จ)๋ฅผ ์ ๋ ฅํ๋ฉด BMI ์ง์๋ฅผ ๊ณ์ฐํด์ค๋๋ค
- ์: ํค 1.79m, ๋ชธ๋ฌด๊ฒ 80kg โ BMI 25.0
-
๋ ์จ ์ ๋ณด ์กฐํํ๊ธฐ:
- ๋์ ์ด๋ฆ์ ์ ๋ ฅํ๋ฉด ํด๋น ๋์์ ํ์ฌ ๋ ์จ ์ ๋ณด๋ฅผ ์กฐํํฉ๋๋ค
- API๋ฅผ ํตํด ์ค์๊ฐ ๋ ์จ ๋ฐ์ดํฐ๋ฅผ ์ ๊ณตํฉ๋๋ค
Related MCP Servers
View all python servers โmcp-server-template
by narumiruna
The MCP Server Template is a foundational framework designed to facilitate the development and deployment of model context protocol servers, leveraging LLM and MCP technologies.
MCP-Github-Oauth
by Nikhil-Patil-RI
This document provides a guide to setting up a Model Context Protocol (MCP) server environment, specifically for integrating with the Claude desktop app and debugging using the MCP Inspector.
benchmark-proxy-mcp
by zengzhuozhen
The benchmark-proxy is an MCP server designed to facilitate the benchmarking of model context protocols, providing a robust environment for testing and evaluation.
binoculo-mcp
by girorme
BinoculoMCP is a Message Control Protocol (MCP) Server designed to interact with the Binoculo tool for banner-grabbing operations.
mcp-testing
by marhoy
This document provides an overview and usage instructions for a Model Context Protocol (MCP) server, which facilitates communication between models and clients using the MCP technology.