mcpField
S
Smart MCP Server

Smart MCP Server

本地服务
webduhsign.comAI 与智能体169 周前更新

关于 Smart MCP Server

Smart MCP Server 面向构建 AI 工作流和 Agent 协作的团队,是支持上下文感知的 MCP 与 A2A 服务。它结合工具选择、JSON 工作流、多模型支持和加密令牌管理。

主要功能

  1. 01上下文感知的工具选择
  2. 02加载并执行 JSON 工作流
  3. 03支持 Gemini、OpenAI 和 Anthropic 模型
  4. 04加密令牌生成与刷新
  5. 05MCP 和 A2A 工具发现
  6. 06GitHub、Stripe、健康监控与文档工具

适用场景

  1. 01根据请求和上下文选择相关工具
  2. 02运行并监控已定义的 AI 工作流
  3. 03通过 A2A 协调 Agent 任务
  4. 04管理协议令牌并查看系统健康状态

MCP 相关

它实现 MCP v1.0,并向 MCP 客户端公布可发现和执行的工具。工具涵盖 GitHub、Stripe、系统健康监控和文档处理。

配置

本地服务的配置在各客户端中通用,复制后粘贴到客户端的 MCP 配置文件即可。

暂未收录安装方式

我们还没有获取到这个服务的安装包或远程地址,请按项目 README 中的说明安装。

代码仓库

工具

还没有获取到工具列表

本地服务需要在你的电脑上运行后才能读取工具,维护者暂未提供工具列表。

详细介绍

Smart MCP Server

一款先进、具备上下文感知能力的 Model Context Protocol(MCP)服务,符合 Agent-to-Agent(A2A)协议。具备智能工作流执行、安全令牌管理,以及全面的 AI 模型集成能力,包括 Google 的 Gemini 模型。

License: MIT Node.js Version MCP Compliant A2A Compliant

🌟 主要功能

🔐 安全令牌管理
  • 符合 MCP/A2A 规范的令牌:自动生成和管理符合协议规范的 API 令牌
  • AES-256-CBC 加密:采用行业标准加密技术安全存储令牌
  • 自动刷新:智能令牌验证与刷新机制
  • CLI 管理:通过 CLI 工具轻松生成、验证和监控令牌
🤖 多模型 AI 集成
  • Gemini 模型:全面集成 Google 的 Gemini 2.5 Pro、Gemini Pro 和嵌入模型
  • OpenAI 支持:GPT-4、GPT-3.5 Turbo 和嵌入模型
  • Anthropic 集成:Claude 3 Opus、Sonnet 和 Haiku 模型
  • 模型无关架构:为所有 AI 提供商提供统一接口
🔄 高级工作流系统
  • 动态加载工作流:自动从 JSON 文件加载工作流定义
  • 智能执行:使用 AI 函数调用,实现工作流的最佳选择
  • 进度监控:通过指标和日志实时跟踪执行情况
  • 错误恢复:完善的错误处理和重试机制
🌐 协议合规性
  • MCP v1.0:完整实现 Model Context Protocol
  • A2A v1.0:支持多 Agent 协作的 Agent-to-Agent 协议
  • 工具发现:自动注册工具并公布其能力
  • 安全通信:Agent 间加密通信
🛠️ 全面的工具集
  • GitHub 集成:仓库管理、分析和自动化
  • Stripe 集成:支付处理和订阅管理
  • 系统健康监控:实时系统指标和警报
  • 文档工具:自动整合和管理文档

🚀 快速开始

前提条件
  • Node.js v18.0.0 或更高版本
  • npm v7.0.0 或更高版本
  • Google Gemini API Key(用于 AI 功能)
安装
  1. 克隆仓库:

    git clone https://github.com/reconsumeralization/smart-mcp-server.git
    cd smart-mcp-server
    
  2. 安装依赖:

    npm install
    
  3. 生成符合 MCP/A2A 规范的令牌:

    npm run token:generate
    
  4. 启动服务:

    npm start
    

服务将在端口 3000 上启动(可配置),并全面支持 MCP 和 A2A 协议。

🔑 令牌管理

CLI 命令
# Generate a new MCP/A2A compliant token
npm run token:generate

# Refresh existing token
npm run token:refresh

# Validate current token compliance
npm run token:validate

# Show detailed token information
npm run token:info

# Export token metadata (no sensitive data)
npm run token:export

# Show help
npm run token:help
令牌功能
  • 🛡️ 安全性:采用 AES-256-CBC 加密和安全的密钥管理
  • ✅ 合规性:全面符合 MCP v1.0 和 A2A v1.0 协议
  • 🔄 自动刷新:自动验证和刷新令牌
  • 📊 监控:详细的令牌状态和使用情况跟踪

🏗️ 架构

