poc-node-mcp-server

slicequeue/poc-node-mcp-server

3.2

If you are the rightful owner of poc-node-mcp-server and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to henry@mcphub.com.

The POC Node MCP Server is a demonstration project designed for learning and testing the development of Model Context Protocol (MCP) servers, offering various computational tools and user information resources.

Tools
  1. add

    Performs addition of two numbers.

  2. get_weather

    Retrieves random weather information for a given city.

POC Node MCP Server

POC (Proof of Concept) - MCP(Model Context Protocol) μ„œλ²„ 개발 ν•™μŠ΅ 및 ν…ŒμŠ€νŠΈλ₯Ό μœ„ν•œ 데λͺ¨ ν”„λ‘œμ νŠΈμž…λ‹ˆλ‹€.

λ‹€μ–‘ν•œ 계산 도ꡬ와 μ‚¬μš©μž 정보 λ¦¬μ†ŒμŠ€λ₯Ό μ œκ³΅ν•˜λŠ” MCP μ„œλ²„λ‘œ, MCP μ„œλ²„ 개발 방법을 ν•™μŠ΅ν•˜κ³  ν…ŒμŠ€νŠΈν•  수 μžˆμŠ΅λ‹ˆλ‹€.

🎯 ν”„λ‘œμ νŠΈ λͺ©μ 

  • MCP μ„œλ²„ 개발 방법 ν•™μŠ΅
  • Toolκ³Ό Resource의 차이점 이해
  • LLM과의 연동 ν…ŒμŠ€νŠΈ
  • npm νŒ¨ν‚€μ§€ 배포 및 npx μ‹€ν–‰ ν…ŒμŠ€νŠΈ

μ„€μΉ˜

npm install -g poc-node-mcp-server

λ˜λŠ” npx둜 직접 μ‹€ν–‰:

npx poc-node-mcp-server

μ œκ³΅ν•˜λŠ” κΈ°λŠ₯

Tools (도ꡬ)

1. add - μˆ˜ν•™ 계산

두 숫자λ₯Ό μž…λ ₯λ°›μ•„ κ·Έ 합을 λ°˜ν™˜ν•©λ‹ˆλ‹€.

{
  "method": "tools/call",
  "params": {
    "name": "add",
    "arguments": {
      "a": 5,
      "b": 3
    }
  }
}
2. get_weather - 날씨 정보 쑰회

λ„μ‹œ 이름을 μž…λ ₯λ°›μ•„ ν•΄λ‹Ή λ„μ‹œμ˜ 랜덀 날씨 정보λ₯Ό λ°˜ν™˜ν•©λ‹ˆλ‹€.

{
  "method": "tools/call",
  "params": {
    "name": "get_weather",
    "arguments": {
      "city": "μ„œμšΈ"
    }
  }
}

Resources (λ¦¬μ†ŒμŠ€)

1. greeting - 인사말

μ‚¬μš©μž 이름을 λ°›μ•„ 인사말을 μƒμ„±ν•©λ‹ˆλ‹€.

URI: greeting://홍길동
2. user_profile - μ‚¬μš©μž ν”„λ‘œν•„

μ‚¬μš©μž 이름을 λ°›μ•„ λžœλ€ν•œ ν”„λ‘œν•„ 정보λ₯Ό μƒμ„±ν•©λ‹ˆλ‹€.

URI: user_profile://κΉ€μ² μˆ˜

Gemini CLI 연동

.gemini/settings.json νŒŒμΌμ— λ‹€μŒ 섀정을 μΆ”κ°€ν•˜μ„Έμš”:

{
  "mcpServers": {
    "demo-mcp-server": {
      "command": "npx",
      "args": ["poc-node-mcp-server"],
      "description": "POC MCP μ„œλ²„ - ν•™μŠ΅ 및 ν…ŒμŠ€νŠΈμš© λ‹€μ–‘ν•œ 계산 도ꡬ와 μ‚¬μš©μž 정보 λ¦¬μ†ŒμŠ€ 제곡"
    }
  }
}

μ‚¬μš© μ˜ˆμ‹œ

LLM과의 λŒ€ν™”

μ‚¬μš©μž: "5와 3을 λ”ν•΄μ€˜"
LLM: add 도ꡬλ₯Ό μ‚¬μš©ν•˜μ—¬ 8을 λ°˜ν™˜

μ‚¬μš©μž: "μ„œμšΈμ˜ 날씨λ₯Ό μ•Œλ €μ€˜"
LLM: get_weather 도ꡬλ₯Ό μ‚¬μš©ν•˜μ—¬ "μ„œμšΈμ˜ ν˜„μž¬ 날씨: λ§‘μŒ, 기온: 15Β°C, μŠ΅λ„: 65%" λ°˜ν™˜

