Token导航 LogoToken导航TokenDH.com
AI Chatbot logo
数据服务stdio官方级别未说明来源级核验

AI Chatbot

MCP Server

SmartWeld AI是一个基于Model Context Protocol (MCP)的物联网数据智能平台,通过自然语言交互和AI技术将焊接数据转化为可操作的洞察。

工具数

2

提示词数

0

GitHub Stars

0

资源数

0
物联网JavaScriptClaude人工智能Claude

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

作者 / 组织

Pankaj89Acharjee

提供方

Pankaj89Acharjee

最后核验

2026/5/17 20:20

运行时

Docker

快速接入

先看主来源和安装命令,再打开仓库或文档;下面只保留这个条目的关键接入事实。

命令预览

docker run -d \

详细介绍

SmartWeld AI-基于MCP的物联网数据智能平台

🤖 一种先进的人工智能驱动系统,使用模型上下文协议(MCP)、LangChain和会话式人工智能将物联网焊接数据转化为可操作的见解。

](https://nodejs.org/) ![TypeScript](https://www.typescriptlang.org/) ![React](https://reactjs.org/) ![PostgreSQL](https://www.postgresql.org/) ![License: MIT](https://opensource.org/licenses/MIT)

🌟 概述

SmartWeld AI是一个完整的物联网数据智能平台,可以与工业焊接数据进行自然语言交互。建立在 模型上下文协议(MCP),它提供:

  • 🗣️ 对话式AI界面 -用自然语言与您的数据聊天
  • 🔧 MCP电动工具 -可扩展的数据访问工具生态系统
  • 📊 动态可视化 -自动生成的图表和见解
  • 🏭 物联网集成 -实时MQTT数据处理
  • 🧠 智能分析 -LLM动力数据解释

🏗️ 建筑

┌─────────────────────────────────────────────────────────────────┐
│                    SmartWeld AI Platform                        │
├─────────────────┬─────────────────┬─────────────────────────────┤
│   Frontend      │  Agentic AI     │       MCP Server            │
│   (React)       │   Server        │      (Tools)                │
│                 │  (LangChain)    │                             │
│  ┌─────────────┐│ ┌─────────────┐ │ ┌─────────────────────────┐ │
│  │ Chat UI     ││ │ Conversational│ │ │ Database Tools          │ │
│  │ Components  ││ │ Agent         │ │ │ - LangChain SQL Agent   │ │
│  │ Visualizations││ │ GPT-4 LLM   │ │ │ - Schema Discovery      │ │
│  │ Dashboard   ││ │ Tool Calling  │ │ │ - Query Execution       │ │
│  └─────────────┘│ └─────────────┘ │ └─────────────────────────┘ │
│                 │                 │ ┌─────────────────────────┐ │
│                 │                 │ │ Weather Tools           │ │
│                 │                 │ │ - Forecast API          │ │
│                 │                 │ │ - Alerts Integration    │ │
│                 │                 │ └─────────────────────────┘ │
└─────────────────┴─────────────────┴─────────────────────────────┘
          │                   │                         │
          ▼                   ▼                         ▼
┌─────────────────┐  ┌─────────────────┐    ┌─────────────────┐
│   User Input    │  │  LLM Processing │    │  Data Sources   │
│   Natural Lang  │  │  Tool Selection │    │  PostgreSQL     │
│   Voice/Text    │  │  Response Gen   │    │  Weather APIs   │
└─────────────────┘  └─────────────────┘    └─────────────────┘

🚀 快速开始

先决条件

  • Node.js v18+和npm
  • PostgreSQL v13+数据库
  • OpenAI API密钥 (用于GPT-4接入)
  • Git 用于版本控制

1.克隆存储库

git clone 
cd SmartWeld-MCP-AI

2.环境设置

为每个组件创建环境文件:

MCP服务器 (.env 在……里面 mcp-server-stdio/)

# Database Configuration
DB_HOST=localhost
DB_PORT=5432
DB_NAME=smartweld
DB_USER=your_db_user
DB_PASSWORD=your_db_password
DB_SCHEMA=public

# AI Configuration
OPENAI_API_KEY=sk-your-openai-api-key

# Server Configuration
NODE_ENV=development

代理服务器 (.env 在……里面 agentic-server/)

# Server Configuration
NODE_ENV=development
PORT=5001
CORS_ORIGIN=http://localhost:3000

# Database Configuration
DB_HOST=localhost
DB_PORT=5432
DB_NAME=smartweld
DB_USER=your_db_user
DB_PASSWORD=your_db_password
DB_SCHEMA=public

# AI Configuration
OPENAI_API_KEY=sk-your-openai-api-key
LLM_MODEL=gpt-4o

# Optional: Additional LLM Providers
GEMINI_API_KEY=your-gemini-api-key
ANTHROPIC_API_KEY=your-anthropic-api-key

# Security
JWT_SECRET=your-super-secret-jwt-key
ALLOWED_ORIGINS=http://localhost:3000,https://yourdomain.com

# Monitoring & Logging
LOG_LEVEL=info
MONITORING_ENABLED=true

反应前端 (.env 在……里面 ai-chatbot-smartweld/)

# API Configuration
REACT_APP_API_URL=http://localhost:5001
NODE_ENV=development

# Optional: Authentication
REACT_APP_AUTH_ENABLED=false

3.数据库设置

-- Create database
CREATE DATABASE smartweld;

-- Create user (optional)
CREATE USER smartweld_user WITH PASSWORD 'your_secure_password';
GRANT ALL PRIVILEGES ON DATABASE smartweld TO smartweld_user;

-- Connect to database and create sample tables
\c smartweld;

CREATE TABLE device_telemetry (
    id SERIAL PRIMARY KEY,
    device_id VARCHAR(50),
    temperature DECIMAL(5,2),
    voltage DECIMAL(5,2),
    current DECIMAL(5,2),
    gas_level DECIMAL(5,2),
    timestamp TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);

-- Insert sample data
INSERT INTO device_telemetry (device_id, temperature, voltage, current, gas_level) VALUES
('WELD001', 750.5, 220.0, 15.2, 85.5),
('WELD002', 680.3, 210.5, 12.8, 78.2),
('WELD003', 820.1, 230.2, 18.5, 92.1);

4.安装与启动

终端1:MCP服务器

cd mcp-server-stdio
npm install
npm run build
npm start

终端2:代理AI服务器

cd agentic-server
npm install
npm run dev

终端3:反应前端

cd ai-chatbot-smartweld
npm install
npm start

5.验证安装

  1. 检查MCP服务器:应显示“MCP正在stdio上运行”
  2. 检查AI服务器:参观 http://localhost:5001/health
  3. 检查前端:参观 http://localhost:3000

📁 项目结构

SmartWeld-MCP-AI/
├── mcp-server-stdio/          # MCP Protocol Server
│   ├── src/
│   │   ├── tools/             # MCP Tools Implementation
│   │   │   ├── databaseTools/ # Database query tools
│   │   │   └── weatherForecastTool/ # Weather API tools
│   │   ├── config/            # Database & connection config
│   │   ├── interfaces/        # TypeScript interfaces
│   │   └── index.ts           # MCP server entry point
│   ├── build/                 # Compiled JavaScript
│   └── package.json
│
├── agentic-server/            # AI Agent Server
│   ├── src/
│   │   ├── agents/            # AI agent implementations
│   │   │   ├── conversational-agent.ts # Main chat agent
│   │   │   ├── sql-toolkit.ts # Database analysis tools
│   │   │   └── rag-retriever.ts # RAG for documents
│   │   ├── mcp/               # MCP client integration
│   │   │   ├── mcpClient.ts   # MCP connection client
│   │   │   └── mcpToolWrapper.ts # Tool wrapper utilities
│   │   ├── config/            # Database & app configuration
│   │   ├── models/            # Data models
│   │   └── index.ts           # Express server entry point
│   └── package.json
│
├── ai-chatbot-smartweld/      # React Frontend
│   ├── src/
│   │   ├── components/        # React components
│   │   │   ├── Chat.jsx       # Main chat interface
│   │   │   └── chatbotComponents/ # Visualization components
│   │   ├── chatbotAPICalls/   # API integration
│   │   ├── contexts/          # React contexts
│   │   └── pages/             # Application pages
│   ├── public/
│   └── package.json
│
├── README.md                  # This file
└── blog-post-mcp-smartweld.md # Technical blog post

🔧 配置指南

数据库配置

系统支持多种数据库配置:

// Production configuration
export const dbConfig = {
  host: process.env.DB_HOST,
  port: parseInt(process.env.DB_PORT || '5432'),
  database: process.env.DB_NAME,
  username: process.env.DB_USER,
  password: process.env.DB_PASSWORD,
  schema: process.env.DB_SCHEMA || 'public',
  ssl: process.env.NODE_ENV === 'production'
};

MCP工具配置

通过实现MCP工具接口添加新工具:

export const customTool: Tool = {
  name: "custom-tool",
  description: "Description of what the tool does",
  inputSchema: {
    type: "object",
    properties: {
      query: { type: "string" }
    }
  },
  async execute(input: Record) {
    // Tool implementation
    return { content: "Tool result" };
  }
};

AI模型配置

支持多个LLM提供商:

// OpenAI (recommended)
const openaiModel = new ChatOpenAI({
  model: "gpt-4o",
  apiKey: process.env.OPENAI_API_KEY,
  temperature: 0,
});

// Gemini (alternative)
const geminiModel = new ChatGoogleGenerativeAI({
  model: "gemini-1.5-flash",
  apiKey: process.env.GEMINI_API_KEY,
});

🛠️ 可用命令

MCP服务器命令

npm run build          # Compile TypeScript to JavaScript
npm run build:unix     # Build with Unix permissions
npm run dev            # Development mode with auto-reload
npm start              # Start compiled server

代理服务器命令

npm run start          # Production mode
npm run dev            # Development mode with nodemon
npm test               # Run tests (if configured)

前端命令

npm start              # Development server
npm run build          # Production build
npm test               # Run test suite
npm run eject          # Eject from Create React App

🔐 安全和凭据管理

环境变量安全

  • 永不承诺 .env 文件 到版本控制
  • 使用不同的凭据进行开发和生产
  • 定期旋转API键
  • 使用强大、唯一的密码访问数据库

API密钥管理

# Secure storage of API keys
export OPENAI_API_KEY="sk-your-key-here"
export GEMINI_API_KEY="your-gemini-key"

# Or use a secure key management service
# AWS Secrets Manager, Azure Key Vault, etc.

数据库安全性

-- Create dedicated user with limited permissions
CREATE USER smartweld_app WITH PASSWORD 'secure_random_password';
GRANT SELECT, INSERT, UPDATE ON ALL TABLES IN SCHEMA public TO smartweld_app;
GRANT USAGE ON ALL SEQUENCES IN SCHEMA public TO smartweld_app;

🚀 部署

生产部署检查表

  1. 环境设置

- \[\]设置 NODE_ENV=production - \[\]配置生产数据库 - \[\]设置安全的CORS源 - \[\]启用HTTPS

  1. 数据库迁移
   # Run migrations
   npm run migrate:up

   # Seed initial data
   npm run seed:production
  1. 服务器部署
   # Build all components
   cd mcp-server-stdio && npm run build
   cd ../agentic-server && npm run build
   cd ../ai-chatbot-smartweld && npm run build

   # Start with process manager
   pm2 start ecosystem.config.js
  1. Docker部署 (可选)
   # Build Docker image
   docker build -t smartweld-ai .

   # Run with environment variables
   docker run -d \
     --name smartweld-ai \
     -p 5001:5001 \
     -e OPENAI_API_KEY=your-key \
     -e DB_HOST=your-db-host \
     smartweld-ai

生产环境变量

# Production specific
NODE_ENV=production
PORT=5001
CORS_ORIGIN=https://your-domain.com

# Database (use connection pooling)
DB_MAX_CONNECTIONS=20
DB_IDLE_TIMEOUT=30000

# Security
JWT_SECRET=super-secure-64-character-random-string
RATE_LIMIT_WINDOW_MS=900000
RATE_LIMIT_MAX_REQUESTS=100

# Monitoring
LOG_LEVEL=warn
MONITORING_ENABLED=true
METRICS_PORT=9090

🐛 故障排除

常见问题

1.MCP连接失败

# Check if MCP server is running
ps aux | grep "mcp-server"

# Check logs
tail -f mcp-server-stdio/logs/server.log

# Test connection manually
node -e "
const { connectToMcpServer } = require('./agentic-server/src/mcp/mcpClient');
connectToMcpServer('./mcp-server-stdio/build/index.js').then(console.log);
"

2.数据库连接问题

# Test database connectivity
psql -h localhost -U smartweld_user -d smartweld -c "SELECT 1"

# Check connection string
echo $DATABASE_URL

# Verify credentials
npm run db:test

3.OpenAI API错误

# Verify API key format
echo $OPENAI_API_KEY | grep "^sk-"

# Test API connectivity
curl -H "Authorization: Bearer $OPENAI_API_KEY" \
     "https://api.openai.com/v1/models"

# Check rate limits
npm run ai:test

4.前端API连接

// Test API endpoint
fetch('http://localhost:5001/health')
  .then(r => r.json())
  .then(console.log);

// Check CORS configuration
console.log('API URL:', process.env.REACT_APP_API_URL);

调试模式

启用调试日志记录:

# In .env files
DEBUG=true
LOG_LEVEL=debug
VERBOSE_LOGGING=true

查看调试信息:

# MCP Server debug
DEBUG=mcp* npm start

# AI Server debug
DEBUG=agent* npm run dev

# Frontend debug
REACT_APP_DEBUG=true npm start

📊 监测和可观察性

健康检查

# Check all services
curl http://localhost:5001/health
curl http://localhost:3000/health

度量与记录

// Built-in metrics endpoint
GET /metrics  // Prometheus format
GET /status   // System status

性能监控

# Database query performance
npm run db:analyze

# LLM response times
npm run ai:benchmark

# Frontend bundle analysis
npm run analyze

🤝 贡献

开发工作流程

  1. 分叉与克隆
   git clone 
   cd SmartWeld-MCP-AI
  1. 创建特征分支
   git checkout -b feature/your-feature-name
  1. 开发设置
   # Install dependencies for all components
   npm run install:all

   # Start development environment
   npm run dev:all
  1. 代码规范
   # Lint code
   npm run lint

   # Format code
   npm run format

   # Run tests
   npm run test:all
  1. 提交更改
   git add .
   git commit -m "feat: add your feature description"
   git push origin feature/your-feature-name

代码风格指南

  • TypeScript:严格模式已启用
  • 掉毛:带Prettier的ESLint
  • 命名:camelCase用于变量,PasclCase用于组件
  • 承诺:常规提交格式

📚 额外资源

文档

社区

相关项目

📄 许可证

此项目根据MIT许可证获得许可-请参阅 许可证 文件以获取详细信息。

👥 作者与致谢

  • 开发团队:SmartWeld人工智能团队
  • 特别感谢:Anthropic(MCP)、LangChain、OpenAI社区
  • 灵感:工业物联网和人工智能民主化

______________________________________________________________________

🆘 支持

有问题吗?我们是来帮忙的!

  • 📧 电子邮件: \[your-email@domain.com\]
  • 💬 Discord 的中文翻译是“不和谐”或“纷争”。:\[您的Discord服务器\]
  • 🐛 问题:
  • 📖 维基: 维基工程

______________________________________________________________________

*内置于❤️ 面向智能制造的未来*

目录标签

目录标签

物联网JavaScriptClaude人工智能本地部署数据分析自然语言处理工业4.0

支持客户端

Claude

接入字段

传输方式(transport,传输协议)

stdio

鉴权方式(authType,认证方式)

api-key

运行时(runtime,运行环境)

Docker

工具数量(toolCount,工具数)

2

资源数量(resourceCount,资源数)

0

提示词数量(promptCount,提示词数)

0

权限和风险

stdioapi-key部署方式未说明

接入前请确认传输方式、认证方式和部署位置,并根据实际工具能力限制访问范围。

安装前确认

不要直接授予不必要的文件、网络或账号权限;先核对安装命令和配置内容。

来源信息

继续浏览同类 MCP