trackmcp
Back to directory
osok

project-docs

View on GitHub

this is a MCP server that create uml text based class diagrams, project tree structure and a list of modules anf functions in the project to assist cursor in understanding the project.

2 stars PythonAI & Machine Learning Updated Sep 29, 2025

Documentation

MCP Docs Tools

A Node.js-based MCP (Model Context Protocol) tool server that provides three focused documentation generation tools for Python projects. Built as an npm package that can be installed directly from the Git repository.

Features

๐Ÿ”ง Three Powerful Tools

1. `create_class_diagram` - Analyzes Python files and generates UML class diagrams in PlantUML format

2. `create_tree_structure` - Creates clean directory tree structure documentation with smart exclusions

3. `create_module_functions` - Documents module-level functions with signatures, decorators, and type hints

๐Ÿš€ Key Benefits

  • Zero Configuration: Works out of the box with sensible defaults
  • Smart Exclusions: Automatically filters out cache, build, and IDE files
  • Rich Documentation: Captures type hints, decorators, docstrings, and inheritance
  • MCP Integration: Seamlessly integrates with AI assistants via Model Context Protocol
  • Hybrid Architecture: Node.js orchestration + Python AST parsing for reliability

Installation

bash
# Clone the repository
git clone https://github.com/your-username/mcp-docs-tools.git
cd mcp-docs-tools

# Install dependencies
npm install

# Install globally (optional)
npm install -g .

# Or run directly
npm start

Direct Installation from Git

bash
# Install directly from GitHub
npm install -g git+https://github.com/your-username/mcp-docs-tools.git

# Then run
mcp-docs-tools

Local Development

bash
git clone https://github.com/your-username/mcp-docs-tools.git
cd mcp-docs-tools
npm install
npm start

Requirements

  • Node.js โ‰ฅ18.0.0
  • Python 3.x (for AST parsing)
  • Git (for cloning the repository)

Python Interpreter Detection and Windows Support

The server automatically detects a working Python 3 interpreter at runtime. On Windows it prefers `py -3` when available, and falls back to `python` or `python3` if they resolve to Python 3. On macOS/Linux it prefers `python3`, then falls back to `python` if it is Python 3.

If no Python 3 interpreter is found, you will see an actionable error:

"Python 3 interpreter not found. Install Python 3 or set MCP_PYTHON (and optional MCP_PYTHON_ARGS). Tried: ..."

Environment Overrides (optional)

You can explicitly specify the interpreter and arguments:

  • `MCP_PYTHON`: command or absolute path (e.g., `py`, `python3`, `C:\\Python312\\python.exe`)
  • `MCP_PYTHON_ARGS`: space-separated arguments (e.g., `-3`)

Examples:

powershell
# Windows PowerShell
$env:MCP_PYTHON = "python"
$env:MCP_PYTHON_ARGS = "-3"
npm start
bash
# macOS/Linux bash
export MCP_PYTHON=py
export MCP_PYTHON_ARGS=-3
npm start

Usage

As MCP Server

Start the server to expose tools via Model Context Protocol:

bash
# If installed globally
mcp-docs-tools

# Or from the project directory
npm start

# Or run directly with node
node bin/server.js

The server will listen on stdin/stdout and expose three tools that can be called by MCP clients.

Tool Specifications

1. create_class_diagram

Purpose: Generate UML class diagrams from Python code

Parameters:

  • `project_path` (string, required): Root path of the Python project to analyze

Output:

  • File: `docs/uml.txt`
  • Format: PlantUML syntax
  • Content: Classes with public/private methods, attributes, and inheritance relationships

Example:

plantuml
@startuml
class MyClass {
  +public_attr: str
  -_private_attr: int
  --
  +__init__(self, name: str)
  +public_method(self, arg: int): bool
  -{static} _private_method(): None
}
@enduml

2. create_tree_structure

Purpose: Generate project directory tree structure

Parameters:

  • `project_path` (string, required): Root path of the project to analyze

Output:

  • File: `docs/tree-structure.txt`
  • Format: Unicode box-drawing tree
  • Content: Complete file/directory structure with smart exclusions

Example:

code
my-project
โ”œโ”€โ”€ src/
โ”‚   โ”œโ”€โ”€ main.py
โ”‚   โ””โ”€โ”€ utils/
โ”‚       โ””โ”€โ”€ helpers.py
โ”œโ”€โ”€ tests/
โ”‚   โ””โ”€โ”€ test_main.py
โ””โ”€โ”€ README.md

3. create_module_functions

Purpose: Document module-level functions and signatures

Parameters:

  • `project_path` (string, required): Root path of the Python project to analyze

Output:

  • File: `docs/module-functions.txt`
  • Format: Hierarchical markdown documentation
  • Content: Functions organized by module with full signatures, decorators, and docstrings