smart-mcp-server/
├── src/
│   ├── archer/                    # Arrow server for agentic framework
│   ├── lib/
│   │   ├── token-manager.js       # Secure token management
│   │   ├── agents/                # AI agent implementations
│   │   └── ai-workflows/          # Workflow orchestration
│   ├── models/
│   │   └── drivers/               # AI model drivers (Gemini, OpenAI, Anthropic)
│   ├── tools/                     # MCP-compliant tool implementations
│   ├── routes/                    # API endpoints
│   └── middleware/                # Authentication, validation, etc.
├── examples/                      # Workflow examples and demos
├── scripts/                       # Management and utility scripts
├── docs/                          # Comprehensive documentation
└── public/                        # A2A agent discovery

🔌 API 端点

核心端点
  • GET /health - 健康检查和系统状态
  • POST /a2a/tasks - Agent-to-Agent 任务执行
  • GET /.well-known/agent.json - Agent 发现(A2A 协议)
工作流管理
  • GET /api/workflows - 列出所有可用工作流
  • POST /api/workflows/:id/execute - 执行指定工作流
  • GET /api/workflows/:id/status - 获取工作流执行状态
令牌管理
  • POST /api/tokens/refresh - 刷新 API 令牌
  • GET /api/tokens/info - 获取令牌信息
  • POST /api/tokens/validate - 验证令牌合规性
工具集成
  • GET /api/tools - 列出可用的 MCP 工具
  • POST /api/tools/execute - 使用指定参数执行工具

🤖 AI 模型集成

Gemini 集成
import { GeminiDriver } from './src/models/drivers/gemini-driver.js';

const gemini = new GeminiDriver();
await gemini.initialize(); // Automatic token management

// Text generation with MCP compliance
const result = await gemini.generate({
  prompt: "Explain quantum computing",
  temperature: 0.7,
  maxTokens: 1024
});

// Streaming responses
for await (const chunk of gemini.stream({ prompt: "Write a story" })) {
  console.log(chunk.text);
}

// Embeddings
const embedding = await gemini.embedding({ 
  text: "Convert this to vector representation" 
});
多模型支持
import { ModelDriver } from './src/models/ModelDriver.js';

// Unified interface across all models
const models = {
  gemini: new GeminiDriver(),
  openai: new OpenAIDriver(),
  anthropic: new AnthropicDriver()
};

// Automatic model selection based on task
const bestModel = await ModelDriver.selectOptimal({
  task: "code_generation",
  requirements: { speed: "fast", quality: "high" }
});

🔄 工作流系统

定义工作流

在 examples/ 目录中创建工作流 JSON 文件:

{
  "id": "data-analysis-workflow",
  "name": "Data Analysis Pipeline",
  "description": "Comprehensive data analysis with AI insights",
  "version": "1.0",
  "mcp_compliant": true,
  "a2a_compliant": true,
  "steps": [
    {
      "id": "data-extraction",
      "type": "database-query",
      "tool": "mcp_database_tool",
      "parameters": {
        "query": "SELECT * FROM analytics_data WHERE date >= '{{start_date}}'"
      }
    },
    {
      "id": "ai-analysis",
      "type": "ai-processing",
      "tool": "mcp_gemini_tool",
      "parameters": {
        "model": "gemini-2.5-pro",
        "prompt": "Analyze this data and provide insights: {{data}}"
      },
      "depends_on": ["data-extraction"]
    },
    {
      "id": "report-generation",
      "type": "document-creation",
      "tool": "mcp_documentation_tool",
      "parameters": {
        "template": "analysis-report",
        "data": "{{ai-analysis.result}}"
      },
      "depends_on": ["ai-analysis"]
    }
  ]
}
执行工作流
# List available workflows
curl http://localhost:3000/api/workflows

# Execute a workflow
curl -X POST http://localhost:3000/api/workflows/data-analysis-workflow/execute \
  -H "Content-Type: application/json" \
  -d '{"start_date": "2024-01-01"}'

# Monitor execution
curl http://localhost:3000/api/workflows/execution-id-123/status

🛠️ 可用工具

GitHub 工具(mcp_github_tool)
// Repository analytics
const stats = await tools.mcp_github_search_repositories({
  query: "machine learning",
  sort: "stars",
  limit: 10
});

// Create pull request
const pr = await tools.mcp_github_create_pull_request({
  owner: "username",
  repo: "repository",
  title: "Feature: Add new functionality",
  body: "Description of changes",
  head: "feature-branch",
  base: "main"
});
系统健康工具(mcp_system_health_tool)
// Get system metrics
const health = await tools.mcp_system_health_check();
console.log(health); // { cpu: 45, memory: 67, status: "healthy" }

