LM

lucianoayres/mcp-server-node

Developer tools

이 페이지는 AI로 자동 번역되었습니다. 기술적인 세부 사항은 원문을 확인하세요. 원문 보기

76 stars 19 forks 품질 68 트렌드 14MIT

lucianoayres/mcp-server-node는 MCP 서버 후보가 https://github.com/lucianoayres/mcp-server-node.에서 수입되었습니다

개요

lucianoayres/mcp-server-node는 MCP 서버 후보가 https://github.com/lucianoayres/mcp-server-node.에서 수입되었습니다

개요(AI 번역)

Node.js에서 사용자 정의 MCP Server를 2 분 만에 실행하고 실행합니다.

개요 · 기능 · 설치 · MCP 검사기 테스트 · 테스트를위한 환경 변수 설정 · Cursor AI와 통합 · Cursor (Agent Mode)의 MCP 도구를 사용하여 · 코드 개요 · 참조 및 리소스 · 라이센스

개요

**MCP (Model Context Protocol)**는 Cursor AI와 같은 AI 보조 개발 환경에 맞춤 도구를 통합 할 수있는 프레임 워크입니다. MCP 서버는 LLM 기반 IDE가 이러한 도구를 수요에 부합할 수 있도록 기능(Data retrieval 또는 code analysis와 같은)을 노출합니다. Model Context Protocol 소개에서 MCP에 대해 자세히 알아보십시오.

이 프로젝트는 Node.js를 사용하여 JavaScript에서 구현된 MCP 서버를 보여줍니다. 두 가지 도구를 정의합니다. , 두 개의 숫자 입력을 가지고 자신의 합계를 반환, 및 getApiKey, 이는 API_KEY 환경 변수에서 API 키를 검색합니다. 또한 사전 정의 된 프롬프트 ** add numbers를 제공합니다. AI 모델은 추가 도구의 사용을 infer 할 수 있습니다.

요구 사항

  • **Node.js: ** 버전 20 이상이 필요합니다.

특징

  • MCP 통합: LLM 기반 IDE에 툴 기능을 노출합니다.

이 페이지는 AI로 자동 번역되었습니다. 기술적인 세부 사항은 원문을 확인하세요.

README

원문 README의 일부입니다. 원문 보기.

🟢 MCP Server in Node.js

Build and run a custom MCP Server in Node.js in just 2 minutes ⏱️

Overview · Features · Installation · Testing with MCP Inspector · Setting Environment Variables for Testing · Integrating with Cursor AI · Using the MCP Tool in Cursor (Agent Mode) · Code Overview · References & Resources · License

Overview

MCP (Model Context Protocol) is a framework that allows you to integrate custom tools into AI-assisted development environments—such as Cursor AI. MCP servers expose functionality (like data retrieval or code analysis) so that an LLM-based IDE can call these tools on demand. Learn more about MCP in the Model Context Protocol Introduction.

This project demonstrates an MCP server implemented in JavaScript using Node.js. It defines two tools: add, which takes two numeric inputs and returns their sum, and getApiKey, which retrieves the API key from the API_KEY environment variable. It also provides a predefined prompt add_numbers that allows AI models to infer the usage of the addition tool.

Requirements

  • Node.js: Version 20 or higher is required.

Features

  • MCP Integration: Exposes tool functionality to LLM-based IDEs.
  • Addition Tool: Accepts two numeric parameters and returns their sum.
  • MCP Prompt: Provides a predefined prompt (“add_numbers”) that allow AI models to infer tool usage.
  • Env Var Retrieval: Demonstrates how to load an example environment variable from the configuration file.
  • Input Validation: Uses Zod for schema validation.
  • Standard I/O Transport: Connects via StdioServerTransport for integration with development environments.

Installation

  1. Clone the Repository

    git clone 
    cd 
    
  2. Install Dependencies

    You can install the project dependencies in one of two ways:

    Option 1: Install using the existing package.json

    Simply run:

    npm install
    

    Option 2: Install dependencies manually

    If you prefer, delete the existing package.json and install the required packages manually:

    npm install @modelcontextprotocol/sdk zod
    

    Then, update the newly generated package.json file to include the following lines, which enables ES Modules and adds the mcp inspector command:

    "type": "module",
    "scripts": {
     "inspector": "npx @modelcontextprotocol/inspector node ./mcp-server.js"
    }
    

Testing with MCP Inspector

GitHub에서 전체 README 보기

설치

npx @modelcontextprotocol/inspector node ./mcp-server.js
MCP 초보자라면? mcpskill.org 가이드부터 시작하세요 →

설정

{ "mcpServers": { "existing-server": { "command": "python", "args": ["/path/to/existing/server.py"] }, "MCP Server Boilerplate": { "command": "node", "args": ["/home/john/mcp-server-node/mcp-server.js"], "env": { "API_KEY": "abc-1234567890" } } } }