
Scast
@davidkingzyb
Static Code Analysis and Visualization. Convert Code to UML and Flow Diagram and explain by AI.
Overview
What is Scast?
Scast is a Model Context Protocol server that provides static code analysis and visualization. It converts source code into UML diagrams, flowcharts, and AST trees, supporting multiple programming languages via TreeSitter. It is intended for developers who want to analyze, summarize, and visualize code structures within an AI client.
How to use Scast?
Clone the repository, run npm install, then configure the MCP server in your AI client with the command node and the path to /YOUR_INSTALL_DIR/SCAST/mcp/index.js followed by one or more allowed workspace directories. The server exposes two tools: scast_analysis for generating diagrams and keyword explanations, and scast_retriever for searching code definitions.
Key features of Scast
- Converts code into UML diagrams and flowcharts.
- Supports C#, JavaScript, Python, TypeScript, C, and C++.
- Uses TreeSitter for parsing and Mermaid/D3 for visualization.
- Offers two MCP tools: analysis and retrieval.
- Can be tried online or run locally as an MCP server.
- Integrates with Ollama for AI-assisted analysis.
Use cases of Scast
- Analyze a folder of source code and generate AST trees to understand its structure.
- Retrieve definitions of classes, methods, or fields using keywords from the AST.
- Produce visual diagrams (UML, flowcharts) to document code architecture.
- Power an AI assistant with code visualization and retrieval-augmented generation.
FAQ from Scast
What languages does Scast support?
It supports C#, JavaScript, Python, TypeScript, C, and C++ by default, with additional languages available via TreeSitter customization.
How do I install and configure Scast as an MCP server?
Clone the repo, run npm install, then add the configuration block to your MCP client’s settings, specifying the path to index.js and allowed workspace directories.
Does Scast require an internet connection?
No; the MCP server runs locally. Online demo is available, but the MCP server works offline after installation.
What are the transport and authentication requirements?
The README does not specify transport or authentication details; it uses the standard MCP transport via command invocation and file system access to directories you provide.
How do I use the scast_retriever tool?
Provide the file path of the source code folder, then supply a keyword (class name, method name, or field name) to retrieve the corresponding source code definition.