Skip to main content
Glama
MCP Server Boilerplate

MCP Server Boilerplate

by cds-id

MCP 서버 보일러플레이트

MCP TypeScript SDK NPM 버전 MIT 라이센스

TypeScript와 Express로 구축된 모델 컨텍스트 프로토콜(MCP)을 위한 보일러플레이트 서버 구현입니다.

목차

Related MCP server: TypeScript MCP Server Boilerplate

개요

이 프로젝트는 애플리케이션이 표준화된 방식으로 LLM에 대한 컨텍스트를 제공할 수 있도록 하는 모델 컨텍스트 프로토콜(MCP)을 따르는 서버를 구현합니다. 여기에는 다음이 포함됩니다.

  • HTTP 및 stdio 전송 옵션이 포함된 완전히 구성된 MCP 서버

  • 주요 기능을 보여주는 샘플 리소스, 도구 및 프롬프트

  • 유형 안전성 및 더 나은 개발자 경험을 위한 TypeScript 지원

  • HTTP 전송 계층을 위한 Express 통합

프로젝트 구조

지엑스피1

시작하기

필수 조건

  • Node.js(v18 이상)

  • npm 또는 yarn

설치

저장소를 복제하고 종속성을 설치합니다.

git clone https://github.com/yourusername/mcp-server-boilerplate.git
cd mcp-server-boilerplate
npm install

환경 변수

예제 환경 파일을 복사하고 필요에 따라 수정합니다.

cp .env.example .env

사용 가능한 환경 변수:

  • PORT : HTTP 서버의 포트(기본값: 3000)

  • NODE_ENV : 환경 모드(개발, 프로덕션)

  • OAuth 설정(필요한 경우)

서버 실행

HTTP 서버

HTTP 서버를 빌드하고 시작합니다.

npm run build
npm start

자동 재시작을 통한 개발의 경우:

npm run dev

서버는 http://localhost:3000/mcp (또는 .env 파일에 지정된 포트)에서 사용할 수 있습니다.

표준 모드

stdio 모드에서 서버를 실행하려면(명령줄 도구의 경우):

npm run start:stdio

자동 재시작을 통한 개발의 경우:

npm run dev:stdio

자원

보일러플레이트에는 다음과 같은 예시 리소스가 포함되어 있습니다.

  1. 정적 정보 리소스 : info://server

    • 서버에 대한 기본 정보를 제공합니다

  2. 동적 인사말 리소스 : greeting://{name}

    • 제공된 이름 매개변수로 개인화된 인사말을 생성합니다.

리소스에 액세스하려면:

  • MCP 프로토콜을 통해

  • MCP 클라이언트 라이브러리 사용

도구

보일러플레이트에는 다음과 같은 도구 예제가 포함되어 있습니다.

  1. 계산기 : 기본적인 산술 연산을 수행합니다.

    • 매개변수:

      • operation : 수행할 연산(더하기, 빼기, 곱하기, 나누기)

      • a : 첫 번째 숫자

      • b : 두 번째 숫자

  2. 타임스탬프 : 다양한 형식으로 현재 시간을 제공합니다

    • 매개변수:

      • format : 출력 형식(iso, unix, readable)

프롬프트

보일러플레이트에는 다음과 같은 예시 프롬프트가 포함되어 있습니다.

  1. 인사말 : 개인화된 인사말 메시지를 생성합니다.

    • 매개변수:

      • name : 인사할 이름

      • formal : 공식적인 인사말 스타일을 사용할지 여부(선택 사항)

  2. 데이터 분석 : 데이터 분석을 위한 프롬프트를 생성합니다.

    • 매개변수:

      • data : 분석할 데이터

      • format : 데이터 형식(json, csv, text)

      • instructions : 추가 분석 지침(선택 사항)

서버 확장

리소스 추가

새로운 리소스를 추가하려면:

  1. src/resources/ 에 새 파일을 만듭니다(예: myResource.ts ).

  2. 리소스 핸들러를 구현하세요

  3. src/resources/index.ts 에 등록하세요

예:

// myResource.ts
import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';

export function myResource(server: McpServer): void {
  server.resource('my-resource', 'my-resource://path', async uri => ({
    contents: [
      {
        uri: uri.href,
        text: 'My resource content',
      },
    ],
  }));
}

// Then add to resources/index.ts
import { myResource } from './myResource.js';

export function registerResources(server: McpServer): void {
  // ...existing resources
  myResource(server);
}

도구 추가

