Skip to main content

AI-powered documentation generator for repos and local projects — MCP server + CLI, any LLM provider or keyless via MCP host sampling.

Project description

AI Document Creator

CI License: MIT Python 3.11+

AI-powered documentation generator, exposed as an MCP server and a CLI. Point it at a GitHub repository or a local project and it writes per-file docs plus a synthesized README.md — using any LLM (Anthropic, OpenAI, Azure OpenAI, AWS Bedrock, Ollama) with your key, or your MCP host's own model via sampling with no key at all.

📖 New here? The step-by-step guide for every setup is in USAGE.md.

Use it in 60 seconds

Option A — run it locally in your MCP host (recommended)

With uv installed, no clone, no venv:

# Claude Code
claude mcp add ai-doc-creator -- uvx --from ai-doc-creator ai-doc-creator-mcp

Claude Desktop / Cursor / any MCP host (mcpServers JSON):

{
  "mcpServers": {
    "ai-doc-creator": {
      "command": "uvx",
      "args": ["--from", "ai-doc-creator", "ai-doc-creator-mcp"],
      "env": { "ANTHROPIC_API_KEY": "sk-..." }
    }
  }
}

The env block is optional — leave it out and the server uses your MCP host's model via sampling (zero API cost).

Until the package is on PyPI you can substitute uvx --from git+https://github.com/dharmikraval1/ai-document-creator ai-doc-creator-mcp.

Option B — use a hosted endpoint (nothing to install)

Point your MCP host at a deployment's Streamable HTTP endpoint and bring your own key in headers:

{
  "mcpServers": {
    "ai-doc-creator": {
      "type": "http",
      "url": "https://<your-deployment-host>/mcp",
      "headers": {
        "X-Provider-API-Key": "sk-...",
        "X-Provider": "anthropic"
      }
    }
  }
}

Keys travel in headers, never in tool arguments, so they stay out of chat transcripts and logs. Legacy clients can still connect via https://<host>/sse.

Option C — GitHub Action (docs that update themselves)

- uses: dharmikraval1/ai-document-creator@v2
  env:
    ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}

Regenerates your repo's docs on every push — full workflow example in USAGE.md.

Option D — CLI

pip install ai-doc-creator     # or: pip install git+https://github.com/dharmikraval1/ai-document-creator
ai-doc-creator --repo https://github.com/user/repo --output docs
ai-doc-creator --path . --provider ollama --model llama3.1

The CLI needs a provider key (there is no MCP host to sample from).

MCP tools

Tool What it does
document_repo(repo_url, ...) Clone a GitHub repo and document it. push_as_pr=True opens a PR with the docs; return_docs=True inlines the generated markdown in the response (capped by MAX_INLINE_DOC_KB).
document_local_project(path, ...) Document a folder on the machine the server runs on. Disabled on hosted deployments unless the operator sets LOCAL_ROOT.
check_doc_drift(path, output_dir) Report new/modified/deleted files since the last documentation run (no LLM calls).

All documentation runs are incremental by default: a content-hash manifest skips unchanged files, so re-runs only pay for what changed.

Diagrams & output profiles

Every generated README ends with Mermaid architecture diagrams — a project-structure chart and a module-dependency graph computed by static analysis (Python + JS/TS imports), so they're always syntactically valid. Complex files also get model-drawn flow charts, and every model-drawn diagram is validated before shipping (invalid ones are downgraded to plain text, never broken pages). Disable with diagrams=false / --no-diagrams.

Pick a documentation style with profile (--profile on the CLI):

Profile Focus
readme (default) Classic README: overview, install, usage
api API reference: signatures, params, returns, errors
architecture Components, data flow, design decisions + diagrams
tutorial Guided walkthrough for newcomers

How it works

