
dataworkshop/simple-mcp-server
Developer tools이 페이지는 AI로 자동 번역되었습니다. 기술적인 세부 사항은 원문을 확인하세요. 원문 보기
간단한 MCP 서버 - 교육 예 이 저장소에는 최소 MCP(Model Context Protocol) 서버가 포함되어 있습니다.
개요
간단한 모델 Context Protocol (MCP) 서버는 3개의 유틸리티 도구를 갖춘 FastMCP로 구축되었습니다. 1. - 무작위 UUID (버전 4 또는 1) 2. 생성 - Celsius와 Fahrenheit 사이 온도를 변환합니다. - 기본 텍스트 통계 (문자, 단어, 줄)를 계산합니다. MCP 서버를 HTTP 수송으로 시작하십시오: 서버는 기본적으로 http://localhost:8000/mcp에서 시작합니다. 순수한 httpx 클라이언트를 실행 (MCP 라이브러리 필요): 컬과 jq를 사용하여 bash 스크립트를 실행: - 컬 (HTTP 요청에 대한) - jq (Jack parsing 용) - 표준 유닉스 도구 (grep, sed, awk, tr) - server.py - 3개의 유틸리티 도구와 MCP 서버 - client fastmcp.py - FastMCP 라이브러리를 사용하여 클라이언트 - client httpx.py - 직접 HTTP 요청만을 사용하는 클라이언트 - client curl.sh - 컬과 jq를 사용하여 Bash 스크립트 클라이언트 - main.py - 원본 템플릿 파일 (사용되지 않음)
개요(AI 번역)
간단한 모델 Context Protocol (MCP) 서버는 3개의 유틸리티 도구를 갖춘 FastMCP로 구축되었습니다.
도구
- generate uuid - 랜덤 UUID 생성 (버전 4 또는 1)
- convert temperature - 섭씨와 화씨 사이 온도 변환
- text statistics - 기본 텍스트 통계 (문자, 단어, 줄)
설치
uv를 사용하여 의존성을 설치하십시오:
사용법
서버 실행
MCP 서버를 HTTP 수송으로 시작하십시오:
서버는 기본적으로 http://localhost:8000/mcp에서 시작합니다.
FastMCP 클라이언트 테스트
FastMCP 기반 클라이언트를 실행:
httpx 클라이언트와 테스트
순수한 httpx 클라이언트를 실행 (MCP 라이브러리 필요):
컬 클라이언트와 테스트
컬과 jq를 사용하여 bash 스크립트를 실행:
** 컬 클라이언트에 대한 요구 사항 : **
curl(HTTP 요청)jq( JSON 파싱용)- 표준 유닉스 도구 ([T3]],
sed,awk,tr)
프로젝트 구조
server.py- 3개의 유틸리티 도구로 MCP 서버client_fastmcp.py- FastMCP 라이브러리를 사용하여 클라이언트client_httpx.py- 직접 HTTP 요청을 위해 HTTPx만 사용하는 클라이언트client_curl.sh- 컬과 jq를 사용하여 Bash 스크립트 클라이언트- `메인.
이 페이지는 AI로 자동 번역되었습니다. 기술적인 세부 사항은 원문을 확인하세요.
README
Simple MCP Server
A simple Model Context Protocol (MCP) server built with FastMCP, featuring three utility tools.
Tools
- generate_uuid - Generates a random UUID (version 4 or 1)
- convert_temperature - Converts temperature between Celsius and Fahrenheit
- text_statistics - Calculates basic text statistics (characters, words, lines)
Installation
Install dependencies using uv:
uv sync
Usage
Running the Server
Start the MCP server with HTTP transport:
uv run server.py
The server will start on http://localhost:8000/mcp by default.
Testing with FastMCP Client
Run the FastMCP-based client:
uv run client_fastmcp.py
Testing with httpx Client
Run the pure httpx client (no MCP libraries required):
uv run client_httpx.py
Testing with curl Client
Run the bash script using only curl and jq:
./client_curl.sh
Requirements for curl client:
curl(for HTTP requests)jq(for JSON parsing)- Standard Unix tools (
grep,sed,awk,tr)
Project Structure
server.py- MCP server with three utility toolsclient_fastmcp.py- Client using FastMCP libraryclient_httpx.py- Client using only httpx for direct HTTP requestsclient_curl.sh- Bash script client using curl and jqmain.py- Original template file (not used)
Example Output
All three clients will:
- Connect to the server
- List available tools
- Test generate_uuid (generates a UUID v4)
- Test convert_temperature (converts 0°C to Fahrenheit → 32.0°F)
- Test text_statistics (counts characters, words, and lines in sample text)
Example:
Test 1: Generate UUID
Result: 98f99e94-7357-4dd4-85eb-76819fad3ada
Test 2: Convert temperature (0°C to Fahrenheit)
Result: 32.0
Test 3: Text statistics
Result: {"characters":47,"words":9,"lines":3}
Technical Details
- Transport: Streamable HTTP (MCP protocol over HTTP)
- Endpoint:
/mcp - Response Format: Server-Sent Events (SSE)
- Session Management: Server assigns session ID via
Mcp-Session-Idheader
Client Implementations
-
FastMCP Client (
client_fastmcp.py):- Uses official MCP Python SDK
- Handles SSE automatically
- Full protocol support
-
httpx Client (
client_httpx.py):- Pure Python with only httpx dependency
- Manual JSON-RPC implementation
- Custom SSE parsing
-
curl Client (
client_curl.sh):- Bash script using curl and jq
- Demonstrates raw HTTP requests
- No Python dependencies required
Requirements
- Python 3.13+
- fastmcp
- httpx (included as fastmcp dependency)
설치
This server does not publish a one-line install command.
Open the repository installation guide MCP 초보자라면? mcpskill.org 가이드부터 시작하세요 →