Example:

markdown
## Module: src.utils.helpers

### `async def process_data(data: List[str], timeout: int = 30) -> Dict[str, Any]`

**Decorators:**
- `@retry(max_attempts=3)`

**Description:**
Process a list of data items with optional timeout.

**Line:** 42

Architecture

Hybrid Node.js + Python Approach

The tool uses a hybrid architecture that combines the best of both worlds:

  • Node.js Server: Handles MCP protocol, tool registration, and process orchestration
  • Python Scripts: Perform robust AST parsing and documentation generation
  • Clean Separation: Protocol handling separate from parsing logic

Project Structure

code
mcp-docs-tools/
โ”œโ”€โ”€ package.json              # npm package configuration
โ”œโ”€โ”€ bin/
โ”‚   โ””โ”€โ”€ server.js             # Main MCP server entry point
โ”œโ”€โ”€ src/
โ”‚   โ”œโ”€โ”€ server.js             # MCP server implementation
โ”‚   โ”œโ”€โ”€ tools/                # Tool implementations
โ”‚   โ”‚   โ”œโ”€โ”€ class-diagram.js  # UML generation wrapper
โ”‚   โ”‚   โ”œโ”€โ”€ tree-structure.js # Tree generation wrapper
โ”‚   โ”‚   โ””โ”€โ”€ module-functions.js # Function docs wrapper
โ”‚   โ””โ”€โ”€ config/
โ”‚       โ””โ”€โ”€ exclusions.js     # Default exclusion patterns
โ”œโ”€โ”€ python/
โ”‚   โ”œโ”€โ”€ generate_uml.py       # Python AST parsing for classes
โ”‚   โ”œโ”€โ”€ generate_tree.py      # Directory tree generation
โ”‚   โ”œโ”€โ”€ generate_functions.py # Function parsing and documentation
โ”‚   โ””โ”€โ”€ requirements.txt      # Python dependencies (none needed)
โ””โ”€โ”€ README.md

Smart Exclusions

The tools automatically exclude common files and directories that shouldn't be documented:

Python

  • `__pycache__`, `*.pyc`, `*.pyo`, `*.pyd`
  • `build`, `dist`, `eggs`, `*.egg-info`
  • Virtual environments: `venv`, `.venv`, `env`, `virtualenv`

Development Tools

  • Version control: `.git`, `.svn`, `.hg`
  • IDEs: `.idea`, `.vscode`, `.cursor`
  • Testing: `.pytest_cache`, `.coverage`, `.tox`

Build & Package Managers

  • `node_modules`, `target`, `out`, `bin`
  • `package-lock.json`, `yarn.lock`, `Pipfile.lock`

OS & Temporary

  • `.DS_Store`, `Thumbs.db`, `*.tmp`, `*.log`

Integration with AI Assistants

Cursor IDE

The configuration depends on how you installed the tools:

Create a `.cursorrules` file in your projects and add this to your Cursor MCP configuration:

json
{
  "mcpServers": {
    "docs-tools": {
      "command": "node",
      "args": ["/path/to/mcp-docs-tools/bin/server.js"],
      "cwd": "/path/to/mcp-docs-tools"
    }
  }
}

Replace `/path/to/mcp-docs-tools` with the actual path where you cloned the repository.

For example:

  • macOS/Linux: `"/Users/yourname/projects/mcp-docs-tools"`
  • Windows: `"C:\\Users\\yourname\\projects\\mcp-docs-tools"`

Option B: If you installed globally with `npm install -g`

json
{
  "mcpServers": {
    "docs-tools": {
      "command": "mcp-docs-tools"
    }
  }
}

.cursorrules file content (for any installation method)

Create this `.cursorrules` file in your Python projects:

markdown
# Documentation Tools Integration

## Available MCP Tools
- `create_class_diagram` - Generate UML class diagrams  
- `create_tree_structure` - Generate directory tree
- `create_module_functions` - Document module functions

## Usage
Run these tools at session start to generate documentation in `docs/` directory.
Reference the generated files to understand codebase structure.

## Generated Files
- `docs/uml.txt` - PlantUML class diagrams
- `docs/tree-structure.txt` - Directory structure  
- `docs/module-functions.txt` - Function documentation

Claude Desktop

Add to your Claude Desktop MCP configuration:

json
{
  "mcpServers": {
    "docs-tools": {
      "command": "node",
      "args": ["/path/to/mcp-docs-tools/bin/server.js"],
      "cwd": "/path/to/mcp-docs-tools"
    }
  }
}

Replace `/path/to/mcp-docs-tools` with the actual path where you cloned the repository.

Option B: If you installed globally with `npm install -g`

