Skip to main content
Glama
mcp-server-demo

mcp-server-demo

MCP 서버 데모 (Python)

두 가지 도구를 갖춘 처음부터 만드는 로컬 MCP 서버:

  • weather(city) → wttr.in을 통한 현재 날씨

  • query_db(sql) → 읽기 전용 SQLite SELECT 쿼리

1) 설정

python -m venv .venv
source .venv/bin/activate
pip install -U pip
pip install -e .

Related MCP server: Swiss Meteo MCP

2) MCP 서버 실행

mcp-server-demo

이 명령은 로컬 서버를 시작하고 샘플 행이 포함된 demo.db를 자동으로 생성합니다.

3) 빠른 수동 MCP 확인 (선택 사항)

MCP Inspector가 설치되어 있는 경우:

npx @modelcontextprotocol/inspector

그런 다음 로컬 Python 서버에 연결합니다.

4) OpenAI API 통합 옵션

  1. env 파일을 복사하고 키를 입력합니다:

cp .env.example .env
  1. 한 터미널에서 서버를 시작합니다.

  2. 두 번째 터미널에서 다음을 실행합니다:

python client_openai_api.py

참고: 이 작업은 http://localhost:8000/mcp를 가리키는 MCP 도구 정의와 함께 OpenAI Responses API를 사용합니다.

도구 동작

weather(city: str)

온도, 체감 온도, 습도, 바람, 간단한 상태를 포함한 JSON 요약 필드를 반환합니다.

query_db(sql: str)

  • SELECT ... 쿼리만 허용합니다.

  • 행을 JSON으로 반환합니다.

  • 이 시작 데모에서는 안전을 위해 SELECT가 아닌 SQL은 거부합니다.

프로젝트 파일

  • server.py — FastMCP 서버 + 도구 정의.

  • client_openai_api.py — MCP 도구를 호출할 수 있는 간단한 OpenAI API 호출.

  • pyproject.toml — 종속성 + 스크립트 진입점.

Available Tools

10 tools
analyze_image_with_openaiC

Analyze an image file with an OpenAI vision-capable model.

Inputs: path (required), prompt (required), model. Returns: result

inspect_fileC

Return file metadata and content preview for text/csv/image workflows.

Inputs: path (required), preview_chars, include_base64. Returns: result

list_directoriesC

List directories directly inside a folder within MCP_FILE_OPS_ROOT.

Inputs: path. Returns: result

list_filesB

List files directly inside a folder within MCP_FILE_OPS_ROOT.

Inputs: path. Returns: result

make_directoryC

Create a directory inside MCP_FILE_OPS_ROOT.

Inputs: path (required). Returns: result

move_fileC

Move a file from source_path to destination_path inside MCP_FILE_OPS_ROOT.

Inputs: source_path (required), destination_path (required). Returns: result

move_files_by_globC

Move all files matching a glob pattern from source_dir into destination_dir.

Inputs: source_dir (required), pattern (required), destination_dir (required). Returns: result

query_dbA

Run a read-only SELECT query against local SQLite demo.db.

Inputs: sql (required). Returns: result

read_fileC

Read a UTF-8 text file inside MCP_FILE_OPS_ROOT.

Inputs: path (required). Returns: result

weatherB

Return current weather for a city using wttr.in.

Inputs: city (required). Returns: result

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    C2.9/5.0

    Scored across 10 tools

    Disambiguation4/5

    Most tools have distinct purposes, but there is some overlap between inspect_file and read_file (both provide file content), and move_file vs move_files_by_glob are similar in name and action.

    Naming Consistency4/5

    Majority follow verb_noun pattern with underscores, but 'weather' is a lone noun and 'analyze_image_with_openai' is verbose and breaks the pattern.

    Tool Count4/5

    10 tools is a reasonable number, but the server covers multiple unrelated domains (files, DB, weather, image), making it feel a bit scattered.

    Completeness2/5

    File operations lack delete/copy, DB only has read-only query, weather and image analysis are single-tool services. The surface is incomplete for any single domain.

    Related MCP Connectors

    Related MCP Servers

    • F
      license
      C
      quality
      D
      maintenance
      An experimental MCP server that provides weather information tools, including temperature lookup via wttr.io, along with note-taking capabilities for learning MCP server development with GitHub Copilot.
      3
      -
    • F
      license
      Not graded
      quality
      D
      maintenance
      A demo MCP server that provides AI assistants access to live US weather data via the free National Weather Service API, offering forecast and alert tools without requiring an API key.
      -
    • F
      license
      Not graded
      quality
      D
      maintenance
      A lightweight MCP server providing tools for adding integers, getting current time, and fetching weather forecasts via wttr.in.
      -