mcp-server

cloudtypej/mcp-server

3.2

If you are the rightful owner of 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.

This project is an implementation example of a Remote MCP (Model Context Protocol) server using StreamableHTTPServerTransport.

Tools
  1. calculator

    Performs simple arithmetic calculations

  2. user-list

    Retrieves a list of users over a specified period

  3. user-statistics

    Retrieves subscriber statistics over a specified period

MCP Server Example

์ด ํ”„๋กœ์ ํŠธ๋Š” StreamableHTTPServerTransport๋ฅผ ์‚ฌ์šฉํ•œ Remote MCP (Model Context Protocol) ์„œ๋ฒ„์˜ ๊ตฌํ˜„ ์˜ˆ์ œ์ž…๋‹ˆ๋‹ค.

๐Ÿ’ก ํŒ: MCP ์„œ๋ฒ„๋ฅผ ์ฒ˜์Œ ์‚ฌ์šฉํ•˜์‹œ๋Š” ๊ฒฝ์šฐ, MCP ๊ณต์‹ ๋ฌธ์„œ๋ฅผ ์ฐธ์กฐํ•˜์„ธ์š”.

์‹œ์ž‘ํ•˜๊ธฐ

์˜์กด์„ฑ ์„ค์น˜

npm install

์‹คํ–‰ ๋ฐฉ๋ฒ•

๋กœ์ปฌ ๊ฐœ๋ฐœ ํ™˜๊ฒฝ
npm run dev
ํ”„๋กœ๋•์…˜ ํ™˜๊ฒฝ
npm run build
npm start

์ œ๊ณต ๋„๊ตฌ

calculator

  • ๊ธฐ๋Šฅ: ๊ฐ„๋‹จํ•œ ์ˆ˜์‹ ๊ณ„์‚ฐ ์ˆ˜ํ–‰

user-list

  • ๊ธฐ๋Šฅ: ํŠน์ • ๊ธฐ๊ฐ„ ๋™์•ˆ์˜ ์‚ฌ์šฉ์ž ๋ชฉ๋ก ์กฐํšŒ

user-statistics

  • ๊ธฐ๋Šฅ: ํŠน์ • ๊ธฐ๊ฐ„ ๋™์•ˆ์˜ ๊ฐ€์ž…์ž ํ†ต๊ณ„ ์กฐํšŒ

ํ™˜๊ฒฝ ์„ค์ •

ํ™˜๊ฒฝ ๋ณ€์ˆ˜

๋ณ€์ˆ˜๋ช…์„ค๋ช…ํ•„์ˆ˜ ์—ฌ๋ถ€
TOKENAPI ์ธ์ฆ ํ† ํฐ Authorization ํ—ค๋”์™€ ์ผ์น˜ํ•˜๋Š” ๊ฒฝ์šฐ ์ธ์ฆํ•„์ˆ˜
ALLOWED_ORIGINCORS Origin์„ ํƒ

ํ™˜๊ฒฝ ๋ณ€์ˆ˜ ์„ค์ • ์˜ˆ์‹œ

# .env ํŒŒ์ผ
TOKEN=your-secret-token-here
ALLOWED_ORIGIN=

ํด๋ผ์ด์–ธํŠธ ์„ค์ •

Cursor IDE ์„ค์ •

.cursor-settings.json ํŒŒ์ผ์— ๋‹ค์Œ๊ณผ ๊ฐ™์ด ์„ค์ •:

{
  "mcpServers": {
    "example": {
      "url": "http://localhost:3000/mcp",
      "headers": {
        "Authorization": "Bearer <TOKEN>"
      }
    }
  }
}

๐Ÿ“ ์ฐธ๊ณ : <TOKEN>์„ ์‹ค์ œ ํ™˜๊ฒฝ๋ณ€์ˆ˜ TOKEN ๊ฐ’์œผ๋กœ ๊ต์ฒดํ•˜์„ธ์š”.

API ์—”๋“œํฌ์ธํŠธ

  • Base URL: http://localhost:3000
  • MCP Endpoint: /mcp

์ธ์ฆ

์„œ๋ฒ„๋Š” Bearer Token ์ธ์ฆ์„ ์‚ฌ์šฉํ•ฉ๋‹ˆ๋‹ค:

Authorization: Bearer <TOKEN>

์ถ”๊ฐ€ ์ •๋ณด

๊ฐœ๋ฐœ ํ™˜๊ฒฝ ์„ค์ •

# ์˜์กด์„ฑ ์„ค์น˜
npm install

# ๊ฐœ๋ฐœ ์„œ๋ฒ„ ์‹œ์ž‘
npm run dev

ํ”„๋กœ๋•์…˜ ๋ฐฐํฌ

# ๋นŒ๋“œ
npm run build

# ํ”„๋กœ๋•์…˜ ์„œ๋ฒ„ ์‹œ์ž‘
npm start

๋ฌธ์ œ ํ•ด๊ฒฐ

์ž์ฃผ ๋ฐœ์ƒํ•˜๋Š” ๋ฌธ์ œ๋“ค

  • 401 Unauthorized: TOKEN ํ™˜๊ฒฝ๋ณ€์ˆ˜๊ฐ€ ์„ค์ •๋˜์–ด ์žˆ๋Š”์ง€ ํ™•์ธ
  • Connection refused: ์„œ๋ฒ„๊ฐ€ ์˜ฌ๋ฐ”๋ฅด๊ฒŒ ์‹œ์ž‘๋˜์—ˆ๋Š”์ง€ ํ™•์ธ

๐Ÿ“„ ๋ผ์ด์„ผ์Šค

MIT License