Token导航 LogoToken导航TokenDH.com
Multi-Purpose MCP Server logo
开发工具未说明官方级别未说明来源级核验

Multi-Purpose MCP Server

MCP Server

提供时间查询、计算器、多语言问候、代码审查和图像生成等多种功能的Model Context Protocol (MCP)服务器。

工具数

5

提示词数

0

GitHub Stars

0

资源数

0
代码审查JavaScriptCursorCursor

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

作者 / 组织

ciel240

提供方

ciel240

最后核验

2026/5/17 20:21

快速接入

先看主来源和安装命令,再打开仓库或文档;下面只保留这个条目的关键接入事实。

详细介绍

多用途MCP服务器

提供多种功能的Model Context Protocol(MCP)服务器。包括时间查询、计算器、问候语、代码评论、图像生成等功能。

🚀 主要功能

  • 查询当前时间:查询指定时间段的当前时间
  • 支持不同的时区:支持Asia/Seoul、America/New_York、Europe/London等所有IANA时区
  • 计算器:对两个数字执行四则运算
  • 多语种问候语:提供多种语言的问候语
  • 代码评论:生成代码的详细评论提示
  • 创建图像:使用文本提示创建AI图像

📁 项目结构

time-mcp-server/
├── src/
│   └── index.ts          # MCP 서버 메인 진입점
├── build/                # 컴파일된 JavaScript 파일 (빌드 후 생성)
├── package.json          # 프로젝트 의존성 및 스크립트
├── tsconfig.json         # TypeScript 설정
└── README.md            # 프로젝트 문서

🚀 开始

1.安装依赖性

npm install

2.设置环境变量

要使用图像生成功能,需要Hugging Face API令牌。

发放Hugging Face API令牌

  1. 拥抱脸在中创建帐户
  2. 设置>访问令牌在中创建新令牌
  3. 复制令牌

设置环境变量

Windows(PowerShell):

$env:HF_TOKEN="your_hugging_face_token_here"

Windows(命令提示符):

set HF_TOKEN=your_hugging_face_token_here

Linux/macOS:

export HF_TOKEN="your_hugging_face_token_here"

或者 .env 可以创建并设置文件:

HF_TOKEN=your_hugging_face_token_here

3.构建

npm run build

4.运行

node build/index.js

构建成功后 build/ 在目录中创建编译的JavaScript文件,服务器等待MCP客户端的连接。

🛠️ 使用方法

1.时间查询工具

查询当前时间的工具:

  • 工具名称: current_time
  • 参数:

- timezone (可选):时区(例如Asia/Seoul、America/New_York、Europe/London) - 如果不指定时区,则使用韩国时区(Asia/Seoul)。

2.计算器工具

用于对两个数字执行四则运算的工具:

  • 工具名称: calculator
  • 参数:

- num1:第一个数字 - num2:第二个数字 - operation: 연산자 (加、减、乘、除)

3.问候语工具

提供多种语言的问候语的工具:

  • 工具名称: greeting
  • 参数:

- name:用户名 - language: 인사말을 할 언어 (韩语、英语、日语、中文、西班牙语、法语、德语、意大利语、葡萄牙语、俄语)

4.代码审查工具

生成代码详细评论提示的工具:

  • 工具名称: code_review
  • 参数:

- code:要查看的代码 - language (可选):代码语言(javascript、typescript、python、java、cpp、go、rust) - reviewType (可选):评论类型(completive,security,performance,readability,best_practions)

5.图像生成工具

使用文本提示创建AI图像的工具:

  • 工具名称: generate_image
  • 参数:

- prompt:生成图像的提示

  • 返回类型:base64-encoded PNG图像

使用示例

  1. 韩国时间查询 (默认值):
   현재 시간을 알려줘
  1. 查看特定时间段的时间:
   뉴욕 시간을 알려줘

或者

   Europe/London 시간대의 현재 시간을 알려줘
  1. 使用计算器:
   5 더하기 3은 얼마야?
   10 나누기 2는?
  1. 多语种问候语:
   안녕하세요 라고 인사해줘
   Hello라고 영어로 인사해줘
  1. 代码评论:
   다음 코드를 리뷰해줘: function add(a, b) { return a + b; }
  1. 创建图像:
   고양이가 우주를 여행하는 이미지를 생성해줘

支持的时区示例

  • Asia/Seoul -韩国时区(默认)
  • America/New_York -纽约时间
  • America/Los_Angeles -洛杉矶时间
  • Europe/London -伦敦时间
  • Europe/Paris -巴黎时间
  • Asia/Tokyo -东京时间
  • Asia/Shanghai -上海时间段
  • Australia/Sydney -悉尼时间
