🧠 北风mcp层
一个轻量级的基于Go的模型上下文协议(MCP)服务器,设计用于在VS Code中本地运行,将GitHub Copilot Chat与实时聊天连接起来 northwind-api. 它将所有Northwind业务端点作为结构化MCP工具公开,支持实时数据的自然语言查询。
用法
- 在VS代码中打开\
打开 northwind-mcp-layer VS Code中的项目。
- 启动本地MCP服务器\
使用中的配置启动MCP服务器 .vscode/mcp.json.\ 这将自动启动Gin HTTP服务器并公开MCP工具。
- 配置GitHub Copilot聊天\
在GitHub Copilot Chat中,通过指向中定义的本地服务器来加载MCP工具 mcp.json.
- 查询Northwind数据\
在Copilot Chat中使用自然语言提示与实时Northwind端点进行交互,例如:
- Provide details on customers from Germany. - What's the inventory status of products that need reordering?
备注
- 这
northwind-api后端作为免费层Render web服务托管。最初访问时可能需要几秒钟才能启动。 - 根据我的经验,Claude模型在与此MCP层交互时往往效果最佳。
架构概述
northwind-mcp-layer/
├── cmd/
│ └── mcp/ # Application entrypoint (starts the MCP Gin HTTP server)
├── internal/
│ └── mcp/ # Core MCP logic (request handling, tool routing)
├── go.mod / go.sum # Go module dependencies
├── .vscode/
│ └── mcp.json # MCP server configuration for Github Copilot (auto-loads server, tools, and API base)
└── README.md # Project documentation示例工具
| 工具名称 | 描述 | 示例参数 |
|---|---|---|
get_customers | 从Northwind API检索客户 | country=Germany, city=London |
get_orders | 按客户、员工或年份检索订单 | year=1998, customer_id=ALFKI |
get_sales_by_country | 按国家查看总销售额 | year=1998 |
get_top_customers | 按收入查看顶级客户 | limit=10, country=USA |
每个MCP工具对应于 northwind-api 并且可以通过MCP协议动态地提供给Github Copilot。
示例提示
Provide some details on our customers from Germany.What are our shipping costs for the year 1997?What's the inventory status of our products that need to be reordered?What's the supplier performance of Pavlova, Ltd.?
技术栈
- 语言:Go 1.23+
- 框架:金
- 协议:模型上下文协议(MCP)
- 集成:GitHub Copilot聊天
配套项目
https://github.com/nicholasraynes/northwind-api
- 为该MCP层提供实时数据的REST API后端。使用分析扩展(订单、产品、供应商、KPI)实现Northwind数据集。
