Skip to main content
Glama
jhj0517

MCP Python Tutorial

by jhj0517

MCP 파이썬 튜토리얼

대장간 배지 모의 데이터가 포함된 간단한 로컬 DB를 갖춘 Python의 MCP용 튜토리얼 앱

설치 및 실행

Smithery를 통해 설치

Smithery를 통해 Claude Desktop용 Python MCP 튜토리얼 서버를 자동으로 설치하려면:

지엑스피1

수동 설치

  1. 이 저장소를 복제하세요

  2. 종속성 설치:

pip install -r requirements.txt
  1. MCP 서버를 개발 모드로 실행:

mcp dev localdb_app.py
  1. MCP 서버의 기본 포트는 5173 입니다. http://localhost:5173 에 접속하세요.

Related MCP server: xmcp Demo Application

MCP 기능

이 튜토리얼 앱은 핵심 MCP 개념을 보여줍니다. tutorial_app/mcp_server.py 에서 역할별 주석(annotation-per-role)을 확인할 수 있습니다.

@mcp.resource

기본적으로 이 주석은 RESTAPI의 GET 과 마찬가지로 에이전트가 리소스를 "가져오는" 것에 대한 것입니다.

  • users://all - 모든 사용자 가져오기

  • users://{user_id}/profile - 사용자 프로필 가져오기

  • posts://all - 모든 게시물 가져오기

  • posts://{post_id} - ID로 게시물 가져오기

@mcp.tool

이는 RESTAPI의 POST 와 마찬가지로 에이전트가 새 리소스를 "생성"하는 것과 관련이 있습니다.

  • create_user - 새로운 사용자 생성

  • create_post - 새 게시물 만들기

  • search_posts - 제목이나 내용으로 게시물 검색

@mcp.prompt

이는 LLM과 편리하게 상호작용하기 위한 재사용 가능한 템플릿입니다.

  • user_profile_analysis - 사용자 프로필 분석 생성

  • post_feedback - 게시물 피드백을 위한 대화형 프롬프트

[!NOTE] 추가 주석은 https://github.com/modelcontextprotocol/python-sdk?tab=readme-ov-file#core-concepts 에서 확인하세요.

클라이언트에 연결

MCP 서버를 설정한 후에는 MCP 서버를 사용하여 에이전트를 구축할 LLM 클라이언트가 필요합니다. 다음 가이드는 Claude Desktop을 클라이언트로 연결하는 데 도움이 됩니다.

  1. Claude Desktop은 uv 사용하여 MCP 서버 종속성을 설치합니다. 먼저 uv 설치하세요.

powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"
  1. uv 사용하여 MCP 서버 종속성을 설치합니다.

# Create virtual environment and activate it
uv venv
.venv\Scripts\activate

uv pip install -r requirements.txt
  1. Claude Desktop 다운로드:

  1. claude_desktop_config.json 파일을 찾거나 만드세요. 위치는 OS마다 다릅니다.

  • 윈도우:

C:\Users\%USER%\AppData\Roaming\Claude\claude_desktop_config.json
  • MacOS/리눅스:

~/Library/Application\ Support/Claude/claude_desktop_config.json
  1. claude_desktop_config.jsonmcpServers 속성을 추가합니다.

{
    "mcpServers": {
        "local_db": {
            "command": "uv",
            "args": [
                "--directory",
                "/ABSOLUTE/PATH/TO/PARENT/FOLDER/weather",
                "run",
                "localdb_app.py"
            ]
        }
    }
}

참고: 각기 다른 관심사와 전문 지식을 가진 여러 MCP 서버를 배포할 수 있습니다. 이렇게 관심사를 분리하는 것이 단일 MCP 서버에 모든 것을 구현하는 것보다 낫습니다.

  1. Claude Desktop을 다시 시작합니다.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections. Dates show when Glama detected each change.

No tool schema history has been recorded yet.

Maintenance

ActivityInactive
ResponsivenessNo issues

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Connectors

Related MCP Servers

  • A
    license
    Not graded
    quality
    D
    maintenance
    A minimal demonstration server showcasing MCP protocol capabilities including tools, resources, and prompts with basic examples like hello world functionality.
    2
    MIT
  • F
    license
    Not graded
    quality
    D
    maintenance
    A demonstration MCP server showcasing the xmcp framework's structured approach to defining tools, prompts, and resources with automatic discovery from their respective directories.
    -
  • F
    license
    Not graded
    quality
    D
    maintenance
    A Python-based MCP server demonstrating tools for math calculations, time retrieval, and echo messages, along with resources and prompt templates.
    -

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/jhj0517/mcp-python-tutorial'

If you have feedback or need assistance with the MCP directory API, please join our Discord server