CodeLogic

Official
Mozilla Public License 2.0
4
  • Apple
  • Linux

remote-capable server

The server can be hosted and run remotely because it primarily relies on remote services or has no dependency on the local environment.

Integrations

  • Enables Windsurf IDE to leverage Codelogic's software dependency analysis for assessing the impact of code modifications

codelogic-mcp-服务器

MCP 服务器可在您的 AI 编程助手中利用 Codelogic 丰富的软件依赖数据。

成分

工具

服务器实现了两个工具:

  • codelogic-method-impact :从 CodeLogic 服务器的 API 中提取对您的代码的影响评估。
    • 采用您正在处理的给定“方法”及其相关的“类”。
  • codelogic-database-impact :分析代码和数据库实体之间的影响。
    • 采用数据库实体类型(列、表或视图)及其名称。

安装

先决条件

MCP 服务器依赖 Astral UV 运行,请安装

要在 VS Code 中配置此 MCP 服务器:

  1. 首先,确保您已在 VS Code 中启用 GitHub Copilot 代理模式。
  2. 在您的工作区中创建一个.vscode/mcp.json文件,并配置如下:
{ "servers": { "codelogic-mcp-server": { "type": "stdio", "command": "uvx", "args": [ "codelogic-mcp-server@latest" ], "env": { "CODELOGIC_SERVER_HOST": "<url to the server e.g. https://myco.app.codelogic.com>", "CODELOGIC_USERNAME": "<my username>", "CODELOGIC_PASSWORD": "<my password>", "CODELOGIC_MV_NAME": "<my materialized view>", "CODELOGIC_DEBUG_MODE": "true" } } } }
  1. 或者,您可以从命令面板运行MCP: Add Server命令并提供服务器信息。
  2. 要管理您的 MCP 服务器,请使用命令面板中的MCP: List Servers命令。
  3. 配置完成后,服务器的工具将可供 Copilot 代理模式使用。在代理模式下,您可以根据需要点击聊天视图中的“工具”按钮来启用/禁用特定工具。
  4. 要以代理模式使用 Codelogic 工具,您可以具体询问代码影响或数据库关系,代理将使用适当的工具。

通过编辑配置文件来配置Claude Desktop:

  • 在 MacOS 上: ~/Library/Application\ Support/Claude/claude_desktop_config.json
  • 在 Windows 上: %APPDATA%/Claude/claude_desktop_config.json
  • 在 Linux 上: ~/.config/Claude/claude_desktop_config.json

将以下内容添加到您的配置文件中:

"mcpServers": { "codelogic-mcp-server": { "command": "uvx", "args": [ "codelogic-mcp-server@latest" ], "env": { "CODELOGIC_SERVER_HOST": "<url to the server e.g. https://myco.app.codelogic.com>", "CODELOGIC_USERNAME": "<my username>", "CODELOGIC_PASSWORD": "<my password>", "CODELOGIC_MV_NAME": "<my materialized view>" } } }

添加配置后,重新启动 Claude Desktop 以应用更改。

要使用Windsurf IDE运行此 MCP 服务器:

配置 Windsurf IDE

要配置 Windsurf IDE,您需要创建或修改~/.codeium/windsurf/mcp_config.json配置文件。

将以下配置添加到您的文件中:

"mcpServers": { "codelogic-mcp-server": { "command": "uvx", "args": [ "codelogic-mcp-server@latest" ], "env": { "CODELOGIC_SERVER_HOST": "<url to the server e.g. https://myco.app.codelogic.com>", "CODELOGIC_USERNAME": "<my username>", "CODELOGIC_PASSWORD": "<my password>", "CODELOGIC_MV_NAME": "<my materialized view>" } } }

添加配置后,重新启动 Windsurf IDE 或刷新工具以应用更改。

要在 Cursor 中配置 CodeLogic MCP 服务器:

  1. 通过创建.cursor/mcp.json文件来配置 MCP 服务器:
{ "servers": { "codelogic-mcp-server": { "type": "stdio", "command": "uvx", "args": [ "codelogic-mcp-server@latest" ], "env": { "CODELOGIC_SERVER_HOST": "<url to the server e.g. https://myco.app.codelogic.com>", "CODELOGIC_USERNAME": "<my username>", "CODELOGIC_PASSWORD": "<my password>", "CODELOGIC_MV_NAME": "<my materialized view>", "CODELOGIC_DEBUG_MODE": "true" } } } }
  1. 重新启动 Cursor 以应用更改。

CodeLogic MCP 服务器工具现在将在您的 Cursor 工作区中可用。

AI助手指令

为了帮助AI助手有效地使用CodeLogic工具,您可以在客户端的配置中添加以下说明:

创建一个.vscode/copilot-instructions.md文件,其中包含以下内容:

