Model Context Protocol (MCP) Server

Model Context Protocol (MCP) Server

一个用于将全局规则传输给编码代理的MCP服务器中间件。

简介

模型上下文协议(MCP)服务器是一个中间件,用于从中央 GitHub 仓库向 AI 代理提供全局规则。

基本使用

API 端点

  • GET / - 检查服务器状态
  • GET /api/rules - 获取最新全局规则 (从 ron-ai-global-rules 仓库)

集成示例

在每次对话开始时,向 MCP 服务器发送请求获取最新规则:

async function loadGlobalRules() {
  try {
    const response = await fetch('https://ai-code-agent-rules-production.up.railway.app/api/rules');
    const data = await response.json();
    if (data.success) {
      return data.data; // 包含全局规则内容
    }
    return null;
  } catch (error) {
    console.error('加载全局规则失败:', error);
    return null;
  }
}

注意事项

  • 确保在初始化 AI 代理时请求规则
  • 服务器将自动从 GitHub 仓库获取最新规则
  • 处理请求失败的情况以确保稳健性

服务器地址: https://ai-code-agent-rules-production.up.railway.app