md-structure
This server does not currently have a deployable release on Glama. Follow the repository's setup instructions to install and configure it for your MCP client, including any required credentials and local dependencies.
MD-Structure
Agent-Native Project Architecture Decision Engine, Markdown Scaffolder, MCP Server & Context-Governance Auditor — Created by Ayazelrico.
Built from the ground up for AI coding agents — solving the exact problem developers hit when starting a project from an idea: How many
.mdfiles do we need? Which ones? Why does each exist (and why were others skipped)? In what order should the agent author and load them?
Why MD-Structure Exists
When a user describes a software idea to an AI coding agent, two failure modes dominate:
Under-specification (0–1 MD files): Critical decisions remain trapped in chat history. After context compaction, the agent hallucinates column names, breaks API envelopes, misses tenant isolation, and forgets invariants.
Over-specification (20+ bloated human docs): Massive narrative specs burn 40% of the context window before coding starts, contradict each other across files, and drift rapidly.
MD-Structure replaces guesswork with a deterministic, zero-dependency local Context Engineering engine:
27 Canonical Agent-Native Markdown Archetypes across 6 architectural layers (
bootstrap,product,system,engineering,operations,governance).4 Complexity Tiers (
T0–T3):T0Micro / Utility → 2–4 MDs (~1.2k–3.8k total tokens)T1Focused MVP → 4–7 MDs (~3.5k–8.5k total tokens)T2Production Product → 7–12 MDs (~8k–17k total tokens)T3Enterprise / Distributed Platform → 11–16 MDs (~15k–28k total tokens)
Progressive Disclosure by Default: Only
AGENTS.mdisload_policy: always(capped <= 1,600 tokens). Every other.mdcarries machine-readable YAML frontmatter (load_policy,token_budget,depends_on,authority,read_triggers,update_triggers).Explicit Exclusion Ledger (
docs/00-CONTEXT-MAP.md): Records both why each active MD exists (the exact agent failure mode it prevents) and why every omitted catalog archetype was intentionally skipped.DAG Authoring Navigator (
md-structure next): Feeds the agent one.mdfile at a time in strict topological dependency order (AGENTS.md→01-PRD.md→02-ARCHITECTURE.md→03-DATA-MODEL.md→ ...).Pre-Code Governance Auditor (
md-structure audit): Scores readiness0–100, detects unresolved<!-- AGENT:FILL -->slots, token-budget bloat,AGENTS.mdrouting drift, broken internal links, and orphaned files.Native MCP Server (
md-structure mcp) + Drop-InSKILL.md: Zero runtime dependencies, sub-50ms startup, works offline with Claude Code, Antigravity, Cursor, Codex, Windsurf, and Cline.
Related MCP server: Blueprint MCP
Requirements
Node.js
>= 20.0.0Zero external runtime dependencies (runs immediately with no
npm installrequired).
Optional global CLI link:
npm linkOr run directly:
node bin/md-structure.js --helpQuick Start (Agent-First CLI)
Every command supports --json for strict machine-readable stdout output.
1. Check Ambiguities (Adaptive Discovery)
md-structure discover "Build an invoicing platform for agencies" --jsonReturns only the 2–5 high-leverage questions that actually change which .md contracts are needed, mapped to impactedDocs.
2. Analyze an Idea (Answers: How Many? Which? Why?)
md-structure analyze "Multi-tenant B2B SaaS invoicing platform with RBAC, Stripe billing, webhooks, PostgreSQL, and an AI expense categorization agent" --jsonOr analyze from a structured Intake Profile JSON:
md-structure analyze --profile examples/saas-platform-idea.json --show-excluded3. Scaffold the Complete Markdown Architecture
md-structure init --profile examples/saas-platform-idea.json --out ./workspace-demo --shims claude,cursor --jsonGenerates:
AGENTS.md— Ultra-lean always-on agent control plane, routing table, and capability-tailored invariantsdocs/00-CONTEXT-MAP.md— Active MD matrix, Mermaid dependency DAG, token ledger, and excluded MDs tableAll selected
docs/*.mdfiles with strict YAML frontmatter and structured<!-- AGENT:FILL ... -->slotsOptional thin shims (
CLAUDE.md,.cursor/rules/md-structure.mdc,.github/copilot-instructions.md,.windsurfrules) pointing toAGENTS.mdmd-structure.manifest.json— Machine-readable blueprint lockfile
4. Author in Strict Dependency DAG Order
md-structure next --dir ./workspace-demo --jsonTells the agent the exact next .md file to finalize, which upstream .md files to read first, its token budget, and its remaining AGENT:FILL directives.
5. Run the Pre-Code Governance Audit Gate
md-structure audit --dir ./workspace-demo --strict --jsonReturns exit code 0 only when readyForImplementation === true (or exit code 2 when errors/unfinished drafts exist in --strict mode).
6. Route Context During Coding (Progressive Disclosure)
md-structure route "Add Stripe webhook verification and update tenant subscription table" --dir ./workspace-demo --jsonReturns only the minimal mustRead .md files for that exact task and reports exact context token savings vs. loading the entire docs/ directory.
7. Scan an Existing Repository (Brownfield Mode)
md-structure scan --dir ./existing-repo --jsonAutomatically inspects package.json, pyproject.toml, Cargo.toml, go.mod, Dockerfiles, schema directories, and existing .md files to recommend the exact missing architectural MDs.
8. Evolve & Synchronize as Scope Grows
md-structure add-doc ai-agent-spec --dir ./workspace-demo --json
md-structure sync --dir ./workspace-demo --jsonSafely registers new catalog docs in topological DAG order, patches AGENTS.md's Document Routing Map non-destructively, and refreshes docs/00-CONTEXT-MAP.md.
9. Inspect Any Catalog Archetype & Interactive Wizard
md-structure catalog
md-structure explain ai-agent-spec
md-structure wizardNative MCP Server Integration
Start the built-in JSON-RPC 2.0 stdio MCP server:
md-structure mcpRegister it in Claude Code, Antigravity, Cursor, Windsurf, or any MCP-compatible host (see agent-kit/mcp-config.example.json):
{
"mcpServers": {
"md-structure": {
"command": "node",
"args": ["/ABSOLUTE/PATH/TO/MD-Structure/bin/md-structure.js", "mcp"]
}
}
}Exposed MCP Capabilities
Type | Name / URI | Purpose |
Tool |
| Minimal high-leverage clarifying questions mapped to impacted MDs |
Tool |
| Deterministic blueprint: count, DAG-ordered MDs, rationales, exclusions, token budgets |
Tool |
| Materialize |
Tool |
| Next single MD to author in DAG order + upstream dependencies to read first |
Tool |
| Completeness, frontmatter, bloat, link, and routing audit ( |
Tool |
| Deep explanation of any catalog MD archetype and failure mode prevented |
Tool |
| Browse all 27 canonical archetypes, tiers, layers, and capability triggers |
Tool |
| Scan an existing codebase to infer stack/capabilities and missing architectural MDs |
Tool |
| Progressive-disclosure router returning minimal MDs for a coding task + token savings |
Tool |
| Add a catalog MD to an existing workspace, patching manifest, |
Tool |
| Non-destructively sync |
Resource |
| Full machine-readable JSON catalog |
Resource |
| Context Engineering & Progressive Disclosure specification |
Resource |
| 5-Phase Agent Execution Protocol |
Prompt |
| End-to-end guided prompt from idea to audited architecture |
Prompt |
| Guided workspace audit & self-healing workflow |
Agent Integration Kit
Drop-in files inside agent-kit/:
agent-kit/SKILL.md— Ready-to-install Agent Skill for Antigravity, Claude Code, Codex, and Cursoragent-kit/SYSTEM-PROMPT.md— Compact system-prompt module for custom agentsagent-kit/AGENT-WORKFLOW.md— Canonical 5-phase agent execution protocolagent-kit/mcp-config.example.json— MCP server registration snippet
Programmatic JavaScript / TypeScript API
import {
analyzeProject,
generateDiscoveryQuestions,
planArchitecture,
scaffoldWorkspace,
getNextDocumentToAuthor,
auditWorkspace,
} from "md-structure";
const blueprint = planArchitecture({
name: "PulseAPI",
idea: "Multi-tenant REST API with RBAC, PostgreSQL, and Stripe webhooks",
lifecycle: "production",
});
console.log(blueprint.summary.totalDocuments);
console.log(blueprint.whyThisStructure.headline);Full TypeScript definitions are shipped in types/index.d.ts, and JSON Schemas live in schemas/.
Testing
npm testRuns the complete zero-dependency node:test suite covering:
Idea signal extraction, archetype detection, complexity tier scoring, and ambiguity detection
Deterministic MD selection, topological DAG ordering, exclusion rationales, and token-budget ledgers
End-to-end workspace scaffolding,
AGENT:FILLauthoring progression (next), audit failure/self-heal transitions, bloat & broken-link detectionCLI subcommands,
--jsonoutput validity,--dry-run, and deterministic exit codesLive JSON-RPC 2.0 MCP server handshake, tool calls, resources, and prompts over stdio
Author & License
Designed & architected by Ayazelrico · Released under the MIT License.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
This server cannot be deployed
Maintenance
Related MCP Connectors
Shared project docs, task planning and GitHub evidence for people and their AI agents.
Project memory, documentation and controlled secret access for AI coding agents.
Shared project context for AI agents and teams: docs, tasks, and messages that stay current.
Multi-agent AI pipeline that generates professional Solution Architecture Documents.
Related MCP Servers
AlicenseAqualityDmaintenanceProvides a persistent memory and governance layer that allows AI coding agents to query documented architecture rules and validate code against team standards. It enables agents to verify compliance across categories like security and testing before suggesting changes to ensure consistency across development sessions.317MIT- AlicenseAqualityCmaintenanceProvides AI coding agents with durable architecture memory for repositories by generating structured project maps of responsibilities, relationships, and risks.63 npmMIT
- AlicenseNot gradedqualityCmaintenanceRoutes coding agents to the most relevant project documentation (decisions, intent, constraints) with provenance and freshness, providing tools for task routing, knowledge search, and document context.43 npmMIT
- FlicenseNot gradedqualityBmaintenanceEnables LLM agents to read, create, and update Markdown architecture documents and Mermaid diagrams through MCP tools backed by project-scoped services and version-aware writes.-