💡 提示:支持所有IANA时区。 IANA时区数据库您可以在中查看可用时区列表。

🛠️ 开发指南

添加MCP工具

向MCP服务器添加新工具的步骤 server.tool() 方法 直接使用Zod模式 定义并注册:

import { z } from 'zod'

// 계산기 도구 추가
server.tool(
    'calculator',
    {
        operation: z
            .enum(['add', 'subtract', 'multiply', 'divide'])
            .describe('수행할 연산 (add, subtract, multiply, divide)'),
        a: z.number().describe('첫 번째 숫자'),
        b: z.number().describe('두 번째 숫자')
    },
    async ({ operation, a, b }) => {
        // 연산 수행
        let result: number
        switch (operation) {
            case 'add':
                result = a + b
                break
            case 'subtract':
                result = a - b
                break
            case 'multiply':
                result = a * b
                break
            case 'divide':
                if (b === 0) throw new Error('0으로 나눌 수 없습니다')
                result = a / b
                break
            default:
                throw new Error('지원하지 않는 연산입니다')
        }

        const operationSymbols = {
            add: '+',
            subtract: '-',
            multiply: '×',
            divide: '÷'
        } as const

        const operationSymbol =
            operationSymbols[operation as keyof typeof operationSymbols]

        return {
            content: [
                {
                    type: 'text',
                    text: `${a} ${operationSymbol} ${b} = ${result}`
                }
            ]
        }
    }
)

更复杂的工具示例

// 날씨 정보 조회 도구
server.tool(
    'get_weather',
    {
        city: z.string().describe('날씨를 조회할 도시명'),
        unit: z
            .enum(['celsius', 'fahrenheit'])
            .optional()
            .default('celsius')
            .describe('온도 단위 (기본값: celsius)')
    },
    async ({ city, unit }) => {
        try {
            // 실제 날씨 API 호출 로직 (예시)
            const weatherData = await fetchWeatherData(city, unit)

            return {
                content: [
                    {
                        type: 'text',
                        text: `${city}의 현재 날씨:
온도: ${weatherData.temperature}°${unit === 'celsius' ? 'C' : 'F'}
날씨: ${weatherData.condition}
습도: ${weatherData.humidity}%
풍속: ${weatherData.windSpeed}km/h`
                    }
                ]
            }
        } catch (error) {
            throw new Error(
                `날씨 정보를 가져올 수 없습니다: ${(error as Error).message}`
            )
        }
    }
)

// 도우미 함수
async function fetchWeatherData(city: string, unit: string) {
    // 실제 날씨 API 호출 구현
    // 여기서는 예시 데이터 반환
    return {
        temperature: unit === 'celsius' ? 22 : 72,
        condition: '맑음',
        humidity: 65,
        windSpeed: 12
    }
}

添加资源

您可以向MCP服务器添加资源,以提供对外部数据或文件的访问:

// 리소스 등록
server.resource(
    'example-file',
    'file://example.txt',
    {
        name: '예시 텍스트 파일',
        description: '예시 텍스트 파일 설명',
        mimeType: 'text/plain'
    },
    async () => {
        return {
            contents: [
                {
                    uri: 'file://example.txt',
                    mimeType: 'text/plain',
                    text: '예시 파일 내용입니다.'
                }
            ]
        }
    }
)

// 동적 리소스 예시
server.resource(
    'app-settings',
    'config://settings',
    {
        name: '애플리케이션 설정',
        description: '애플리케이션의 현재 설정 정보',
        mimeType: 'application/json'
    },
    async () => {
        const settings = {
            theme: 'dark',
            language: 'ko-KR',
            notifications: true,
            lastUpdated: new Date().toISOString()
        }

        return {
            contents: [
                {
                    uri: 'config://settings',
                    mimeType: 'application/json',
                    text: JSON.stringify(settings, null, 2)
                }
            ]
        }
    }
)

📦 主要依赖性

  • @模型上下文协议/sdk:实现MCP协议的官方SDK
  • @拥抱脸/推理:Hugging Face Inference API客户端(用于生成图像)
  • 黄道带:TypeScript优先模式验证库
  • 打字稿:TypeScript编译器

🔧 脚本

  • npm run build:将TypeScript编译为JavaScript并设置执行权限

📋 使用示例

使用时间查询工具

