BON Calculadora MCP服务器🌤️
    
用于的生产就绪模型上下文协议(MCP)服务器。..
https://www.navarra.es/es/tramites/on/-/line/ayudas-a-personas-trabajadoras-en-excedencia-para-cuidado-de-familiares
当带有小型模型的RAG系统无法达到我们的期望时,我们会怎么做?放弃?花更多的钱?或者寻找基于代理的有效替代方案?来到这个会议上,我们将看到如何与代理(称为堆栈)一起解决Red Hat AI上看似简单但RAG无法自行解决的问题。
我们将从一个原则上微不足道的案例开始,但RAG并不能解决这个问题,因为它需要一个非常“聪明”的LLM,因此非常昂贵。有了Red Hat AI,我们将看到如何通过应用分而治之的原则来解决这个问题。为此,我们将探索一种基于Red Hat AI上的火焰堆栈的解决方案,其中问题分为相关信息检索(RAG)、理解自然语言(LLM)的能力,最后是复杂计算和访问外部系统(Agent)的能力。在会议结束时,您将了解代理解决的问题、幕后协议(MCP)、如何在这种类型的项目中工作、Red Hat AI上的代理架构以及如何在Red Hat OpenShift上高效部署它。
🚀 特性
全部
- 实时BON Calculadora数据:获取当前bon calculadora状况和预测
- BON 计算器 警报:接收美国各州的bon calculadora警报
- MCP兼容:按照官方指南实现完整的模型上下文协议
- 生产就绪:多阶段构建的容器支持
- 超越克劳德桌面:基本教程之外的扩展部署选项
- 开发者友好:带有全面工具的TypeScript
- 多个传输:通过超级网关支持Stdio、SSE和HTTP
- DXT软件包支持:生成部署包,以便轻松集成Claude Desktop
🎯 关于本项目
这个项目始于 官方MCP服务器快速入门指南 并扩展了生产级功能:
- 企业部署:使用Red Hat UBI映像进行容器化
- 生产建筑:通过适当的依赖关系管理优化构建
- DXT包装:Claude Desktop的简化部署包
- 多个传输:超越stdio,包括web界面
- CI/CD就绪:GitHub操作和容器注册表集成
- 开发工具:增强调试和测试能力
如果您遵循官方的MCP指南,此存储库将向您展示如何将bon calculadora服务器投入生产。
📦 安装
先决条件
- Node.js 20+与npm
- TypeScript 5.x
- Docker/Podman(用于容器化部署)
地方发展
# Clone the repository
git clone https://github.com/alpha-hack-program/bon-calculadora-mcp-js.git
cd bon-calculadora-mcp-js
# Install dependencies
make install
# Build the project
make build
# Test the server
make test-stdio与Claude Desktop一起使用
方法1:使用DXT软件包快速设置(推荐)
创建部署包以轻松集成Claude Desktop:
# Create a DXT deployment package
make pack这创建了一个 bon-calculadora-mcp.dxt 文件包含:
- 编译的JavaScript代码
- 仅生产依赖关系
- 即用型配置
- 安装说明
要安装DXT软件包,请执行以下操作:
全部
🛠️ 用法
全部
可用工具
气象MCP服务器提供以下工具:
get_forecast
获取特定位置的天气预报。
{
"name": "get_forecast",
"arguments": {
"latitude": 40.7128,
"longitude": -74.0060
}
}get_alerts
获取美国某个州的天气警报。
{
"name": "get_alerts",
"arguments": {
"state": "CA"
}
}MCP检验员测试
# Start the MCP Inspector for interactive testing
make test-inspector
# Or test the stdio transport directly
make test-stdio检查员将打开一个web界面 http://localhost:5173 您可以在其中与服务器进行交互。
🐳 容器部署
构建容器图像
# Make the image script executable
chmod +x image.sh
# Build the container image
./image.sh build
# Push to registry
./image.sh push
# Run locally
./image.sh run
# Run from remote registry
./image.sh run-remote环境配置
容器构建使用来自的环境变量 .env:
# Container configuration
BASE_TAG="9.6"
BASE_IMAGE="registry.access.redhat.com/ubi9/nodejs-22-minimal"
CACHE_FLAG=""
# Registry settings
ORG=atarazana
REGISTRY=quay.io/${ORG}
# Application
APP_NAME=weather-mcp容器使用情况
# Run with Docker/Podman
docker run -it quay.io/atarazana/weather-mcp:latest
# Or with supergateway for web access
docker run -p 3000:3000 -it quay.io/atarazana/weather-mcp:latest🧪 发展
项目结构
weather-mcp-js/
├── src/
│ └── index.ts # Main server implementation
├── build/ # Compiled JavaScript output
├── Containerfile # Container build definition
├── image.sh # Container management script
├── tsconfig.json # TypeScript configuration
├── package.json # Node.js dependencies and scripts
├── Makefile # Build automation
└── .env # Environment configuration可用生成目标
# Development
make install # Install dependencies
make build # Build TypeScript
make clean # Clean build artifacts
# Testing
make test-stdio # Test stdio transport
make test-inspector # Test with MCP Inspector
make test-sse # Test SSE transport
# Production
make pack # Create DXT deployment package
make build-prod # Production build only
# Container Management
make docker-build # Build container image
make docker-push # Push to registry
make docker-run # Run container locally
make docker-clean # Clean up containers构建自动化
该项目使用Make实现一致的构建自动化,遵循企业实践:
# Quick development cycle
make clean build test-stdio
# Production deployment
make pack
# Container workflow
make docker-build docker-push🔧 配置
环境变量
NODE_ENV:设置为production用于生产建设LOG_LEVEL:日志记录级别(debug,info,warn,error)
TypeScript配置
该项目使用带有ES模块的现代TypeScript:
{
"compilerOptions": {
"target": "ES2022",
"module": "Node16",
"moduleResolution": "Node16",
"outDir": "./build",
"rootDir": "./src",
"strict": true
}
}🚀 部署选项
1.DXT包部署(建议用于Claude Desktop)
部署Claude Desktop的最简单方法:
# Create deployment package
make pack
# This generates weather-mcp.dxt containing:
# - Compiled JavaScript
# - Production dependencies
# - Installation instructions在Claude Desktop中提取和配置:
tar -xzf weather-mcp.dxt
# Then update claude_desktop_config.json with the extracted path2.直接部署Node.js
对于开发或自定义部署:
# Production build
make build-prod
# Run directly
node build/index.js3.集装箱部署
企业容器部署:
# Build and run container
make docker-build
make docker-run4.带有超级网关的Web界面
超越官方MCP指南-通过HTTP/SSE服务:
# Install supergateway globally
npm install -g supergateway
# Build and serve with web interface
make build
supergateway --stdio "node build/index.js"这使得基于web的交互和测试超越了Claude Desktop集成。
📚 api参考
MCP协议
此服务器实现了模型上下文协议规范:
- 初始化:建立联系和能力
- 工具:提供与天气相关的工具
- 工具调用:执行天气数据请求
工具架构
所有工具都使用JSON Schema进行输入验证:
// Forecast tool schema
{
type: "object",
properties: {
latitude: { type: "number", minimum: -90, maximum: 90 },
longitude: { type: "number", minimum: -180, maximum: 180 }
},
required: ["latitude", "longitude"]
}
// Alerts tool schema
{
type: "object",
properties: {
state: { type: "string", minLength: 2, maxLength: 2 }
},
required: ["state"]
}🤝 贡献
我们欢迎捐款!该项目扩展了 MCP官方快速入门指南 具有生产特点。
开发设置
- 分叉存储库
- 创建要素分支:
git checkout -b feature/amazing-feature - 进行更改
- 构建和测试:
make clean build test-stdio - 与检验员一起测试:
make test-inspector - 创建部署包:
make pack - 提交您的更改:
git commit -m 'Add amazing feature' - 推到分支:
git push origin feature/amazing-feature - 打开拉取请求
代码的风格
- 跟随 MCP官方指南 模式
- 使用TypeScript严格模式
- 遵循ESLint配置
- 为公共API添加JSDoc注释
- 写有意义的提交消息
- 测试stdio和web传输
📄 许可证
此项目根据MIT许可证获得许可-请参阅 许可证 文件以获取详细信息。
🙏 致谢
- 模型上下文协议 获取官方规范和快速入门指南
- MCP服务器快速启动 -这个项目的基础
- Anthropic 用于Claude Desktop集成和MCP开发
- 阿尔法黑客程序 用于支持生产级MCP实施
📞 支持
- 问题:
- 讨论:
- MCP官方指南: MCP服务器快速启动
- MCP文件: 模型上下文协议文档
🔄 更新日志
看 更改日志.md 查看版本历史和更新。
______________________________________________________________________
Built with ❤️ extending the official MCP guide for production use
From tutorial to production-ready deployment
