Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion .cursor/rules/about-codebase.mdc
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,7 @@ alwaysApply: false
---
- This repository contains a Model Context Protocol (MCP) server that integrates with CodeLogic's knowledge graph APIs
- It enables AI programming assistants to access dependency data from CodeLogic to analyze code and database impacts
- The core package is in src/codelogic_mcp_server/ with server.py, handlers.py, and utils.py
- **NEW**: Provides DevOps CI/CD integration capabilities for CodeLogic scanning in Jenkins, GitHub Actions, Azure DevOps, and GitLab CI
- **NEW**: Generates structured data for AI models to directly modify CI/CD files and implement CodeLogic scanning
- The core package is in src/codelogic_mcp_server/ with server.py, handlers.py, and utils.py
- **DevOps Tools**: codelogic-docker-agent, codelogic-build-info, codelogic-pipeline-helper for CI/CD integration
4 changes: 4 additions & 0 deletions .cursor/rules/best-practices.mdc
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,7 @@ alwaysApply: false
- Use semantic search before grep for broader context
- Maintain proper error handling and logging
- Keep code changes atomic and focused
- **NEW**: For DevOps tools, provide structured JSON data for AI file modification
- **NEW**: Include specific file paths, line numbers, and exact code modifications
- **NEW**: Generate platform-specific CI/CD configurations (Jenkins, GitHub Actions, Azure DevOps, GitLab)
- **NEW**: Always include setup instructions and validation checks for DevOps integrations
7 changes: 6 additions & 1 deletion .cursor/rules/environment-variables.mdc
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,9 @@ alwaysApply: false
- `CODELOGIC_PASSWORD`: Password for authentication
- `CODELOGIC_WORKSPACE_NAME`: Workspace name
- `CODELOGIC_DEBUG_MODE`: Enable debug logging
- `CODELOGIC_TEST_MODE`: Used by test framework
- `CODELOGIC_TEST_MODE`: Used by test framework
- **NEW**: DevOps CI/CD Integration Variables:
- `CODELOGIC_HOST`: CodeLogic server host for Docker agents
- `AGENT_UUID`: CodeLogic agent UUID for authentication
- `AGENT_PASSWORD`: CodeLogic agent password for authentication
- `SCAN_SPACE_NAME`: Target scan space for CodeLogic scans
6 changes: 4 additions & 2 deletions .cursor/rules/error-handling.mdc
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,16 @@ description: Error handling patterns for the CodeLogic MCP Server
globs: "**/*.py"
alwaysApply: false
---
- Use the following pattern for error handling in tool implementations:
# Use the following pattern for error handling in tool implementations

```python
try:
# Operations that might fail
except Exception as e:
sys.stderr.write(f"Error: {str(e)}\n")
return [types.TextContent(type="text", text=f"# Error\n\n{str(e)}")]
```

- Always catch and report exceptions
- Write errors to stderr
- Return formatted error messages to the client
- Return formatted error messages to the client
9 changes: 0 additions & 9 deletions .cursor/rules/file-operations.mdc

This file was deleted.

10 changes: 8 additions & 2 deletions .cursor/rules/mcp-server-pattern.mdc
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@ description: Core coding patterns for MCP Server implementation
globs: "**/*.py"
alwaysApply: false
---
- Use the following pattern for MCP server implementation:

# Use the following pattern for MCP server implementation

```python
server = Server("codelogic-mcp-server")

Expand All @@ -15,7 +17,11 @@ async def handle_list_tools() -> list[types.Tool]:
async def handle_call_tool(name: str, arguments: dict | None) -> list[types.TextContent]:
# Handle tool execution
```

- New tools should be added to handle_list_tools() with descriptive names (prefix: `codelogic-`)
- Tool handlers should be implemented in handle_call_tool()
- Create handler functions with proper error handling
- Return results as markdown-formatted text
- Return results as markdown-formatted text
- **NEW**: For DevOps tools, return structured JSON data for AI file modification
- **NEW**: Include helper functions for generating platform-specific CI/CD configurations
- **NEW**: Use structured output patterns for file modifications with specific line numbers and content
5 changes: 4 additions & 1 deletion .cursor/rules/technologies.mdc
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,7 @@ alwaysApply: false
- Python 3.13+ with extensive use of async/await
- Model Context Protocol SDK (`mcp[cli]`)
- HTTPX for API requests
- Environment variables via dotenv for configuration
- Environment variables via dotenv for configuration
- **NEW**: Docker for CodeLogic agent containerization
- **NEW**: CI/CD Platform Support: Jenkins (Groovy), GitHub Actions (YAML), Azure DevOps (YAML), GitLab CI (YAML)
- **NEW**: JSON structured output for AI model file modification
2 changes: 0 additions & 2 deletions .cursorindexingignore

This file was deleted.

