taobao-mcp-demo
Version:
淘宝MCP演示服务器 - 提供基础工具和资源
17 lines (16 loc) • 497 B
JavaScript
import { ResourceTemplate } from "@modelcontextprotocol/sdk/server/mcp.js";
// 天气资源
export const weatherResource = {
name: "weather",
template: new ResourceTemplate("weather://{city}", { list: undefined }),
config: {
title: "天气资源",
description: "获取指定城市的天气信息"
},
handler: async (uri, { city }) => ({
contents: [{
uri: uri.href,
text: `当前${city}的天气:晴天,温度25°C,湿度60%`
}]
})
};