Two independent choices over one async pipeline:

  • SourceGitSource (clone a URL) or LocalSource (read a path).
  • BackendProviderBackend (any provider, via env key or per-request header key) or SamplingBackend (the MCP host's model). pick_backend chooses: an explicit key wins; otherwise a configured provider; otherwise host sampling; otherwise a clear error.

The pipeline traverses files, generates per-file docs concurrently (bounded by a semaphore), then synthesizes a top-level README.md.

LLM providers

Provider Configure via
Anthropic ANTHROPIC_API_KEY env, or X-Provider-API-Key header
OpenAI OPENAI_API_KEY env, or header
Azure OpenAI AZURE_OPENAI_API_KEY + endpoint/deployment (see .env.example), or header
AWS Bedrock AWS_ACCESS_KEY_ID / AWS_SECRET_ACCESS_KEY (env only)
Ollama (local) provider="ollama" (no key)
None MCP host sampling — the host's model writes the docs

Hosting your own public endpoint

Deploy to Render

One click via the included render.yaml blueprint — it enables auto-deploy on every push to main, health checks, and safe public defaults (BYOK_ONLY=true, rate limiting on, Render hostname auto-allowed).

The Dockerfile also runs anywhere that supplies a PORT (Fly.io, Railway, ...). The server serves Streamable HTTP at /mcp, legacy SSE at /sse, and a health probe at /health.

Recommended env for a public deployment:

Variable Value Why
MCP_ALLOWED_HOSTS your public hostname (e.g. your-app.onrender.com) DNS-rebinding protection rejects unknown Host headers
BYOK_ONLY true never spend your keys on strangers — users bring keys in headers or use sampling
RATE_LIMIT_RPM 20 (default) per-client request cap; 0 disables
LOG_FORMAT json structured logs
MCP_TRANSPORT both (default) / streamable-http / sse which HTTP transports to serve

Security model

  • Keys: header-only intake for remote users; passed explicitly to the provider client; never written to env, logs, or repr(); BYOK_ONLY=true guarantees the server's own keys are never used for requests.
  • SSRF: repo URLs must be HTTPS and must not resolve to private/reserved address space; DNS-rebinding protection on the HTTP transports.
  • Filesystem: hosted deployments refuse local-filesystem tools (unless LOCAL_ROOT opts in) and write repo docs to per-request temp dirs — callers can't read or write server paths.
  • Abuse limits: per-client rate limit, bounded pipeline concurrency, pipeline timeout, repo-size cap, per-file-size cap.

Development

python -m venv .venv && source .venv/bin/activate   # Windows: .venv\Scripts\activate
pip install -e ".[dev]"
pytest -q          # 157 tests
flake8 && mypy ai_doc_creator --ignore-missing-imports

Design specs, implementation plans, and phase status live in planning/.

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ai_doc_creator-2.2.0.tar.gz (47.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ai_doc_creator-2.2.0-py3-none-any.whl (34.9 kB view details)

Uploaded Python 3

File details

Details for the file ai_doc_creator-2.2.0.tar.gz.

File metadata

  • Download URL: ai_doc_creator-2.2.0.tar.gz
  • Upload date:
  • Size: 47.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for ai_doc_creator-2.2.0.tar.gz
Algorithm Hash digest
SHA256 02faa5dbd7d6bd5bb6e83df747fbb9232963f160b30798e9d439077cdd7be331
MD5 96c1d4a534c4c6cbd7445846742a33c6
BLAKE2b-256 61d8310f5f3b87185f25c1903c08e3dd5d86dad615088f8111855b381c1bbe1e

See more details on using hashes here.

Provenance

The following attestation bundles were made for ai_doc_creator-2.2.0.tar.gz:

Publisher: publish.yml on dharmikraval1/ai-document-creator

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file ai_doc_creator-2.2.0-py3-none-any.whl.

File metadata

  • Download URL: ai_doc_creator-2.2.0-py3-none-any.whl
  • Upload date:
  • Size: 34.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for ai_doc_creator-2.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 b7d981da6f2483f3b13d62698d9adfbf603cd1161b4bd99169c5829ecc8657f7
MD5 f52b2f8ddb8ef3df833e1639d3492b7f
BLAKE2b-256 89e14f4c22837048500afde8a8daa9446574f16f8f13ccdaa0ad4b27596ecc79

See more details on using hashes here.

Provenance

The following attestation bundles were made for ai_doc_creator-2.2.0-py3-none-any.whl:

Publisher: publish.yml on dharmikraval1/ai-document-creator

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page