Skip to main content
Glama
souravjai

Calculator MCP Server

by souravjai

Calculator MCP Server

stdio를 통해 기본 계산기 작업을 제공하는 소형 Model Context Protocol (MCP) 서버입니다.

Calculator MCP server tutorial

기능

서버는 다음 도구를 제공합니다:

도구

설명

인수

add

두 숫자를 더합니다

op1, op2

sub

첫 번째 숫자에서 두 번째 숫자를 뺍니다

op1, op2

mul

두 숫자를 곱합니다

op1, op2

div

첫 번째 숫자를 두 번째 숫자로 나눕니다

op1, op2

모든 인수는 숫자여야 합니다. div는 op2가 0일 때 오류를 반환합니다.

Related MCP server: Simple Calculator MCP

요구 사항

  • Node.js 18 이상

  • npm

설정

이 디렉터리에서 종속성을 설치합니다:

npm install

서버 실행

stdio를 통해 MCP 서버를 시작합니다:

npm start

서버는 MCP 클라이언트의 연결을 기다리므로 터미널에 일반적인 애플리케이션 출력을 표시하지 않습니다.

예제 클라이언트로 테스트

예제 클라이언트는 서버를 시작하고, 도구 목록을 표시하며, 0으로 나누기 오류를 보여주기 위해 div를 10과 0으로 호출합니다:

npm run test-client

성공적인 작업을 테스트하려면 mcp-client-test.ts의 callTool 인수를 업데이트하세요. 예를 들어:

arguments: { op1: 10, op2: 2 },

MCP Inspector 사용

다음 명령으로 대화형 MCP Inspector를 실행합니다:

npm run mcp-inspect

명령이 출력한 URL을 연 다음 계산기 도구를 선택하고 op1과 op2에 값을 입력합니다.

프로젝트 파일

  • mcp-server.ts - MCP 서버 및 계산기 도구 정의

  • mcp-client-test.ts - 예제 MCP 클라이언트

  • mcp-calculator.gif - 튜토리얼 안내

  • package.json - 스크립트 및 종속성

Related MCP Connectors

Related MCP Servers

  • F
    license
    A
    quality
    D
    maintenance
    Provides basic mathematical operations including addition, subtraction, multiplication, division, and power calculations through a Model Context Protocol interface.
    5
    1
    -
  • F
    license
    Not graded
    quality
    D
    maintenance
    Provides file reading and mathematical calculation tools through the Model Context Protocol. Enables reading file contents and evaluating mathematical expressions via stdio transport.
    -
  • F
    license
    Not graded
    quality
    D
    maintenance
    Provides basic arithmetic operations (add, multiply, divide) for AI assistants through the Model Context Protocol.
    -