// 한국 시간 조회 (기본값)
const koreanTime = await getCurrentTime() // "2024-01-15 14:30:25 (Asia/Seoul)"

// 뉴욕 시간 조회
const newYorkTime = await getCurrentTime('America/New_York') // "2024-01-15 00:30:25 (America/New_York)"

// 런던 시간 조회
const londonTime = await getCurrentTime('Europe/London') // "2024-01-15 05:30:25 (Europe/London)"

完整的服务器示例

import { Server } from '@modelcontextprotocol/sdk/server/index.js'
import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js'
import { CallToolRequestSchema, ListToolsRequestSchema } from '@modelcontextprotocol/sdk/types.js'
import { z } from 'zod'

// 시간 도구 스키마
const TimeToolSchema = z.object({
    timezone: z.string().optional().describe('시간대 (예: Asia/Seoul, America/New_York)')
})

// 현재 시간 조회 함수
const getCurrentTime = (timezone: string = 'Asia/Seoul'): string => {
    const now = new Date()
    const options: Intl.DateTimeFormatOptions = {
        timeZone: timezone,
        year: 'numeric',
        month: '2-digit',
        day: '2-digit',
        hour: '2-digit',
        minute: '2-digit',
        second: '2-digit',
        hour12: false
    }
    
    const formatter = new Intl.DateTimeFormat('ko-KR', options)
    const timeString = formatter.format(now)
    
    return `${timeString} (${timezone})`
}

// 서버 생성
const server = new Server(
    {
        name: 'time-mcp-server',
        version: '1.0.0',
    },
    {
        capabilities: {
            tools: {},
        },
    }
)

// 도구 등록
server.setRequestHandler(ListToolsRequestSchema, async () => {
    return {
        tools: [
            {
                name: 'current_time',
                description: '현재 시간을 지정된 시간대에서 조회하는 도구',
                inputSchema: {
                    type: 'object',
                    properties: {
                        timezone: {
                            type: 'string',
                            description: '시간대 (예: Asia/Seoul, America/New_York)'
                        }
                    },
                    required: []
                }
            }
        ]
    }
})

// 도구 호출 처리
server.setRequestHandler(CallToolRequestSchema, async (request) => {
    if (request.params.name === 'current_time') {
        const { timezone } = TimeToolSchema.parse(request.params.arguments)
        const currentTime = getCurrentTime(timezone)
        
        return {
            content: [
                {
                    type: 'text',
                    text: `현재 시간: ${currentTime}`
                }
            ]
        }
    }
    
    throw new Error(`알 수 없는 도구: ${request.params.name}`)
})

// 서버 시작
async function main() {
    const transport = new StdioServerTransport()
    await server.connect(transport)
    console.error('Time MCP Server started')
}

main().catch(console.error)

🔧 Cursor MCP连接

可以在Cursor上测试开发的MCP服务器:

修改配置文件

./.cursor/mcp.json 编辑文件:

{
    "mcpServers": {
        "typescript-mcp-server": {
            "command": "node",
            "args": ["/ABSOLUTE/PATH/TO/YOUR/PROJECT/build/index.js"]
        }
    }
}
注意:必须使用绝对路径。 pwd 请使用命令检查当前路径。

测试命令

您可以在Cursor MCP中进行以下测试:

  • “告诉我现在的时间”(韩国时间查询)
  • “告诉我纽约时间”(纽约时间查询)
  • “告诉我欧洲/伦敦时间段的当前时间”(伦敦时间查询)
  • “5加3是多少?”(测试计算器工具)
  • “打个招呼说你好”(人事工具测试)
  • “请评论以下代码:function add(a,b){return a+b;}”(测试代码评论)
  • “请生成猫在宇宙中旅行的图像”(图像生成测试)

🔗 参考资料

📄 许可证

麻省理工学院

目录标签

目录标签

代码审查JavaScriptCursor时间查询本地部署计算器多语言支持图像生成MCP协议

支持客户端

Cursor

接入字段

传输方式(transport,传输协议)

未说明

鉴权方式(authType,认证方式)

none

部署方式(deploymentType,部署类型)

remote-capable

工具数量(toolCount,工具数)

5

资源数量(resourceCount,资源数)

0

提示词数量(promptCount,提示词数)

0

权限和风险

未说明noneremote-capable

接入前请确认传输方式、认证方式和部署位置,并根据实际工具能力限制访问范围。

安装前确认

不要直接授予不必要的文件、网络或账号权限;先核对安装命令和配置内容。

仍需确认:installCommand

来源信息

继续浏览同类 MCP