loading…
Search for a command to run...
loading…
A TypeScript MCP server demo supporting local Stdio and remote Streamable HTTP, demonstrating tool invocation for AI agents.
A TypeScript MCP server demo supporting local Stdio and remote Streamable HTTP, demonstrating tool invocation for AI agents.
@modelcontextprotocol/sdk
express
// node >= 18
// npm 安装
npm install
// 本地stdio调试启动
npm run start
// 本地http调试启动
npm run start-http
// 构建
npm run build
├─dist 构建输出目录
├─src 源码目录
├─config 配置文件
├─utils 工具类
└─server server目录
├─stdio.ts 本地Stdio MCP服务
├─http.ts 远程Http MCP服务
└─http_stateful.ts 远程Http MCP有状态服务
└─index.ts 入口文件
├─.env stdio 环境变量
├─.env.http http 环境变量
├─.env.http.stateful http 有状态环境变量
├─tsconfig.json tsconfig文件
└─package.json package.json文件
npm run start-http命令后,就已经构建了本地stdio文件,及启动了http服务
mcp-ts-stdio-server为stdio服务,mcp-ts-http-server为http服务,注意本地路径args要正确{
"mcpServers": {
"mcp-ts-stdio-server": {
"command": "node",
"args": [
"/Users/zcy/pjqdyd/mcp-ts-demo/dist/index.js"
],
"env": {
"MCP_SERVER_NAME": "mcp-ts-server",
"MCP_SERVER_VERSION": "1.0.0"
}
},
"mcp-ts-http-server": {
"type": "streamable_http",
"url": "http://localhost:3000/mcp"
}
}
}
This project is licensed under the MIT license.
Run in your terminal:
claude mcp add mcp-ts-demo -- npx Security
Low riskAutomated heuristic from public metadata — not a security guarantee.