Token导航 LogoToken导航TokenDH.com
Code Intelligence MCP logo
开发工具未说明官方级别未说明来源级核验

Code Intelligence MCP

MCP Server

基于AI的代码智能推荐服务,为AI IDE提供组件和工具方法的智能建议,提升代码复用和开发效率。

工具数

0

提示词数

0

GitHub Stars

1

资源数

0
TypeScriptClaude开发工具Claude DesktopClaude

安装说明

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

作者 / 组织

lyw405

提供方

lyw405

最后核验

2026/5/17 20:21

快速接入

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

详细介绍

代码智能MCP

![License: MIT](https://opensource.org/licenses/MIT) ](https://nodejs.org/) ![TypeScript](https://www.typescriptlang.org/) ](https://pnpm.io/)

英语 | 中文

智能代码建议MCP服务,为AI IDE提供AI驱动的组件和实用方法建议。

引言

这是一种基于模型上下文协议(MCP)的智能代码建议服务。它通过人工智能分析用户需求,并从私有代码库中推荐最合适的组件和实用方法,帮助开发人员提高代码重用和开发效率。

核心能力

🎨 UI组件智能推荐

  • 分析UI开发需求(页面、表单、界面等)
  • 从知识库中匹配最相关的私有组件
  • 通过组件导入和使用生成优化的提示
  • 提供完整的实施指南和代码示例

🔧 实用方法智能推荐

  • 分析逻辑功能需求(数据处理、格式转换、实用功能等)
  • 从方法知识库中查找可重用的实用方法
  • 通过方法导入和调用生成优化的提示
  • 避免重新发明轮子,提高代码质量

特性

智能分析引擎

  • 需求理解:基于人工智能对用户开发意图的深入理解
  • 关键词提取:自动识别需求中的核心要素
  • 复杂性评估:智能评估实施难度和组件匹配度

知识库管理

  • 组件知识库:管理私有UI组件库(道具、事件、插槽、示例)
  • 方法知识库:管理实用程序方法库(参数、返回值、类型、用法)
  • 相关性算法:根据语义匹配计算推荐分数

快速优化

  • 双向优化:支持组件和方法场景的快速重新设计
  • 结构化输出:生成完整的解决方案,包括导入语句和实施步骤
  • 最佳实践:整合代码标准和使用建议

项目结构

code-intelligence-mcp/
├── src/
│   ├── core/                          # Core functional modules
│   │   ├── knowledge-base.ts          # Component knowledge base management
│   │   ├── utility-knowledge-base.ts  # Utility method knowledge base management
│   │   ├── prompt-redesigner.ts       # UI component prompt redesign
│   │   ├── logic-prompt-redesigner.ts # Logic method prompt redesign
│   │   ├── ai-suggester.ts            # AI component recommendation engine
│   │   ├── ai-utility-suggester.ts    # AI method recommendation engine
│   │   └── index.ts
│   ├── config/                        # Configuration management
│   │   ├── model-manager.ts           # AI model manager
│   │   ├── ai-client-adapter.ts       # AI client adapter
│   │   ├── types.ts                   # Configuration type definitions
│   │   └── index.ts
│   ├── tools/                         # MCP tool definitions
│   │   ├── suggestion.ts              # Component suggestion tool
│   │   ├── utility-suggestion.ts      # Method suggestion tool
│   │   ├── query.ts                   # Query tool
│   │   └── index.ts
│   ├── resources/                     # MCP resource definitions
│   │   └── index.ts
│   ├── types/                         # Type definitions
│   │   └── mcp-types.ts
│   ├── utils/                         # Utility functions
│   │   ├── logger.ts                  # Logger utility
│   │   ├── ai-caller.ts               # AI unified caller
│   │   ├── path-utils.ts              # Path resolution utilities
│   │   └── index.ts
│   └── mcp-server.ts                  # MCP server main entry
├── ci-mcp-data/                       # Configuration data (user-specific)
│   ├── components.example.json        # UI component knowledge base example
│   ├── utils.example.json             # Utility method knowledge base example
│   └── config.example.json            # AI model configuration example
├── scripts/                           # Script tools
│   ├── setup.js                       # Setup script
│   └── start.sh                       # Startup script
├── package.json
├── tsconfig.json
└── .npmignore                         # NPM publish exclusions

安装和使用

方法1:与npx一起使用(推荐)

这是将MCP服务器与Claude Desktop等AI IDE一起使用的推荐方式。

步骤1:准备配置文件

创建配置目录(建议位置: ~/.config/ci-mcp):

mkdir -p ~/.config/ci-mcp

下载或创建以下三个配置文件:

  1. config.json -AI模型配置
  2. components.json -UI组件知识库
  3. utils.json -实用方法知识库

您可以在npm包或存储库中找到示例文件。

步骤2:配置AI IDE

添加到您的AI IDE配置中(例如,Claude Desktop的 claude_desktop_config.json):

{
  "mcpServers": {
    "code-intelligence": {
      "command": "npx",
      "args": ["-y", "code-intelligence-mcp"],
      "env": {
        "CI_MCP_DATA_DIR": "~/.config/ci-mcp"
      }
    }
  }
}

环境变量:

  • CI_MCP_DATA_DIR (推荐):指定配置目录,所有三个文件都将从该目录加载
  • CI_MCP_CONFIG:直接指定路径 config.json
  • CI_MCP_COMPONENTS:直接指定路径 components.json
  • CI_MCP_UTILS:直接指定路径 utils.json

支持的路径格式:

  • 绝对路径: /Users/xxx/.config/ci-mcp
  • 主目录: ~/.config/ci-mcp$HOME/.config/ci-mcp
  • 环境变量: ${MY_CONFIG_DIR}/ci-mcp

步骤3:重新启动AI IDE

重新启动AI IDE(例如Claude Desktop),MCP服务将通过npx自动启动。

______________________________________________________________________

方法二:地方发展

先决条件

配置知识库数据文件

该项目需要手动配置以下数据文件 ci-mcp-data/ 目录:

  1. ci-mcp-data/config.json -人工智能模型配置(包括API密钥)
   cp ci-mcp-data/config.example.json ci-mcp-data/config.json
   # Edit config.json and fill in your API Key
  1. ci-mcp-data/components.json -UI组件知识库
   cp ci-mcp-data/components.example.json ci-mcp-data/components.json
   # Edit components.json based on your private component library

- 按照现有格式添加组件信息: description, import, relativePath等等。

  1. ci-mcp-data/utils.json -实用方法知识库
   cp ci-mcp-data/utils.example.json ci-mcp-data/utils.json
   # Edit utils.json based on your utility method library

- 包括方法信息: description, import, params, returns等等。

注:

  • config.json 包含敏感信息(API密钥),并且已添加到 .gitignore,将不会提交到存储库
  • components.jsonutils.json 需要根据您的实际代码存储库进行配置
  • 请参考以下示例文件 config.example.json 用于配置格式

再进行

pnpm install

发展模式

pnpm dev

构建

pnpm build

生产模式

pnpm start:prod

MCP工具

🎨 UI组件建议工具

1.建议组件

智能分析UI开发需求,并推荐最合适的私有组件。

使用案例:

  • 创建页面、表单、界面和其他UI功能
  • 使用私有组件库快速开发
  • 获得完整的实施解决方案

输入参数:

{
  prompt: string; // User requirement description, e.g. "Create user login page"
}

输出:

  • 需求分析:关键词、组件类型、复杂性评估
  • 建议的组件:组件列表+相关性得分+推荐理由
  • 优化提示:包括特定组件的导入和使用
  • 实施指南:逐步发展建议

例子:

// Input
{"prompt": "Generate a user information edit form"}

// Output
{
  "analysis": {
    "keywords": ["form", "edit", "user information"],
    "componentTypes": ["form", "input", "button"]
  },
  "suggestedComponents": [
    {
      "name": "das-form",
      "relevance": 0.95,
      "reason": "Most suitable for user information editing scenarios"
    }
  ],
  "redesignedPrompt": "Create using das-form component...",
  "implementationGuide": "1. Import component...\n2. Configure form fields..."
}

2.查询组件

查询特定组件的详细信息。

输入参数:

{
  componentName: string; // Component name, e.g. "das-button"
}

输出:

  • 组件描述、类别、标签
  • Props参数列表
  • 活动列表
  • 插槽描述
  • 使用示例代码
  • 导入路径

______________________________________________________________________

🔧 实用方法建议工具

1.建议用途

智能地分析逻辑开发需求,并推荐可重用的实用方法。

使用案例:

  • 实现数据处理和格式转换功能
  • 需要加密、验证和其他实用功能
  • 避免重新发明轮子

输入参数:

{
  prompt: string; // Logic requirement description, e.g. "Need to format numbers with thousand separators"
}

输出:

  • 需求分析:关键功能点、方法类型
  • 建议方法:方法列表+相关性得分+推荐理由
  • 优化提示:包括方法导入和调用
  • 实施指南:使用步骤和注意事项

例子:

// Input
{"prompt": "Implement password encryption function"}

// Output
{
  "analysis": {
    "keywords": ["encryption", "password", "security"],
    "methodTypes": ["encryption", "security"]
  },
  "suggestedUtilities": [
    {
      "name": "encryptPassword",
      "relevance": 0.98,
      "reason": "Provides MD5/SHA256 password encryption"
    }
  ],
  "redesignedPrompt": "Use encryptPassword method...",
  "implementationGuide": "1. Import method...\n2. Call encryption..."
}

2.查询实用性

查询特定实用方法的详细信息。

输入参数:

{
  utilityName: string; // Method name, e.g. "formatNumber"
}

输出:

  • 方法描述、类别、类型
  • 参数列表(参数名称、类型、描述)
  • 返回值类型和描述
  • 使用示例代码
  • 导入路径

MCP资源

代码intelligence://component-library

组件库资源

提供完整的私有组件库信息,包括:

  • 所有可用组件列表
  • 组件类别和标签
  • 组件能力概述

代码intelligence://utility-library

实用方法库资源

提供完整的实用程序方法库信息,包括:

  • 所有可用方法列表
  • 方法类别和功能
  • 方法能力概述

代码intelligence://usage-guide

使用指南资源

包括:

  • MCP工具使用说明
  • 最佳实践建议
  • 常见问题
  • 集成配置指南

技术栈

核心框架

  • TypeScript -类型安全开发
  • Node.js -运行时环境
  • MCP-SDK (@modelcontextprotocol/sdk)-模型上下文协议实现

AI集成

  • Vercel AI SDK -统一的AI接口
  • 开放人工智能 -GPT系列型号支持
  • Anthropic -克劳德系列车型支持
  • 深度求索 -国内大型机型支持

开发工具

  • pnpm -包管理器
  • TSX -TypeScript执行器
  • ESLint+Pretier -规范标准
  • 哈士奇 -Git挂钩

开发标准

  • 使用TypeScript进行类型安全开发
  • 遵循ESLint和Prettier代码标准
  • 使用Husky进行Git钩子管理

配置

1.MCP服务配置(MCP-config.json)

在AI IDE中注册MCP服务:

{
  "mcpServers": {
    "code-intelligence": {
      "command": "/bin/zsh",
      "args": ["/path/to/code-intelligence-mcp/scripts/start.sh"]
    }
  }
}

2.AI模型配置(data/config.json)

配置推荐引擎使用的AI模型:

{
  "defaultModel": "claude-3-7-sonnet-latest",
  "providers": [
    {
      "provider": "anthropic",
      "models": [
        {
          "model": "claude-3-7-sonnet-latest",
          "title": "Claude 3.7 Sonnet",
          "baseURL": "https://api.302.ai/v1",
          "apiKey": "your-api-key"
        }
      ]
    },
    {
      "provider": "openai",
      "models": [
        {
          "model": "gpt-4o",
          "title": "GPT-4o",
          "baseURL": "https://api.openai.com/v1",
          "apiKey": "your-api-key"
        }
      ]
    }
  ]
}

配置说明:

  • defaultModel:要使用的默认模型名称,必须存在于 providers
  • providers:支持的AI提供商列表

- provider:提供者类型(anthropic, openai, deepseek, ollama) - models:此提供程序的模型配置列表 - model:型号名称(必须匹配 defaultModel) - title:型号显示名称 - baseURL:API端点地址 - apiKey:API密钥

支持的提供商:

  • anthropic -克劳德系列车型
  • openai -GPT系列型号
  • deepseek -DeepSeek国内机型
  • ollama -本地模型

3.知识库数据

组件知识库(data/components.json)

{
  "components": [
    {
      "name": "das-button",
      "description": "Button component",
      "category": "Basic component",
      "tags": ["button", "interaction"],
      "props": [...],
      "events": [...],
      "example": "..."
    }
  ]
}

实用方法知识库(data/utils.json)

{
  "utilities": [
    {
      "name": "formatNumber",
      "description": "Format number with thousand separators",
      "category": "Formatting",
      "type": "formatter",
      "params": [...],
      "returns": {...},
      "example": "..."
    }
  ]
}

许可证

麻省理工学院

贡献

我们欢迎捐款!请看 贡献.md 了解如何为这个项目做出贡献的详细信息。

更新日志

更改日志.md 查看版本历史和发行说明。

目录标签

目录标签

TypeScriptClaude开发工具代码推荐本地部署AI辅助开发组件库管理工具方法库开发效率

支持客户端

Claude DesktopClaude

接入字段

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

未说明

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

api-key

工具数量(toolCount,工具数)

0

资源数量(resourceCount,资源数)

0

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

0

权限和风险

未说明api-key部署方式未说明

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

安装前确认

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

仍需确认:installCommand

来源信息

继续浏览同类 MCP