# CodeLogic MCP Server Instructions When modifying existing code methods: - Use codelogic-method-impact to analyze code changes - Use codelogic-database-impact for database modifications - Highlight impact results for the modified methods When modifying SQL code or database entities: - Always use codelogic-database-impact to analyze potential impacts - Highlight impact results for the modified database entities To use the CodeLogic tools effectively: - For code impacts: Ask about specific methods or functions - For database relationships: Ask about tables, views, or columns - Review the impact results before making changes - Consider both direct and indirect impacts

创建一个文件~/.claude/instructions.md其中包含以下内容:

# CodeLogic MCP Server Instructions When modifying existing code methods: - Use codelogic-method-impact to analyze code changes - Use codelogic-database-impact for database modifications - Highlight impact results for the modified methods When modifying SQL code or database entities: - Always use codelogic-database-impact to analyze potential impacts - Highlight impact results for the modified database entities To use the CodeLogic tools effectively: - For code impacts: Ask about specific methods or functions - For database relationships: Ask about tables, views, or columns - Review the impact results before making changes - Consider both direct and indirect impacts

创建或修改~/.codeium/windsurf/memories/global_rules.md markdown 文件,内容如下:

When modifying existing code methods: - Use codelogic-method-impact to analyze code changes - Use codelogic-database-impact for database modifications - Highlight impact results for the modified methods When modifying SQL code or database entities: - Always use codelogic-database-impact to analyze potential impacts - Highlight impact results for the modified database entities To use the CodeLogic tools effectively: - For code impacts: Ask about specific methods or functions - For database relationships: Ask about tables, views, or columns - Review the impact results before making changes - Consider both direct and indirect impacts

创建一个.cursor/rules/codelogic-rules.md文件,其中包含以下内容:

# CodeLogic MCP Server Rules ## AI Assistant Behavior - When modifying existing code methods: - Use codelogic-method-impact to analyze code changes - Use codelogic-database-impact for database modifications - Highlight impact results for the modified methods - When modifying SQL code or database entities: - Always use codelogic-database-impact to analyze potential impacts - Highlight impact results for the modified database entities - To use the CodeLogic tools effectively: - For code impacts: Ask about specific methods or functions - For database relationships: Ask about tables, views, or columns - Review the impact results before making changes - Consider both direct and indirect impacts

环境变量

可以配置以下环境变量来定制服务器的行为:

  • CODELOGIC_SERVER_HOST :CodeLogic 服务器的 URL。
  • CODELOGIC_USERNAME :您的 CodeLogic 用户名。
  • CODELOGIC_PASSWORD :您的 CodeLogic 密码。
  • CODELOGIC_MV_NAME :要使用的物化视图的名称。
  • CODELOGIC_DEBUG_MODE :设置为true以启用调试模式。启用后,将生成其他调试文件,例如timing_log.txtimpact_data*.json 。默认为false

示例配置

"env": { "CODELOGIC_SERVER_HOST": "<url to the server e.g. https://myco.app.codelogic.com>", "CODELOGIC_USERNAME": "<my username>", "CODELOGIC_PASSWORD": "<my password>", "CODELOGIC_MV_NAME": "<my materialized view>", "CODELOGIC_DEBUG_MODE": "true" }

固定版本

您无需使用服务器的最新版本,而是可以通过更改args字段来匹配pypi中的版本,从而固定到特定版本,例如

"args": [ "codelogic-mcp-server@0.2.2" ],

版本兼容性

此 MCP 服务器具有以下版本兼容性要求:

  • 版本 0.3.1 及以下:兼容所有 CodeLogic API 版本
  • 版本 0.4.0 及以上:需要 CodeLogic API 版本 25.10.0 或更高版本

如果您正在升级,请确保您的 CodeLogic 服务器满足最低 API 版本要求。

测试

运行单元测试

该项目使用 unittest 进行测试。您可以运行单元测试而无需任何外部依赖项:

python -m unittest discover -s test -p "unit_*.py"

单元测试使用模拟数据,不需要连接到 CodeLogic 服务器。

集成测试(可选)

如果您想运行连接到真实 CodeLogic 服务器的集成测试:

  1. test/.env.test.example复制到test/.env.test并填充您的 CodeLogic 服务器详细信息
  2. 运行集成测试:
python -m unittest discover -s test -p "integration_*.py"

注意:集成测试需要访问 CodeLogic 服务器实例。

You must be authenticated.

A
security – no known vulnerabilities
A
license - permissive license
A
quality - confirmed to work

与 CodeLogic 进行交互,CodeLogic 是一个软件智能平台,可以绘制复杂的代码和数据架构依赖关系图,以提高 AI 的准确性和洞察力。

  1. Components
    1. Tools
    2. Install
    3. AI Assistant Instructions
    4. Environment Variables
  2. Testing
    1. Running Unit Tests
    2. Integration Tests (Optional)
ID: cq6x71y62p