ALM Traceability MCP Tools - Azure DevOps, Jira, and Vector Search integration
Project description
ALM Traceability Management System
A PostgreSQL-based traceability management system for ALM (Application Lifecycle Management) platforms, supporting Azure DevOps and Jira integration.
Features
- PostgreSQL Backend: Robust database schema with
alm_platform_typeenum andtraceability_linkstable - ALM Platform Support: Azure DevOps and Jira integration
- Traceability Links: Link sessions, requirements, and test cases with relationship types
- MCP Tools: Complete set of MCP tools for traceability operations
- CloudSQL Support: Ready for Google Cloud SQL deployment
- Comprehensive Testing: Built-in test suite for validation
Database Schema
The system uses a PostgreSQL database with the following key components:
Tables
sessions- Test sessions with ALM typerequirements- Requirements with ALM typetest_cases- Test cases with ALM typetraceability_links- Main traceability relationships
Key Features
alm_platform_typeenum:'azure_devops','jira'- Relationship types:
'tests','covers','implements','relates_to' - Confidence scoring and metadata support
- Automatic timestamps and audit trails
Setup Instructions
1. Install Dependencies
pip install -r requirements.txt
Required packages:
asyncpg>=0.29.0- PostgreSQL async drivermcp>=1.0.0- MCP server frameworkpydantic>=2.5.0- Configuration managementpython-dotenv>=1.0.0- Environment variables
2. Database Setup
Option A: Local PostgreSQL
- Install PostgreSQL 15+
- Create database:
createdb alm_traceability - Run schema:
psql -d alm_traceability -f database/schema.sql
Option B: Google Cloud SQL
- Create CloudSQL PostgreSQL instance
- Configure connection in
.env - Use Cloud SQL Proxy or direct connection
3. Environment Configuration
Copy .env.example to .env and configure:
cp .env.example .env
Key variables:
# Database
DB_HOST=localhost
DB_PORT=5432
DB_NAME=alm_traceability
DB_USER=postgres
DB_PASSWORD=your-password
# Azure DevOps
ADO_ORGANIZATION=your-org
ADO_PROJECT=your-project
ADO_PERSONAL_ACCESS_TOKEN=your-pat
# Jira
JIRA_BASE_URL=https://company.atlassian.net
JIRA_EMAIL=your-email@company.com
JIRA_API_TOKEN=your-api-token
JIRA_PROJECT_KEY=PROJECT
4. Test the Setup
Run the comprehensive test suite:
python test_traceability.py
This will test:
- Database connectivity
- Schema validation
- Traceability operations
- Environment configuration
Usage
Starting the MCP Server
python mcp_main.py
The server will initialize with PostgreSQL-based traceability tools.
Available MCP Tools
Database Management
initialize_traceability_database()- Initialize database connectiontest_database_connection()- Test connectivity and schema
Traceability Operations
create_traceability_link()- Create link between itemsget_traceability_link(link_id)- Get specific linkget_traceability_links_for_item()- Get all links for an itemgenerate_traceability_report()- Generate reports
Bulk Operations
link_session_to_requirements()- Link session to multiple requirementslink_requirements_to_test_cases()- Link requirements to test casesget_traceability_matrix_for_session()- Get complete matrix
Example Usage
Creating a Traceability Link
# Link a test session to a requirement
await create_traceability_link(
source_type="session",
source_id="session-001",
target_type="requirement",
target_id="req-001",
relationship_type="covers",
source_alm_type="azure_devops",
target_alm_type="azure_devops",
confidence_score=0.95,
description="Test session covers login requirement"
)
Linking Requirements to Test Cases
# Link multiple requirements to test cases
await link_requirements_to_test_cases(
requirement_ids=["req-001", "req-002"],
test_case_ids=["tc-001", "tc-002", "tc-003"],
alm_type="azure_devops",
confidence_score=0.9
)
Generating Reports
# Generate summary report
await generate_traceability_report(
report_type="summary",
alm_type="azure_devops"
)
# Generate detailed report
await generate_traceability_report(
report_type="detailed"
)
Architecture
Components
database_manager.py- PostgreSQL connection management with async supporttraceability_manager.py- Core traceability operations and business logicmcp_traceability_tools.py- MCP tool registration and APIconfig.py- Configuration models with database settingsdatabase/schema.sql- Complete PostgreSQL schema with functions
Database Functions
The schema includes helpful PostgreSQL functions:
add_traceability_link()- Safely create links with conflict handlingget_traceability_links()- Query links with direction filteringupdate_updated_at_column()- Automatic timestamp updates
Views
traceability_matrix- Comprehensive view joining all link details
CloudSQL Deployment
Prerequisites
- Google Cloud Project with CloudSQL API enabled
- CloudSQL PostgreSQL instance
- Database user with sufficient permissions
Connection Options
Option 1: Cloud SQL Proxy
# Install Cloud SQL Proxy
curl -o cloud_sql_proxy https://dl.google.com/cloudsql/cloud_sql_proxy.linux.amd64
chmod +x cloud_sql_proxy
# Start proxy
./cloud_sql_proxy -instances=PROJECT:REGION:INSTANCE=tcp:5432
Environment configuration:
DB_HOST=localhost
DB_PORT=5432
USE_CLOUD_SQL_PROXY=true
CLOUDSQL_INSTANCE=project:region:instance
Option 2: Direct Connection
DB_HOST=your-cloudsql-ip
DB_PORT=5432
DB_SSL_MODE=require
Testing
The system includes comprehensive testing:
Test Categories
- Environment Configuration - Validates all required variables
- Database Connection - Tests connectivity and schema
- Schema Functions - Validates PostgreSQL functions
- Traceability Manager - Tests all CRUD operations
Running Tests
# Run all tests
python test_traceability.py
# Test specific components
python test_traceability.py # Choose option 2 for DB only
Sample Data
Create sample traceability data for testing:
python test_traceability.py # Choose option 4
Troubleshooting
Common Issues
-
Database Connection Failed
- Check PostgreSQL is running
- Verify credentials in
.env - Test network connectivity
-
Schema Errors
- Run
database/schema.sqlmanually - Check PostgreSQL version (15+ recommended)
- Verify user permissions
- Run
-
Missing Dependencies
- Install requirements:
pip install -r requirements.txt - Check Python version (3.8+ required)
- Install requirements:
-
CloudSQL Issues
- Verify instance is running
- Check firewall rules
- Validate SSL configuration
Log Analysis
Enable detailed logging:
export LOG_LEVEL=DEBUG
python mcp_main.py
Security Considerations
-
Database Security
- Use strong passwords
- Enable SSL/TLS
- Restrict network access
-
API Tokens
- Store in environment variables
- Use least privilege access
- Rotate regularly
-
CloudSQL Security
- Enable authorized networks
- Use private IP when possible
- Enable audit logging
Support
For issues and questions:
- Check the test output:
python test_traceability.py - Review logs for detailed error messages
- Verify environment configuration
- Test database connectivity independently
License
This project is licensed under the MIT License.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file alm_traceability_mcp-1.0.1.tar.gz.
File metadata
- Download URL: alm_traceability_mcp-1.0.1.tar.gz
- Upload date:
- Size: 28.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e444db86fce709ebaab698208df7c498618abb05f8a0e1f43212266dee069667
|
|
| MD5 |
2e6a224150a4baa843aa197bac3b2650
|
|
| BLAKE2b-256 |
775acdbcfe7fa43208f17fea9ae36d7e6d8c074c4824d3759513a6e27468a7c0
|
File details
Details for the file alm_traceability_mcp-1.0.1-py3-none-any.whl.
File metadata
- Download URL: alm_traceability_mcp-1.0.1-py3-none-any.whl
- Upload date:
- Size: 28.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cd242c2c258fad6d4e2a0a85373e9f86746100fdcc99c838999bd038a5e9e745
|
|
| MD5 |
7e4d9832d867ea79f18cc9530cfc404d
|
|
| BLAKE2b-256 |
9bb8fe93914f7e8d556afed98292f872b09724a30c67857182a5f8342adc0693
|