mcp-server

by zusdn90

273 downloads
Not rated
GitHub

About

mcp-server is a Python-based MCP (Model Context Protocol) server example that provides two simple tools: BMI calculation and weather retrieval. It demonstrates how to build an MCP server using the fastmcp library.

Details

Author
zusdn90
Downloads
273
Categories
Other

- BMI calculator from weight and height
- Weather lookup by city name
- Built with Python and fastmcp
- Uses httpx for async HTTP requests
- Demonstrates MCP tool definition and execution

Setting up with Highlight

This MCP is not yet compatible with Highlight’s one-click setup. However, you can still use it with Highlight by following these steps:

  1. Download and install Highlight from highlightai.com/download
  2. Navigate to the plugins tab and select "Add Custom Plugin"
  3. Configure the plugin with the settings below
    Plugin Name mcp-server
    Command (node, npx, python, etc.)

    Please refer to the README for specific instructions on how to obtain API keys or other required environment variables.

  4. Enable "Start Automatically" if you want the plugin to start when Highlight launches

From the repository

Install dependencies (pip install httpx fastmcp), then run the server with python server.py. The server exposes two tools: calculate_bmi (takes weight in kg and height in m, returns BMI) and fetch_weather (takes a city name, returns current weather via a mock API endpoint).

Claude Desktop / Cursor

Paste into your MCP client config file to install this server.

{
    "mcpServers": {
        "mcp-server": {
            "mcp-server-zusdn90": {
                "command": "python",
                "args": [
                    "server.py"
                ]
            }
        }
    }
}

McpServers

{
    "mcp-server-zusdn90": {
        "command": "python",
        "args": [
            "server.py"
        ]
    }
}

mcp-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

실행 방법

1. 의존성 설치

   pip install httpx fastmcp

2. 서버 실행
   python server.py

No reviews yet — be the first

Sign in to leave a review

Use Google, GitHub, or an email account so ratings stay tied to real people.

Email sign in

No reviews posted yet.