새로운 도구를 추가하려면:

  1. src/tools/ 에 새 파일을 만듭니다(예: myTool.ts ).

  2. 도구 핸들러를 구현하세요

  3. src/tools/index.ts 에 등록하세요

예:

// myTool.ts
import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
import { z } from 'zod';

export function myTool(server: McpServer): void {
  server.tool('my-tool', { param: z.string() }, async ({ param }) => ({
    content: [
      {
        type: 'text',
        text: `Processed: ${param}`,
      },
    ],
  }));
}

// Then add to tools/index.ts
import { myTool } from './myTool.js';

export function registerTools(server: McpServer): void {
  // ...existing tools
  myTool(server);
}

프롬프트 추가

새로운 프롬프트를 추가하려면:

  1. src/prompts/ 에 새 파일을 만듭니다(예: myPrompt.ts ).

  2. 프롬프트 핸들러를 구현하세요

  3. src/prompts/index.ts 에 등록하세요

예:

// myPrompt.ts
import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
import { z } from 'zod';

export function myPrompt(server: McpServer): void {
  server.prompt('my-prompt', { topic: z.string() }, ({ topic }) => ({
    messages: [
      {
        role: 'user',
        content: {
          type: 'text',
          text: `Please explain ${topic} in simple terms.`,
        },
      },
    ],
  }));
}

// Then add to prompts/index.ts
import { myPrompt } from './myPrompt.js';

export function registerPrompts(server: McpServer): void {
  // ...existing prompts
  myPrompt(server);
}

테스트 및 디버깅

MCP 서버를 테스트하려면 다음을 사용할 수 있습니다.

  • MCP 검사기 도구

  • MCP 클라이언트 라이브러리

  • 직접 HTTP 요청(디버깅용)

특허

이 프로젝트는 MIT 라이선스에 따라 라이선스가 부여되었습니다. 자세한 내용은 라이선스 파일을 참조하세요.

Available Tools

2 tools
calculateD
NameRequiredDescriptionDefault
operationYes
aYes
bYes

TDQS

D1/5.0
Behavior1/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Tool has no description.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness1/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Tool has no description.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness1/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Tool has no description.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters1/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Tool has no description.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose1/5

Does the description clearly state what the tool does and how it differs from similar tools?

Tool has no description.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines1/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Tool has no description.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

timestampD
NameRequiredDescriptionDefault
formatNoiso

TDQS

D1/5.0
Behavior1/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Tool has no description.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness1/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Tool has no description.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness1/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Tool has no description.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters1/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Tool has no description.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose1/5

Does the description clearly state what the tool does and how it differs from similar tools?

Tool has no description.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines1/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Tool has no description.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

  1. 2 tool updates
    • First observedcalculate
    • First observedtimestamp

TDQS

D1.7/5.0

Scored across 2 tools

Disambiguation5/5

The two tools have clearly distinct purposes: 'calculate' suggests mathematical or computational operations, while 'timestamp' implies time-related functions. With no overlapping descriptions, there is no ambiguity between them.

Naming Consistency5/5

Both tool names follow a consistent pattern of using single, descriptive nouns in lowercase. There are no deviations in style or convention across the set.

Tool Count2/5

With only 2 tools, the server feels thin and under-scoped for a 'boilerplate' purpose, which typically implies a foundational or example set. This minimal count limits functionality and utility.

Completeness1/5

The server lacks descriptions, making it impossible to infer a clear domain or assess coverage. Without context, it appears severely incomplete, with no indication of what operations are supported or how they fit together.

Maintenance

ActivityInactive
ResponsivenessNo issues

Related MCP Connectors

Related MCP Servers

  • A
    license
    B
    quality
    D
    maintenance
    A basic starter project for building Model Context Protocol (MCP) servers that enables standardized interactions between AI systems and various data sources through secure, controlled tool implementations.
    2
    MIT
  • A
    license
    Not graded
    quality
    D
    maintenance
    A starter project designed to quickly build and deploy Model Context Protocol (MCP) servers using the TypeScript SDK and Zod for schema validation. It features example implementations for tools and resources, providing a solid foundation for custom MCP development and integration.
    ISC
  • A
    license
    Not graded
    quality
    D
    maintenance
    A minimal Model Context Protocol (MCP) server demonstrating the implementation of tools, resources, and prompts. It serves as a starter template built with the Smithery SDK for developing custom integrations.
    ISC
  • A
    license
    A
    quality
    D
    maintenance
    A starter project for rapidly developing Model Context Protocol servers using TypeScript and the official SDK. It includes pre-implemented examples of tools and resources to help developers jumpstart their custom MCP server development.
    6
    ISC