16 changes: 9 additions & 7 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,19 @@ jobs:
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
env:
PIP_PROGRESS_BAR: off
run: |
python -m pip install --upgrade pip
python -m pip install uv
uv pip install --system -e ".[dev]"
python -m pip install flake8
python -m pip install --upgrade pip -q
python -m pip install uv -q
uv pip install --system -e ".[dev]" --quiet
python -m pip install flake8 -q
- name: Lint with flake8
run: |
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings
flake8 . --count --exit-zero --max-complexity=10 --statistics
# exit-zero treats all errors as warnings (quiet: only violations, no per-file stats)
flake8 . --count --exit-zero --max-complexity=10 --quiet
- name: Test with unittest
run: |
python -m unittest discover -s test -p "unit*.py" -v
python -m unittest discover -s test -p "unit*.py"
70 changes: 69 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,25 @@ An [MCP Server](https://modelcontextprotocol.io/introduction) to utilize Codelog

### Tools

The server implements two tools:
The server implements five tools:

#### Code Analysis Tools
- **codelogic-method-impact**: Pulls an impact assessment from the CodeLogic server's APIs for your code.
- Takes the given "method" that you're working on and its associated "class".
- **codelogic-database-impact**: Analyzes impacts between code and database entities.
- Takes the database entity type (column, table, or view) and its name.

#### DevOps & CI/CD Integration Tools
- **codelogic-docker-agent**: Generates Docker agent configurations for CodeLogic scanning in CI/CD pipelines.
- Supports .NET, Java, SQL, and TypeScript agents
- Generates configurations for Jenkins, GitHub Actions, Azure DevOps, and GitLab CI
- **codelogic-build-info**: Generates build information and send commands for CodeLogic integration.
- Supports Git information, build logs, and metadata collection
- Provides both Docker and standalone usage examples
- **codelogic-pipeline-helper**: Generates complete CI/CD pipeline configurations for CodeLogic integration.
- Creates comprehensive pipeline configurations with best practices
- Includes error handling, notifications, and scan space management strategies

### Install

#### Pre Requisites
Expand Down Expand Up @@ -196,6 +208,41 @@ To configure the CodeLogic MCP server in Cursor:

The CodeLogic MCP server tools will now be available in your Cursor workspace.

## DevOps Integration

The CodeLogic MCP Server now includes powerful DevOps capabilities for integrating CodeLogic scanning into your CI/CD pipelines. These tools help DevOps teams:

### Docker Agent Integration
- Generate Docker run commands for CodeLogic agents
- Create platform-specific configurations (Jenkins, GitHub Actions, Azure DevOps, GitLab CI)
- Set up proper environment variables and volume mounts
- Include build information collection

### Build Information Management
- Send Git information, build logs, and metadata to CodeLogic servers
- Support multiple CI/CD platforms with platform-specific variables
- Handle log file management and rotation
- Provide both Docker and standalone usage options

### Complete Pipeline Configuration
- Generate end-to-end CI/CD pipeline configurations
- Include error handling, notifications, and monitoring
- Support different scan space management strategies
- Follow DevOps best practices for security and performance

### Example Usage

```bash
# Generate Docker agent configuration for .NET
codelogic-docker-agent --agent-type=dotnet --scan-path=/app --application-name=MyApp --ci-platform=jenkins

# Set up build information sending
codelogic-build-info --build-type=all --output-format=docker --ci-platform=github-actions

# Create complete pipeline configuration
codelogic-pipeline-helper --ci-platform=jenkins --agent-type=dotnet --scan-triggers=main,develop
```

## AI Assistant Instructions/Rules

To help the AI assistant use the CodeLogic tools effectively, you can add the following instructions/rules to your client's configuration. We recommend customizing these instructions to align with your team's specific coding standards, best practices, and workflow requirements:
Expand All @@ -216,9 +263,16 @@ When modifying SQL code or database entities:
- Always use codelogic-database-impact to analyze potential impacts
- Highlight impact results for the modified database entities

For DevOps and CI/CD integration:
- Use codelogic-docker-agent to generate Docker agent configurations
- Use codelogic-build-info to set up build information sending
- Use codelogic-pipeline-helper to create complete CI/CD pipeline configurations
- Support Jenkins, GitHub Actions, Azure DevOps, and GitLab CI platforms

To use the CodeLogic tools effectively:
- For code impacts: Ask about specific methods or functions
- For database relationships: Ask about tables, views, or columns
- For DevOps: Ask about CI/CD integration, Docker agents, or build information
- Review the impact results before making changes
- Consider both direct and indirect impacts
```
Expand All @@ -239,9 +293,16 @@ When modifying SQL code or database entities:
- Always use codelogic-database-impact to analyze potential impacts
- Highlight impact results for the modified database entities

For DevOps and CI/CD integration:
- Use codelogic-docker-agent to generate Docker agent configurations
- Use codelogic-build-info to set up build information sending
- Use codelogic-pipeline-helper to create complete CI/CD pipeline configurations
- Support Jenkins, GitHub Actions, Azure DevOps, and GitLab CI platforms

To use the CodeLogic tools effectively:
- For code impacts: Ask about specific methods or functions
- For database relationships: Ask about tables, views, or columns
- For DevOps: Ask about CI/CD integration, Docker agents, or build information
- Review the impact results before making changes
- Consider both direct and indirect impacts
```
Expand All @@ -260,9 +321,16 @@ When modifying SQL code or database entities:
- Always use codelogic-database-impact to analyze potential impacts
- Highlight impact results for the modified database entities

For DevOps and CI/CD integration:
- Use codelogic-docker-agent to generate Docker agent configurations
- Use codelogic-build-info to set up build information sending
- Use codelogic-pipeline-helper to create complete CI/CD pipeline configurations
- Support Jenkins, GitHub Actions, Azure DevOps, and GitLab CI platforms

To use the CodeLogic tools effectively:
- For code impacts: Ask about specific methods or functions
- For database relationships: Ask about tables, views, or columns
- For DevOps: Ask about CI/CD integration, Docker agents, or build information
- Review the impact results before making changes
- Consider both direct and indirect impacts
```
Expand Down
Loading