MCP服务器

一个基于TypeScript和@modelcontextprotocol/sdk库实现的简单MCP服务器,提供标准I/O通信功能。

  • by XiaoXiaoXian
  • TypeScript
  • 本地部署
  • 更新于
在 GitHub 查看 xiaoxiaoxian/study-01-mcp-server-typescript

使用说明

Hello World MCP服务器

这个项目是一个使用@modelcontextprotocol/sdk库在TypeScript中实现的简单MCP服务器。

特性

  • 提供“Hello World”工具。
  • 使用标准I/O传输进行通信。

设置

  1. 安装依赖项:

    npm install
    
  2. 构建项目:

    npm run build
    
  3. 运行服务器:

    node build/index.js
    

    或者,直接从TypeScript源代码运行服务器:

    npx ts-node src/index.ts
    

    或

    node  --require ts-node/register src/index.ts
    

    或者运行带有跟踪警告的服务器:

    node --trace-warnings --require ts-node/register src/index.ts
    

    或

    npx tsx src/index.ts
    

## Development
- Source files are located in the `src` directory.
- Build output is located in the `build` directory.

## License
This project is licensed under the ISC License.