Token导航 LogoToken导航TokenDH.com
Ts Demo MCP logo
AI代理未说明官方级别未说明来源级核验

Ts Demo MCP

MCP Server

MCP Server Template for Bun Developers

工具数

0

提示词数

0

GitHub Stars

0

资源数

0
服务器开发TypeScriptClaude工具集成Claude DesktopClaude

安装说明

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

作者 / 组织

gedankrayze

提供方

gedankrayze

最后核验

2026/5/18 02:18

快速接入

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

详细介绍

TypeScript MCP演示服务器

使用TypeScript SDK和Bun运行时的基本模型上下文协议(MCP)服务器实现。

概述

本项目演示了如何使用TypeScript构建MCP服务器,其特点是:

  • 使用stdio传输进行服务器初始化
  • 工具登记和处理
  • TypeScript类型安全
  • Bun运行时实现快速执行

先决条件

  • 包子 (最新版本)
  • 任务 (可选,用于任务运行器)

安装

# Clone the repository
git clone https://github.com/gedankrayze/ts-demo-mcp.git
cd ts-demo-mcp

# Install dependencies
bun install

项目结构

ts-demo-mcp/
├── src/
│   └── index.ts        # Main MCP server implementation
├── package.json        # Project dependencies and scripts
├── tsconfig.json       # TypeScript configuration
├── Taskfile.yaml       # Task runner configuration
└── README.md          # This file

可用工具

服务器实现了两个示例工具:

1. greet

用用户的名字问候他们。

输入架构:

{
  "name": "string"  // Required: The name of the person to greet
}

示例响应:

Hello, John! Welcome to the TypeScript MCP demo server.

2. add_numbers

将两个数字相加。

输入架构:

{
  "a": "number",  // Required: The first number
  "b": "number"   // Required: The second number
}

示例响应:

The sum of 5 and 3 is 8.

用法

使用npm/bun脚本

# Start the MCP server
bun start

# Run TypeScript type checking
bun typecheck

使用任务运行器

# Start the MCP server
task start

# Inspect server capabilities with MCP inspector
task inspect-server

# Send a raw initialization request
task inspect

与Claude Desktop集成

要将此服务器与Claude Desktop一起使用,请将以下内容添加到您的Claude Desktop配置中:

{
  "mcpServers": {
    "ts-demo-mcp": {
      "command": "bun",
      "args": ["run", "/path/to/ts-demo-mcp/src/index.ts"]
    }
  }
}

发展

添加新工具

要向服务器添加新工具,请执行以下操作:

  1. 更新中的工具列表 ListToolsRequestSchema 处理器
  2. 在中添加工具实现 CallToolRequestSchema 处理器

例子:

// In ListToolsRequestSchema handler
{
  name: "my_tool",
  description: "Description of what the tool does",
  inputSchema: {
    type: "object",
    properties: {
      param1: { type: "string", description: "Parameter description" }
    },
    required: ["param1"]
  }
}

// In CallToolRequestSchema handler
case "my_tool": {
  const param1 = request.params.arguments?.param1 as string;
  return {
    content: [{
      type: "text",
      text: `Tool output for ${param1}`
    }]
  };
}

类型检查

该项目使用启用严格模式的TypeScript。运行类型检查:

bun typecheck

MCP检查员

该项目包括用于调试的MCP检查员。使用它来探索服务器功能:

task inspect-server

这将启动一个交互式web界面来测试您的MCP服务器。

许可证

该项目已公开,可在 .

资源

目录标签

目录标签

服务器开发TypeScriptClaude工具集成developer-toolsmcpmcp-serverMCP协议本地部署Bun运行时

支持客户端

Claude DesktopClaude

接入字段

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

未说明

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

none

工具数量(toolCount,工具数)

0

资源数量(resourceCount,资源数)

0

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

0

权限和风险

未说明none部署方式未说明

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

安装前确认

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

仍需确认:installCommand

来源信息

继续浏览同类 MCP