// Monitor performance
const metrics = await tools.mcp_system_performance_metrics({
  duration: "1h",
  interval: "5m"
});
文档工具(mcp_documentation_tool)
// Consolidate documentation
const docs = await tools.mcp_consolidate_documentation({
  source: "./docs",
  output: "./consolidated-docs.md",
  format: "markdown"
});

🔍 上下文感知工具选择

系统会根据上下文智能选择工具:

import { selectToolsForContext } from './src/context-aware-selector.js';

const context = {
  message: "Help me optimize this database query",
  history: ["SELECT * FROM users", "EXPLAIN ANALYZE"],
  project: { type: "database", language: "SQL" }
};

const selectedTools = selectToolsForContext(context, availableTools);
// Returns: [database-tool, performance-tool, query-optimizer]

🧪 测试

# Run all tests
npm test

# Test specific components
npm run test:integration
npm run test:tools
npm run test:workflows

# Test token management
npm run token:validate
npm run token:info

📊 监控与分析

实时指标
  • 系统健康:CPU、内存、磁盘使用情况
  • API 性能:响应时间、错误率
  • 令牌使用情况:API 调用、配额监控
  • 工作流执行:成功率、性能指标
日志记录
# View logs
tail -f logs/all.log
tail -f logs/error.log

# Workflow-specific logs
ls logs/workflow-test/

🔧 配置

环境变量
# Core Configuration
PORT=3000
NODE_ENV=production
LOG_LEVEL=info

# AI Models (automatically managed by token system)
GEMINI_MODEL=gemini-2.5-pro

# External Integrations
GITHUB_TOKEN=your_github_token
STRIPE_SECRET_KEY=your_stripe_key

# Database
POSTGRES_URL=postgresql://user:pass@localhost:5432/db
REDIS_HOST=127.0.0.1
REDIS_PORT=6379
Agent 配置

系统会通过 public/agent.json 自动公布其功能:

{
  "id": "smart-mcp-agent",
  "name": "Smart MCP Agent",
  "protocol_versions": {
    "mcp": "1.0",
    "a2a": "1.0"
  },
  "capabilities": [
    "workflow_execution",
    "token_management", 
    "model_interaction"
  ],
  "supported_models": [
    "gemini-2.5-pro",
    "gpt-4",
    "claude-3-opus"
  ]
}

🚀 高级用法

自定义工具开发
// Create a new MCP-compliant tool
export async function mcp_custom_tool(params) {
  const { input, options = {} } = params;
  
  try {
    // Tool implementation
    const result = await processInput(input, options);
    
    return {
      success: true,
      result,
      metadata: {
        mcp_compliant: true,
        execution_time: Date.now() - startTime
      }
    };
  } catch (error) {
    return {
      success: false,
      error: error.message,
      metadata: { mcp_compliant: true }
    };
  }
}
多 Agent 协调
// A2A protocol communication
const taskResult = await fetch('http://other-agent:3000/a2a/tasks', {
  method: 'POST',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({
    task_description: "Analyze financial data",
    context: { timeframe: "Q4 2024" }
  })
});

📚 文档

可查阅以下详细文档:

🔐 安全

  • 🔒 令牌加密:对所有敏感数据进行 AES-256-CBC 加密
  • 🛡️ 安全存储:文件权限和访问控制
  • 🔄 自动轮换:自动刷新和验证令牌
  • 📊 审计日志:全面记录安全事件
  • 🚫 不硬编码机密信息:所有凭据均通过环境变量提供

🤝 参与贡献

欢迎贡献!请参阅我们的贡献指南。

  1. Fork 此代码仓库
  2. 创建功能分支:git checkout -b feature/amazing-feature
  3. 编写代码并添加测试
  4. 确保符合 MCP/A2A 规范
  5. 提交拉取请求
开发环境设置
# Install development dependencies
npm install

# Run in development mode
npm run dev

# Run tests with coverage
npm run test:coverage

# Lint and format code
npm run lint
npm run format

📈 路线图

  • 增强 AI 模型:集成更多 AI 提供商
  • 高级工作流:可视化工作流构建器和编辑器
  • 实时协作:支持多用户执行工作流
  • 插件系统:第三方工具集成框架
  • 云端部署:一键云端部署选项

📄 许可证

本项目基于 MIT 许可证授权,详情请参阅 LICENSE 文件。

🙏 致谢

📞 支持


为 AI Agent 生态系统倾情打造 ❤️

Smart MCP Server——通过安全且符合协议规范的基础设施,助力智能 Agent 协作。

评论

支持 Markdown

第一次接触 MCP?

从协议是什么,到在客户端里装上第一个服务,这几条回答覆盖了大多数入门问题。

一个开放协议,规定了 AI 应用如何以统一方式连接外部工具与数据源。客户端负责与模型对话,MCP 服务负责提供工具、资源和提示模板,两者通过标准消息通信,同一个服务可以被不同客户端复用。