json
{
  "mcpServers": {
    "docs-tools": {
      "command": "mcp-docs-tools"
    }
  }
}

Quick Setup Guide

1. Clone and install (recommended):

bash
git clone https://github.com/your-username/mcp-docs-tools.git
   cd mcp-docs-tools
   npm install

2. Find your installation path:

bash
pwd
   # Copy this path for your MCP configuration

3. Update your MCP config with the path from step 2

4. Test the tools in your Python projects!

Error Handling

The tools include comprehensive error handling:

  • Python Process Failures: Detailed error messages with stdout/stderr
  • Missing Dependencies: Clear instructions for Python installation
  • File Permission Issues: Graceful handling with informative messages
  • Invalid Project Paths: Path validation before processing

Performance

  • Lightweight: Minimal memory footprint with short-lived Python processes
  • Fast: Efficient AST parsing with smart file filtering
  • Scalable: Handles large codebases with thousands of files
  • Concurrent: Multiple tools can run simultaneously

Contributing

1. Fork the repository

2. Create a feature branch

3. Make your changes

4. Add tests if applicable

5. Submit a pull request

License

MIT License - see LICENSE file for details.

Support

  • Issues: Report bugs and feature requests on GitHub
  • Documentation: Full API documentation available in the repository
  • Examples: Sample projects and usage patterns in the examples directory

Made with โค๏ธ for the Python development community

Frequently asked questions

What is project-docs?

project-docs is this is a MCP server that create uml text based class diagrams, project tree structure and a list of modules anf functions in the project to assist cursor in understanding the project.

How do I install project-docs?

Open the GitHub repository and follow its README. Most MCP servers are added to your client's MCP config, then called by your agent.

Is project-docs open source?

Yes โ€” it is hosted on GitHub at https://github.com/osok/project-docs and has 2 stars.

Related MCP tools

All-Hands-AIopenhands

๐Ÿ™Œ OpenHands: Code Less, Make More for the Model Context Protocol. Enhance AI assistants with powerful integrations. Python-based implementation.

64,677 Python
agentartificial-intelligencechatgpt+6
mem0aimem0

Universal memory layer for AI Agents; Announcing OpenMemory MCP - local and secure memory management. Python-based implementation.

42,646 Python
agentsaiai-agents+12
zhayujiechatgpt-on-wechat

ๅŸบไบŽๅคงๆจกๅž‹ๆญๅปบ็š„่Šๅคฉๆœบๅ™จไบบ๏ผŒๅŒๆ—ถๆ”ฏๆŒ ๅพฎไฟกๅ…ฌไผ—ๅทใ€ไผไธšๅพฎไฟกๅบ”็”จใ€้ฃžไนฆใ€้’‰้’‰ ็ญ‰ๆŽฅๅ…ฅ๏ผŒๅฏ้€‰ๆ‹ฉChatGPT/Claude/DeepSeek/ๆ–‡ๅฟƒไธ€่จ€/่ฎฏ้ฃžๆ˜Ÿ็ซ/้€šไน‰ๅƒ้—ฎ/ Gemini/GLM-4/Kimi/LinkAI๏ผŒ่ƒฝๅค„็†ๆ–‡ๆœฌใ€่ฏญ้Ÿณๅ’Œๅ›พ็‰‡๏ผŒ่ฎฟ้—ฎๆ“ไฝœ็ณป็ปŸๅ’Œไบ’่”็ฝ‘๏ผŒๆ”ฏๆŒๅŸบไบŽ่‡ชๆœ‰็Ÿฅ่ฏ†ๅบ“่ฟ›่กŒๅฎšๅˆถไผไธšๆ™บ่ƒฝๅฎขๆœใ€‚

39,573 Python
aiai-agentchatgpt+17
assafelovicgpt-researcher

An LLM agent that conducts deep research (local and web) on any given topic and generates a long report with citations. Built for the Model Context Protocol to

24,026 Python
agentaiautomation+8
jlowinfastmcp

๐Ÿš€ The fast, Pythonic way to build MCP servers and clients Trusted by 19900+ developers. Trusted by 19900+ developers. Trusted by 19900+ developers.

19,927 Python
agentsfastmcpllms+6
1Panel-devmaxkb

๐Ÿ”ฅ MaxKB is an open-source platform for building enterprise-grade agents. MaxKB ๆ˜ฏๅผบๅคงๆ˜“็”จ็š„ๅผ€ๆบไผไธš็บงๆ™บ่ƒฝไฝ“ๅนณๅฐใ€‚ for the Model Context Protocol. Enhance AI assistants with po

19,062 Python
agentagentic-aichatbot+11

Run your own MCP server? See who uses it and what to fix.

Measure it with TrackMCP