My First MCP

My First MCP

A tutorial MCP server that provides basic utility tools including time queries, arithmetic calculations, random number generation, string manipulation, and server information retrieval.

Category
访问服务器

README

my-first-mcp

MCP(Model Context Protocol) 서버 개발 튜토리얼 - 첫 번째 MCP 서버

License: MIT Node.js TypeScript

소개

이 프로젝트는 MCP(Model Context Protocol) 서버 개발을 배우기 위한 튜토리얼입니다. Claude Code와 같은 AI 도구에서 사용할 수 있는 간단한 MCP 서버를 구현합니다.

제공 Tool

Tool 설명 사용 예시
get_current_time 현재 시간 조회 "지금 몇 시야?"
calculate 사칙연산 계산기 "123 + 456 계산해줘"
get_random_number 랜덤 숫자 생성 "로또 번호 뽑아줘"
reverse_string 문자열 뒤집기 "hello 뒤집어줘"
get_server_info 서버 정보 조회 "MCP 서버 정보"

스크린샷

Claude Code에서 Tool 실행

Claude Code Calculate Demo

"123 더하기 456 계산해줘" → calculate Tool 실행 → "123 + 456 = 579 입니다"

MCP 서버 자동 감지

MCP Auto Detection

.mcp.json 파일로 프로젝트 진입 시 자동 감지

MCP Inspector UI

MCP Inspector UI

MCP Inspector로 서버 테스트 및 디버깅

MCP Inspector Tool 목록

MCP Inspector Tools

5개 Tool (get_current_time, calculate, get_random_number, reverse_string, get_server_info)

설치

요구사항

  • Node.js 20+
  • npm 또는 pnpm

설치 방법

# 저장소 클론
git clone https://github.com/dh1789/my-first-mcp.git
cd my-first-mcp

# 의존성 설치
npm install

# 빌드
npm run build

사용법

Claude Code에 연결

# MCP 서버 등록
claude mcp add my-first-mcp -- node /path/to/my-first-mcp/dist/index.js

# 연결 확인
claude mcp list

MCP Inspector로 테스트

npm run inspect
# 브라우저에서 http://localhost:6274 접속

직접 실행

npm start

개발

프로젝트 구조

my-first-mcp/
├── src/
│   ├── index.ts      # MCP 서버 진입점
│   ├── tools.ts      # 핵심 로직 (순수 함수)
│   └── tools.test.ts # 유닛 테스트
├── dist/             # 빌드 결과물
├── package.json
├── tsconfig.json
└── vitest.config.ts

스크립트

npm run build     # TypeScript 빌드
npm test          # 유닛 테스트 실행 (31 tests)
npm run test:watch # 테스트 watch 모드
npm run inspect   # MCP Inspector 실행
npm start         # 서버 실행

테스트

TDD 방식으로 31개 유닛 테스트가 포함되어 있습니다:

npm test

# 결과
# ✓ src/tools.test.ts (31 tests) 18ms
# Test Files  1 passed (1)
# Tests       31 passed (31)

기술 스택

  • Runtime: Node.js 20+
  • Language: TypeScript 5.7
  • MCP SDK: @modelcontextprotocol/sdk
  • Validation: zod
  • Testing: vitest

관련 문서

라이선스

MIT License - 자유롭게 사용, 수정, 배포할 수 있습니다.

기여

이슈와 PR을 환영합니다!

  1. Fork
  2. Feature branch 생성 (git checkout -b feature/amazing-feature)
  3. Commit (git commit -m 'Add amazing feature')
  4. Push (git push origin feature/amazing-feature)
  5. Pull Request 생성

작성자

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选