KE

kerlos/elysia-mcp

Developer tools

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

49 stars 5 forks 품질 60 트렌드 17MIT

ElysiaJS 플러그인 모델 Context 프로토콜 HTTP 전송

개요

포괄적인 ElysiaJS 플러그인 구현 모델 Context Protocol (MCP) 서버와 HTTP 전송 지원. - : Streamable HTTP를 가진 가득 차있는 HTTP 근거한 MCP 수송 -: 우두머리를 통해 처리하는 Stateful 세션 -: TypeScript와 Zod 유효성 검사 -: Elysia 앱을 위한 간단한 플러그인 건축 -: 공구, 자원, Prompts 및 로깅 -: 어떤 logger (pino, winston, bunyan, 등)를 사용하여 -: Proper JSON-RPC 2.0 과실 응답 -: Bun test runner를 가진 가득 차있는 단위 시험 적용 신속하게 사전 구성 Elysia MCP 프로젝트로 시작하려면 스타터 템플릿을 사용할 수 있습니다. elysia-mcp-starter 템플릿은 다음과 같습니다. - MCP 플러그인이있는 사전 구성 Elysia 설정 - TypeScript 구성 - 개발 스크립트 - 기본 프로젝트 구조 - MCP 서버 구현 예제 이 예제는 단일 Elysia 응용 프로그램에서 여러 MCP 플러그인을 만드는 방법을 설명합니다. - 추가 - 두 개의 숫자를 추가 - 곱하기 - 두 숫자를 곱 - 힘 - exponent의 힘에 기초 계산 -...

개요(AI 번역)

구현을위한 포괄적 인 ElysiaJS 플러그인 모형 Context 의정서 (MCP) 서버 HTTP 수송 지원으로.

특징

  • ** HTTP Transport**: Streamable HTTP를 가진 가득 차있는 HTTP 근거한 MCP 수송
  • Session Management: headers를 통한 Stateful Session 처리
  • Type-Safe: TypeScript 및 Zod 유효성 검사 내장
  • ** 쉬운 통합 **: Elysia 앱의 간단한 플러그인 아키텍처 -Comprehensive Support: 도구, 자원, 탐사, 로깅
  • ** 사용자 정의 로거 지원**: 어떤 로거 (pino, winston, bunyan, 등) 사용 -Error Handling: Proper JSON-RPC 2.0 오류 응답
  • Testing: Bun test runner를 가진 가득 차있는 단위 시험 적용

설치

스타터 템플릿

신속하게 사전 구성 Elysia MCP 프로젝트로 시작하려면 스타터 템플릿을 사용할 수 있습니다.

elysia-mcp-starter 템플릿은 다음과 같습니다.

  • MCP 플러그인과 사전 구성 Elysia 설정
  • TypeScript 구성
  • 개발 스크립트
  • 기본 프로젝트 구조
  • MCP 서버 구현 예

빠른 시작

사용법

예제 실행

기본 예제:

**Multiple Servers 예제: **

이 예제는 단일 Elysia 응용 프로그램에서 여러 MCP 플러그인을 만드는 방법을 설명합니다

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

README

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

Elysia MCP Plugin

A comprehensive ElysiaJS plugin for implementing Model Context Protocol (MCP) servers with HTTP transport support.

Features

  • HTTP Transport: Full HTTP-based MCP transport with Streamable HTTP
  • Session Management: Stateful session handling via headers
  • Type-Safe: Built with TypeScript and Zod validation
  • Easy Integration: Simple plugin architecture for Elysia apps
  • Comprehensive Support: Tools, Resources, Prompts, and Logging
  • Custom Logger Support: Use any logger (pino, winston, bunyan, etc.)
  • Error Handling: Proper JSON-RPC 2.0 error responses
  • Testing: Full unit test coverage with Bun test runner

Installation

bun add elysia-mcp
# or
npm install elysia-mcp

Starter Template

To quickly get started with a pre-configured Elysia MCP project, you can use our starter template:

# Create a new project from the starter template
bun create https://github.com/kerlos/elysia-mcp-starter my-mcp-project

# Navigate to the project
cd my-mcp-project

# Install dependencies
bun install

# Start development server
bun run dev

The elysia-mcp-starter template includes:

  • Pre-configured Elysia setup with MCP plugin
  • TypeScript configuration
  • Development scripts
  • Basic project structure
  • Example MCP server implementation

Quick Start

import { Elysia } from 'elysia';
import { mcp } from 'elysia-mcp';
import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
import { z } from 'zod';

const app = new Elysia()
  .use(
    mcp({
      serverInfo: {
        name: 'my-mcp-server',
        version: '1.0.0',
      },
      capabilities: {
        tools: {},
        resources: {},
        prompts: {},
        logging: {},
      },
      setupServer: async (server: McpServer) => {
        // Register your MCP tools, resources, and prompts here
        server.registerTool(
          'echo',
          {
            description: 'Echoes back the provided text',
            inputSchema: {
              text: z.string().describe('Text to echo back'),
            },
          },
          async (args) => {
            return {
              content: [{ type: 'text', text: `Echo: ${args.text}` }],
            };
          }
        );
      },
    })
  )
  .listen(3000);

Usage

Running the Examples

Basic Example:

# Run the basic example server (port 3000)
bun run example

# Or with development mode (auto-restart)
bun run dev

Multiple Servers Example:

# Run the multiple MCP servers example (port 3000)
bun example:multi

This example demonstrates how to create multiple MCP plugins in a single Elysia application:

  • Math Operations Plugin (/math) - Basic arithmetic tools:

    • add - Add two numbers
    • multiply - Multiply two numbers
    • power - Calculate base to the power of exponent
GitHub에서 전체 README 보기

설치

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