
rtuin/mcp-mermaid-validator
Developer tools이 페이지는 AI로 자동 번역되었습니다. 기술적인 세부 사항은 원문을 확인하세요. 원문 보기
rtuin/mcp-mermaid-validator는 MCP 서버 후보가 https://github.com/rtuin/mcp-mermaid-validator.에서 수입되었습니다
개요
rtuin/mcp-mermaid-validator는 MCP 서버 후보가 https://github.com/rtuin/mcp-mermaid-validator.에서 수입되었습니다
개요(AI 번역)
Mermaid 다이어그램을 검증하고 렌더링하는 모델 Context Protocol 서버. 이 서버는 유효한 LLMs를 가능하게 하고 Mermaid 도표를 렌더링합니다.
사용법
빠른 시작
MCP 클라이언트를 구성하여 Mcp 서버 파일에 추가하여 Mermaid Validator를 사용할 수 있습니다.
건축
고급 건축
이 프로젝트는 간단한 TypeScript Node.js 애플리케이션으로 구성되어 있습니다.
- Main Application: Mermaid 다이어그램을 검증하고 렌더링 된 PNG 출력을 반환하는 Node.js 서비스
- ** MCP 통합 **: MCP 호환 클라이언트에 기능을 노출하는 Model Context Protocol SDK를 사용합니다.
- **Mermaid CLI 통합 **: Mermaid CLI 도구를 활용하여 다이어그램 검증 및 렌더링 수행
코드 구조
성분 기능
MCP 서버 (주요 성분)
핵심 기능은 src/main.ts에서 구현됩니다. 이 성분:
- MCP 서버 인스턴스 생성
validateMermaid] Mermaid 다이어그램 구문을 수용하는 도구- Mermaid CLI를 사용하여 검증 및 렌더링 다이어그램
- 유효성 검사 결과 및 렌더링 PNG (유효한 경우)
- 적절한 오류 메시지가있는 오류 케이스 처리
자료 교류
- 명세.
이 페이지는 AI로 자동 번역되었습니다. 기술적인 세부 사항은 원문을 확인하세요.
README
원문 README의 일부입니다. 원문 보기.
MCP Server: Mermaid Validator
A Model Context Protocol server that validates and renders Mermaid diagrams. This server enables LLMs to validate and render Mermaid diagrams.
Usage
Quick Start
You can configure your MCP client to use the Mermaid Validator by adding it to your mcp servers file:
{
"mcpServers": {
"mermaid-validator": {
"command": "npx",
"args": [
"-y",
"@rtuin/mcp-mermaid-validator@latest"
]
}
}
}
Architecture
High-Level Architecture
This project is structured as a simple TypeScript Node.js application that:
- Main Application: A Node.js service that validates Mermaid diagrams and returns rendered PNG output
- MCP Integration: Uses the Model Context Protocol SDK to expose functionality to MCP-compatible clients
- Mermaid CLI Integration: Leverages the Mermaid CLI tool to perform diagram validation and rendering
Code Structure
mcp-mermaid-validator/
├── dist/ # Compiled JavaScript output
│ └── main.js # Compiled main application
├── src/ # TypeScript source code
│ └── main.ts # Main application entry point
├── node_modules/ # Dependencies
├── package.json # Project dependencies and scripts
├── package-lock.json # Dependency lock file
├── tsconfig.json # TypeScript configuration
├── eslint.config.js # ESLint configuration
├── .prettierrc # Prettier configuration
└── README.md # Project documentation
Component Functionality
MCP Server (Main Component)
The core functionality is implemented in src/main.ts. This component:
- Creates an MCP server instance
- Registers a
validateMermaidtool that accepts Mermaid diagram syntax - Uses the Mermaid CLI to validate and render diagrams
- Returns validation results and rendered PNG (if valid)
- Handles error cases with appropriate error messages
Data Flow
- Input: Mermaid diagram syntax as a string
- Processing:
- The diagram is passed to the Mermaid CLI via stdin
- The CLI validates the syntax and renders a PNG if valid
- Output and errors are captured from stdout/stderr
- Output:
- Success: Text confirmation + rendered PNG as base64-encoded image
- Failure: Error message with details about the validation failure
Dependencies
External Libraries
- @modelcontextprotocol/sdk: SDK for implementing Model Context Protocol
- @mermaid-js/mermaid-cli: CLI tool for validating and rendering Mermaid diagrams
- zod: Schema validation library for TypeScript
Development Dependencies
- typescript: TypeScript compiler
- eslint: Linting utility
- prettier: Code formatting
API Specification
validateMermaid Tool
Purpose: Validates a Mermaid diagram and returns the rendered PNG if valid
Parameters:
설치
npx -y @rtuin/mcp-mermaid-validator@latest설정
{
"mcpServers": {
"mermaid-validator": {
"command": "npx",
"args": [
"-y",
"@rtuin/mcp-mermaid-validator@latest"
]
}
}
}