MCP Server Basic Example

by ugundhar

Integrations

  • Provides integration for VS Code users to authenticate and connect to the MCP server through GitHub login.

MCP 서버 기본 예제

이는 도구와 리소스를 포함한 핵심 기능을 보여주는 MCP(모델 컨텍스트 프로토콜) 서버 구현의 기본적인 예입니다.

설정 단계

  1. 프로젝트를 초기화합니다(로컬 폴더로 이동하여 PowerShell이나 cmd를 실행합니다):

지엑스피1

  1. 가상 환경을 생성하고 활성화하세요

uv venv .venv\Scripts\activate
  1. 종속성 설치:
uv add "mcp[cli]"

또는

uv add -r requirements.txt

특징

서버는 다음과 같은 기능을 구현합니다.

도구

  • add(a: int, b: int) : 두 숫자를 더합니다.
  • subtract(a: int, b: int) : 첫 번째 숫자에서 두 번째 숫자를 뺍니다.

자원

  • greeting://{name} : 개인화된 인사말을 반환합니다.

서버 실행

개발을 위해 MCP Inspector로 서버를 실행하려면:

uv run mcp dev main.py

서버를 정상적으로 실행하려면:

uv run mcp run

Claude 데스크톱 앱에 서버를 설치하려면:

uv run mcp install main.py

VS 코드에서 MCP 연결

  • vs 코드에서 폴더/mcp-server-basic 열기
  • 터미널을 열고 아래 명령을 실행하세요.
uv run main.py
  • vs 코드에서 채팅을 시작하려면 Cntrl+Shift+I를 클릭하세요.
  • Github에 로그인하고 설정하세요
  • 아래 단계를 따르세요(VS 코드 사용자 설정에 MCP 구성을 추가하는 두 가지 방법):

#mcp에서 안녕하세요

-
security - not tested
F
license - not found
-
quality - not tested

간단한 산술 도구와 인사말 리소스를 통해 핵심 기능을 보여주는 모델 컨텍스트 프로토콜 서버의 샘플 구현입니다.

  1. Setup Steps
    1. Create virtual environment and activate it
      1. Features
      2. Running the Server
      3. MCP connect in VS code

    Related MCP Servers

    • A
      security
      F
      license
      A
      quality
      A server that provides tools for performing basic arithmetic operations (addition, subtraction, multiplication, division) via the Model Context Protocol.
      Last updated -
      4
      JavaScript
      • Apple
    • A
      security
      A
      license
      A
      quality
      A Model Context Protocol server providing utility tools for development and testing, offering functionalities like personalized greetings, random card drawing, and datetime formatting with an extensible architecture.
      Last updated -
      19
      355
      2
      TypeScript
      MIT License
      • Apple
      • Linux
    • A
      security
      F
      license
      A
      quality
      A simple Model Context Protocol server that provides basic arithmetic operations (addition, subtraction, multiplication, division) as tools that can be called by Large Language Models.
      Last updated -
      4
      JavaScript
    • -
      security
      -
      license
      -
      quality
      A simple implementation of a Model Context Protocol server that demonstrates core functionality including mathematical tools (add, subtract) and personalized greeting resources.
      Last updated -
      3
      Python
      GPL 3.0

    View all related MCP servers

    ID: s47rrwfdkz