LM

lucianoayres/mcp-server-node

Developer tools

このページは AI により自動翻訳されています。技術的な詳細は原文をご確認ください。 原文を見る

76 stars 19 forks 品質 68 トレンド 14MIT

lucianoayres/mcp-server-node は [https://github.com/lucianoayres/mcp-server-node.] からインポートされた MCP サーバーの候補です

概要

lucianoayres/mcp-server-node は [https://github.com/lucianoayres/mcp-server-node.] からインポートされた MCP サーバーの候補です

概要(AI 翻訳)

Node.js でカスタム MCP Server をビルドして実行します。わずか2分です。

概要 · 特長 · インストール · MCP インスペクタでのテスト · 試験のための環境変数の設定 · カーソル AI と統合 · カーソルの MCP ツールを使用して (エージェント モード) · コード 概要 · 参照 & リソース · ライセンス

概要

**MCP(Model Context Protocol)**は、Cursor AIなどのAI支援開発環境にカスタムツールを統合できるフレームワークです。 LLM ベースの IDE がこれらのツールをオンデマンドで呼び出すことができるように、MCP サーバーは、機能(データ検索やコード解析など)を公開します。 モデルコンテキストプロトコルの紹介でMCPの詳細をご覧ください。

このプロジェクトでは、Node.js を使用して JavaScript で実装されている MCP サーバーを説明します。 2つのツールを定義します。addは、2つの数値入力をとり、その合計を返し、[API_KEY]]環境変数からAPIキーを取得するgetApiKeyです。 また、AIモデルが追加ツールの使用を阻害する既定のプロンプトadd numbersも提供します。

要件

  • 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" } } } }