带有图像块的MCP服务器示例
概述
一个示例MCP服务器,从 Lorem Picsum API这只是一个示例,说明MCP服务器如何返回图像块。
另请参见: 模型上下文协议规范中的图像内容
用法
与VS代码一起使用
将此添加到您的设置JSON文件中:
{
"mcp": {
"servers": {
"random_image": {
"command": "npx",
"args": [
"-y",
"@larryhudson/mcp-server-example-image-block"
],
}
}
}
}与Claude或其他MCP兼容应用程序一起使用
将以下内容添加到MCP配置JSON文件中:
{
"mcpServers": {
"random_image": {
"command": "npx",
"args": ["-y", "@larryhudson/mcp-server-example-image-block"],
}
}
}可用工具
get_random_image-使用Lorem Picsum API获取随机图像。
技术细节
内置:
- 模型上下文协议(MCP):允许AI助手与外部工具交互的框架
- TypeScript:用于类型安全和更好的开发人员体验
发展
您可以使用模型上下文协议检查器来尝试服务器:
npx @modelcontextprotocol/inspector npx tsx src/index.ts许可证
麻省理工学院
