architecture.html•6.17 kB
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>MCP Prompt Enhancer Architecture</title>
<style>
body {
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
line-height: 1.6;
color: #333;
max-width: 900px;
margin: 0 auto;
padding: 20px;
}
h1, h2, h3 {
color: #2c3e50;
}
.mermaid {
margin: 30px 0;
text-align: center;
}
.component-section {
margin: 30px 0;
}
.data-flow {
margin: 30px 0;
}
.data-flow ol {
padding-left: 25px;
}
</style>
<!-- Include Mermaid.js library -->
<script src="https://cdn.jsdelivr.net/npm/mermaid/dist/mermaid.min.js"></script>
<script>
// Initialize Mermaid with default configuration
document.addEventListener('DOMContentLoaded', function() {
mermaid.initialize({
startOnLoad: true,
theme: 'default',
securityLevel: 'loose',
flowchart: {
useMaxWidth: false,
htmlLabels: true
}
});
});
</script>
</head>
<body>
<h1>MCP Prompt Enhancer Architecture</h1>
<p>This document describes the architecture of the MCP Prompt Enhancer server, which is designed to intelligently enhance prompts with relevant context from the user's project.</p>
<h2>Architecture Diagram</h2>
<div class="mermaid">
flowchart TD
subgraph Client["Client"]
Cline["Cline (Claude CLI)"]
MCPConfig["MCP Server Registry"]
end
subgraph Server["MCP Prompt Enhancer Server"]
STDIO["STDIO Interface"]
PE["PromptEnhancer"]
PCM["ProjectContextManager"]
TT["TaskTracker"]
Logger["Logger"]
end
subgraph Features["Core Features"]
CF1["Framework Detection"]
CF2["Task Type Inference"]
CF3["Focus Area Detection"]
CF4["Context Prioritization"]
CF5["Adaptive Prompt Generation"]
end
Cline -- "Registers" --> MCPConfig
MCPConfig -- "Configures" --> Cline
Cline -- "JSON Request via STDIO" --> STDIO
STDIO -- "JSON Response via STDIO" --> Cline
STDIO -- "Process Request" --> PE
PE -- "Get Project Context" --> PCM
PE -- "Track Task Context" --> TT
PCM -- "Analyze Files" --> FS["File System"]
PCM -- "Git History" --> Git["Git Repository"]
PE -- "Log Operations" --> Logger
PCM -- "Log Operations" --> Logger
TT -- "Log Operations" --> Logger
PCM --> CF1
TT --> CF2
TT --> CF3
PE --> CF4
PE --> CF5
</div>
<h2>Component Descriptions</h2>
<div class="component-section">
<h3>Client Side</h3>
<ul>
<li><strong>Cline (Claude CLI)</strong>: Anthropic's official CLI tool for Claude that sends requests to and receives responses from the MCP Prompt Enhancer server via STDIO.</li>
<li><strong>MCP Server Registry</strong>: Configuration that registers the Prompt Enhancer as an available MCP server for Cline to utilize.</li>
</ul>
</div>
<div class="component-section">
<h3>Server Side</h3>
<ul>
<li><strong>STDIO Interface</strong>: Handles JSON-based communication over standard input/output streams.</li>
<li><strong>PromptEnhancer</strong>: Core component that combines project context with the user's prompt.</li>
<li><strong>ProjectContextManager</strong>: Analyzes and manages project-level context including file structure, dependencies, and code patterns.</li>
<li><strong>TaskTracker</strong>: Detects task type and focus area from the prompt and tracks relevant files.</li>
<li><strong>Logger</strong>: Provides logging functionality across components.</li>
</ul>
</div>
<div class="component-section">
<h3>Core Features</h3>
<ul>
<li><strong>Framework Detection</strong>: Identifies frameworks and libraries used in the project.</li>
<li><strong>Task Type Inference</strong>: Determines the type of task (debugging, creation, etc.) from the prompt.</li>
<li><strong>Focus Area Detection</strong>: Identifies the part of the codebase the prompt is focused on.</li>
<li><strong>Context Prioritization</strong>: Selects the most relevant context based on task type and focus area.</li>
<li><strong>Adaptive Prompt Generation</strong>: Combines the original prompt with selected context.</li>
</ul>
</div>
<h2>Data Flow</h2>
<div class="data-flow">
<ol>
<li>Cline sends a JSON request to the MCP Prompt Enhancer server via STDIO</li>
<li>The server processes the request based on the action type</li>
<li>For <code>enhance_prompt</code>, the server:
<ul>
<li>Analyzes the project context if needed</li>
<li>Determines task type and focus area</li>
<li>Selects relevant context</li>
<li>Enhances the prompt with the selected context</li>
</ul>
</li>
<li>The server returns a JSON response with the enhanced prompt</li>
<li>Cline receives the response and uses the enhanced prompt with Claude to provide better assistance to the user</li>
</ol>
</div>
</body>
</html>