Metadata-Version: 2.4
Name: architecture-discovery-mcp
Version: 0.3.0
Summary: Auto-discover enterprise architecture artifacts from Java source code
License-Expression: MIT
Keywords: architecture,java,mcp,enterprise,TOGAF,code-analysis
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: Topic :: Software Development :: Documentation
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Requires-Python: >=3.11
Description-Content-Type: text/markdown
Requires-Dist: streamlit>=1.28.0
Requires-Dist: javalang>=0.13.0
Requires-Dist: openpyxl>=3.1.0
Requires-Dist: python-pptx>=0.6.21
Requires-Dist: pandas>=2.0.0
Requires-Dist: pyyaml>=6.0
Requires-Dist: anthropic>=0.39.0
Requires-Dist: mcp>=1.0.0
Provides-Extra: dev
Requires-Dist: pytest>=7.0.0; extra == "dev"
Requires-Dist: pytest-cov>=4.0.0; extra == "dev"
Requires-Dist: pytest-asyncio>=0.23.0; extra == "dev"

# Architecture Discovery Engine

Auto-discover enterprise architecture artifacts from Java/Maven source code. Scan your project and generate TOGAF-standard application architecture deliverables in seconds.

## What It Does

Point it at a Java/Maven project and get:

- **AA-01** Application Module Inventory (Excel)
- **AA-02** Function Item Inventory (Excel)
- **AA-03** Sub-function Inventory (Excel)
- **AA-04** Function Distribution (Excel)
- **AA-05** Integration Inventory (Excel)
- **AA-07** Application Architecture Diagram (PPTX)
- **AA-08** Application Integration Diagram (PPTX)

All generated from static analysis — no runtime required, no code leaves your machine.

## Install

```bash
pip install architecture-discovery-mcp
```

Requires Python 3.11+.

## Usage

### As an MCP Server (recommended)

The engine runs as an [MCP](https://modelcontextprotocol.io/) server over stdio. Configure it in your AI IDE:

**Claude Code** (`~/.claude.json`):
```json
{
  "mcpServers": {
    "architecture-discovery": {
      "command": "architecture-discovery-mcp"
    }
  }
}
```

**Cursor** (`.cursor/mcp.json`):
```json
{
  "mcpServers": {
    "architecture-discovery": {
      "command": "architecture-discovery-mcp"
    }
  }
}
```

**VS Code** (`.vscode/settings.json`):
```json
{
  "mcp": {
    "servers": {
      "architecture-discovery": {
        "command": "architecture-discovery-mcp"
      }
    }
  }
}
```

Then ask your AI assistant naturally:

> "Scan D:/projects/my-java-app and generate the application architecture artifacts"

### Available MCP Tools

| Tool | Description |
|------|-------------|
| `scan_project_tool` | Scan project structure, return modules/frameworks overview |
| `generate_app_architecture_tool` | Generate full AA artifact set (Excel + PPTX) |
| `export_intermediate_data` | Export structured analysis as JSON |
| `generate_data_architecture` | DA artifacts (coming soon) |
| `generate_tech_architecture` | TA artifacts (coming soon) |

All tools accept an optional `locale` parameter (`"zh"` or `"en"`, default `"zh"`).

### As a Python Library

```python
from pathlib import Path
from src.scanner.project_scanner import scan_project
from src.analyzers.module_analyzer import analyze_modules
from src.analyzers.api_analyzer import analyze_apis
from src.analyzers.integration_analyzer import analyze_integrations
from src.generators.app_architecture_generator import generate_app_architecture
from src.generators.aa07_generator import generate_aa07
from src.generators.aa08_generator import generate_aa08

project = scan_project(Path("your-java-project"))
project = analyze_modules(project)
endpoints = analyze_apis(project)
integrations = analyze_integrations(project)

out = Path("output")
generate_app_architecture(project, endpoints, integrations, out, locale="en")
generate_aa07(project, out, locale="en")
generate_aa08(project, integrations, out, locale="en")
```

## Supported Projects

- Java/Maven projects (must have `pom.xml`)
- Spring Boot / Spring Cloud microservices
- Feign client integration detection
- Nested multi-module projects (e.g. RuoYi-Cloud style)

## Internationalization

Artifacts can be generated in Chinese (`locale="zh"`, default) or English (`locale="en"`). This controls:

- Excel column headers and sheet names
- Cell values (layer names, status labels)
- PPTX slide titles and diagram labels
- Font selection (Microsoft YaHei for Chinese, Calibri for English)

## Security

- Runs locally via stdio — no network exposure
- Source code never leaves your machine
- Exported JSON contains only structural metadata (class names, API paths, annotations), not source code

## Development

```bash
git clone <repo-url>
cd architecture-discovery-engine
pip install -e ".[dev]"
pytest tests/ -v
```

## License

MIT