μ‚¬μš©μž: "ν™κΈΈλ™μ—κ²Œ μΈμ‚¬ν•΄μ€˜"
LLM: greeting://홍길동 λ¦¬μ†ŒμŠ€μ— μ ‘κ·Όν•˜μ—¬ "μ•ˆλ…•ν•˜μ„Έμš”, ν™κΈΈλ™λ‹˜!" λ°˜ν™˜

μ‚¬μš©μž: "κΉ€μ² μˆ˜μ˜ ν”„λ‘œν•„μ„ λ³΄μ—¬μ€˜"
LLM: user_profile://κΉ€μ² μˆ˜ λ¦¬μ†ŒμŠ€μ— μ ‘κ·Όν•˜μ—¬ 랜덀 ν”„λ‘œν•„ 정보 λ°˜ν™˜

개발

둜컬 개발 ν™˜κ²½ μ„€μ •

# μ˜μ‘΄μ„± μ„€μΉ˜
npm install

# TypeScript λΉŒλ“œ
npm run build

# 개발 λͺ¨λ“œ μ‹€ν–‰
npm run dev

# ν…ŒμŠ€νŠΈ μ‹€ν–‰
npm test

ν”„λ‘œμ νŠΈ ꡬ쑰

poc-node-mcp-server/
β”œβ”€β”€ src/
β”‚   └── index.ts          # 메인 MCP μ„œλ²„ μ½”λ“œ
β”œβ”€β”€ dist/
β”‚   └── index.js          # λΉŒλ“œλœ JavaScript 파일
β”œβ”€β”€ test-mcp.js           # MCP μ„œλ²„ ν…ŒμŠ€νŠΈ 슀크립트
β”œβ”€β”€ package.json          # ν”„λ‘œμ νŠΈ μ„€μ •
β”œβ”€β”€ tsconfig.json         # TypeScript μ„€μ •
β”œβ”€β”€ MCP_Learning_Guide.md # MCP ν•™μŠ΅ κ°€μ΄λ“œ
└── README.md            # ν”„λ‘œμ νŠΈ λ¬Έμ„œ

πŸ“š ν•™μŠ΅ 자료

이 ν”„λ‘œμ νŠΈλŠ” MCP μ„œλ²„ κ°œλ°œμ„ μœ„ν•œ ν•™μŠ΅ μžλ£Œμž…λ‹ˆλ‹€. MCP_Learning_Guide.md νŒŒμΌμ—μ„œ λ‹€μŒ λ‚΄μš©μ„ ν•™μŠ΅ν•  수 μžˆμŠ΅λ‹ˆλ‹€:

  • MCP μ„œλ²„ κΈ°λ³Έ κ°œλ…
  • Tool vs Resource 차이점
  • LLM ν™œμš©μ„ μœ„ν•œ μ΅œμ ν™” 방법
  • Transport 방식 이해
  • μ‹€μ œ κ΅¬ν˜„ 예제
  • Gemini CLI 연동 방법

⚠️ μ£Όμ˜μ‚¬ν•­

  • 이 ν”„λ‘œμ νŠΈλŠ” ν•™μŠ΅ 및 ν…ŒμŠ€νŠΈ λͺ©μ μœΌλ‘œ μ œμž‘λ˜μ—ˆμŠ΅λ‹ˆλ‹€.
  • μ‹€μ œ ν”„λ‘œλ•μ…˜ ν™˜κ²½μ—μ„œ μ‚¬μš©ν•˜κΈ°μ—λŠ” λΆ€μ‘±ν•œ 뢀뢄이 μžˆμ„ 수 μžˆμŠ΅λ‹ˆλ‹€.
  • 랜덀 데이터λ₯Ό μ‚¬μš©ν•˜λ―€λ‘œ μ‹€μ œ 데이터와 λ‹€λ₯Ό 수 μžˆμŠ΅λ‹ˆλ‹€.

λΌμ΄μ„ μŠ€

ISC

κΈ°μ—¬ν•˜κΈ°

  1. 이 μ €μž₯μ†Œλ₯Ό ν¬ν¬ν•˜μ„Έμš”
  2. μƒˆλ‘œμš΄ κΈ°λŠ₯ 브랜치λ₯Ό λ§Œλ“œμ„Έμš” (git checkout -b feature/amazing-feature)
  3. 변경사항을 μ»€λ°‹ν•˜μ„Έμš” (git commit -m 'Add some amazing feature')
  4. λΈŒλžœμΉ˜μ— ν‘Έμ‹œν•˜μ„Έμš” (git push origin feature/amazing-feature)
  5. Pull Requestλ₯Ό μƒμ„±ν•˜μ„Έμš”

κ΄€λ ¨ 링크