Skip to main content
Glama
NSTOK AI Software Factory MCP Server

NSTOK AI Software Factory MCP Server

Official
by nstok-id

NSTOK AI Software Factory MCP Server (TypeScript)

TypeScript Model Context Protocol License: MIT

An enterprise-grade Model Context Protocol (MCP) server implemented in TypeScript that powers the NSTOK AI Software Factory. It allows reasoning agents (such as Codex, Antigravity, or Claude) to construct production-ready NSTOK applications directly from PRDs by discovering and reusing existing ecosystem capabilities, UI components, database models, and templates.


šŸŽÆ Core Architectural Philosophy

SEARCH → REUSE → ADAPT → CREATE

The system strictly enforces the principle: Never generate code from scratch if an existing asset can satisfy or be adapted to the requirement.

  1. Reuse First: Prioritize existing business features (Nstok-feature-*), UI components (Nstok-ui), and database models (Nstok-db).

  2. Template First: Applications start from Nstok-app-template; features start from Nstok-feature-template.

  3. Knowledge Before Code: Understand architecture, dependencies, and patterns before mutating code.

  4. Plan Before Mutation: Analyze → Plan → Approve → Implement → Validate.

  5. Closed Knowledge Loop: Every newly generated application or feature enriches the central Knowledge Graph (Nstok-knowledge-master).


Related MCP server: Vibe Coder MCP Server

šŸ—ļø High-Level Architecture

                  ā”Œā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”
                  │         CODEX         │
                  │   User / PRD / Task   │
                  ā””ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”¬ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”˜
                              │ MCP (Stdio / SSE)
                              ā–¼
             ā”Œā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”
             │        NSTOK MCP SERVER         │
             │                                 │
             │  • PRD Analysis                 │
             │  • Knowledge Graph & Vector     │
             │  • Feature & UI Discovery       │
             │  • Template Orchestrator        │
             │  • Architecture Validator       │
             │  • Sandboxed Git Management     │
             ā””ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”¬ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”˜
                              │
       ā”Œā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”¼ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”
       │                      │                      │
       ā–¼                      ā–¼                      ā–¼
ā”Œā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”       ā”Œā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”       ā”Œā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”
│  Knowledge   │       │ Repositories │       │  Job Runner  │
│    Master    │       │  Ecosystem   │       │   (Worker)   │
│              │       │              │       │              │
│ Graph + RAG  │       │ UI, DB, Apps │       │ Test / Lint  │
│  & Metadata  │       │ & Features   │       │  Typecheck   │
ā””ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”˜       ā””ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”˜       ā””ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”˜

šŸ“¦ Project Structure

nstok-mcp/
ā”œā”€ā”€ src/
│   ā”œā”€ā”€ index.ts                      # CLI entrypoint (Stdio transport)
│   ā”œā”€ā”€ server.ts                     # MCP server instance & tool registration
│   │
│   ā”œā”€ā”€ config/
│   │   └── environment.ts            # Environment variables, security allowlists, timeouts
│   │
│   ā”œā”€ā”€ domain/                       # Core domain models & graph types
│   │   ā”œā”€ā”€ app.ts                    # Application entity
│   │   ā”œā”€ā”€ feature.ts                # Feature & capability interfaces
│   │   ā”œā”€ā”€ component.ts              # UI component definitions
│   │   ā”œā”€ā”€ database.ts               # DB entities & relations
│   │   ā”œā”€ā”€ repository.ts             # Repository metadata & graph relationships
│   │   ā”œā”€ā”€ plan.ts                   # Structured AppPlan & FeaturePlan schemas
│   │   └── graph.ts                  # Graph nodes, edges & traversal results
│   │
│   ā”œā”€ā”€ services/                     # Business logic layers
│   │   ā”œā”€ā”€ knowledge.service.ts      # Hybrid search & graph traversal engine
│   │   ā”œā”€ā”€ repository.service.ts     # Sandboxed workspace operations & template cloning
│   │   ā”œā”€ā”€ generation.service.ts     # PRD analysis & Reuse Decision Engine
│   │   ā”œā”€ā”€ git.service.ts            # Git branching, commit, diff & PR workflow
│   │   ā”œā”€ā”€ validation.service.ts     # Architecture validator (UI-001, DB-001) & jobs
│   │   └── audit.service.ts          # Audit logging for tracking operations
│   │
│   ā”œā”€ā”€ tools/                        # MCP Tool definitions
│   │   ā”œā”€ā”€ knowledge/                # search_knowledge, find_features, find_ui_components, etc.
│   │   ā”œā”€ā”€ generation/               # analyze_prd, create_app_plan, create_app, etc.
│   │   ā”œā”€ā”€ repository/               # read_file, write_file, search_repo_code, git ops
│   │   └── validation/               # validate_architecture, run_tests, update_knowledge
│   │
│   └── data/
│       └── seed.ts                   # Pre-seeded NSTOK ecosystem metadata & graph
│
ā”œā”€ā”€ tests/
│   ā”œā”€ā”€ knowledge.test.ts             # Discovery & graph traversal tests
│   ā”œā”€ā”€ generation.test.ts            # PRD analysis & planning tests
│   ā”œā”€ā”€ validation.test.ts            # Architecture validation tests
│   └── server.test.ts                # Server instantiation & tool registration tests
│
ā”œā”€ā”€ package.json
ā”œā”€ā”€ tsconfig.json
└── README.md

šŸ› ļø Tool Catalog

1. Discovery & Knowledge Tools

Tool

Description

search_knowledge

Hybrid keyword and semantic search across knowledge assets, features, UI, and DB entities.

find_features

Discover reusable business features (Nstok-feature-a, b, c, etc.) matching capabilities.

find_ui_components

Find reusable design system components in Nstok-ui (DataTable, ProductTable, SearchInput, Button, etc.).

find_db_entities

Search database schemas and entity definitions in Nstok-db (Product, Inventory, Sale, User, etc.).

find_existing_patterns

Search established architectural patterns, code conventions, and guidelines in NSTOK.

get_project_context

Retrieve full repository metadata, contained assets, and graph edges for any NSTOK repo.

get_feature_context

Deep-dive feature context (routes, UI/DB dependencies, and graph traversal).

get_app_context

Retrieve full composition details and graph relations for an application.

2. Planning Tools

Tool

Description

analyze_prd

Analyze raw PRD text, extract required capabilities, match reusable vs missing assets, and calculate reuse score.

create_app_plan

Generate a structured application implementation plan following SEARCH → REUSE → ADAPT → CREATE.

create_feature_plan

Generate a structured feature development plan scaffolded from Nstok-feature-template.

3. Generation & Template Tools

Tool

Description

clone_app_template

Clone Nstok-app-template baseline into a new application workspace.

clone_feature_template

Clone Nstok-feature-template baseline into a new feature module.

add_feature_to_app

Link and integrate an existing or new feature module into an application.

create_app

End-to-end scaffolding orchestrator: clones template, wires reused features, creates missing features, and outputs app composition.

create_feature

Scaffold a new feature module from template when missing capabilities are required.

4. Repository & Git Tools

Tool

Description

read_file

Safely read file content within an NSTOK repository with audit logging.

write_file

Safely write or update a file within an NSTOK repository with audit logging.

search_repo_code

Search for code snippets and symbols within an NSTOK repository.

git_status

Get git status, active branch, and modified files for a repository.

git_diff

Inspect git diff before committing changes.

create_branch

Create a feature branch (feature/ai/<task>) adhering to NSTOK git workflow.

create_commit

Create a structured commit with conventional commit message.

create_pull_request

Propose a Pull Request to main branch for human review and approval.

5. Validation & Knowledge Loop Tools

Tool

Description

validate_architecture

Enforce architecture rules: UI-001 (no duplicate UI), DB-001 (Nstok-db access), ARCH-001, DEP-001.

run_tests

Run unit and integration test suites in an isolated environment.

run_lint

Run linting and static analysis on a repository.

run_build

Run project build and TypeScript compilation.

update_knowledge

Feed newly generated application or feature metadata back into Nstok-knowledge-master.


⚔ Quickstart & Installation

Prerequisites

  • Node.js >= 18 (Tested on Node.js 24)

  • npm >= 9

1. Installation

git clone <repository_url> nstok-mcp
cd nstok-mcp
npm install

2. Build

npm run build

3. Run Tests

npm test

4. Run Development Server

npm run dev

šŸ”Œ Configuration for MCP Clients

Codex / Antigravity / Claude Desktop Configuration

Add the following snippet to your mcp_config.json or claude_desktop_config.json:

{
  "mcpServers": {
    "nstok-software-factory": {
      "command": "node",
      "args": ["<PATH_TO_NSTOK_MCP>/dist/index.js"],
      "env": {
        "NODE_ENV": "production",
        "ENABLE_AUDIT_LOG": "true"
      }
    }
  }
}

šŸ”„ Example End-to-End Workflow

When a developer requests:

"Codex, please build nstok-app-w based on this PRD: POS with authentication, product catalog, inventory, checkout, and daily sales report."

The MCP server coordinates the following pipeline:

1. analyze_prd("Nstok-app-w", PRD)
   ā”œā”€ā”€ Extracted: auth, product, inventory, checkout, payment, sales-report
   ā”œā”€ā”€ Reused: Nstok-feature-a, Nstok-feature-b, Nstok-feature-c, checkout-payment
   ā”œā”€ā”€ Missing: sales-report (Scaffold Nstok-feature-sales-report)
   └── Reuse Score: 80%

2. create_app_plan("Nstok-app-w", PRD)
   └── Generates structured implementation plan

3. create_branch("Nstok-app-w", "feature/ai/create-nstok-app-w")

4. create_app("Nstok-app-w", PRD)
   ā”œā”€ā”€ Clones Nstok-app-template
   ā”œā”€ā”€ Links reused features
   └── Scaffolds Nstok-feature-sales-report from Nstok-feature-template

5. validate_architecture("Nstok-app-w")
   └── Checks UI-001 (all UI from Nstok-ui) and DB-001 (all schema from Nstok-db)

6. run_tests("Nstok-app-w") & run_build("Nstok-app-w")

7. create_commit("Nstok-app-w", "feat: initial scaffolding for nstok-app-w")

8. create_pull_request("Nstok-app-w", "feat: nstok-app-w implementation", summary)

9. update_knowledge(...)
   └── Central graph updated so future apps can reuse Nstok-feature-sales-report!

šŸ”’ Security Model

  • Repository Allowlist: Enforces Nstok-* repository naming pattern.

  • Path Traversal Protection: All filesystem reads and writes are sandboxed to the active workspace.

  • Audit Trail: Every mutation (write_file, create_branch, create_commit, create_pull_request) is appended to audit.log.jsonl.

  • Command Allowlist: Strict restrictions on executable commands (node, npm, npx, git, tsc).


šŸ“„ License

MIT Ā© NSTOK Engineering

Available Tools

29 tools
add_feature_to_appB

Integrate and link an existing or newly created feature into an application workspace.

Inputs: appName (required), featureRepository (required).

analyze_prdB

Analyze a PRD text, extract required capabilities, match reusable vs missing assets, and compute reuse score.

Inputs: prd (required), appName (required).

clone_app_templateB

Clone the standard baseline Nstok-app-template to initialize a new application workspace.

Inputs: appName (required), templateName.

clone_feature_templateC

Clone the standard Nstok-feature-template to initialize a new feature repository.

Inputs: description (required), featureName (required), templateName.

create_appC

Orchestrate end-to-end application generation from PRD, prioritizing feature reuse and template baselines.

Inputs: prd (required), name (required), template.

create_app_planC

Generate a structured application implementation plan following the SEARCH -> REUSE -> ADAPT -> CREATE principle.

Inputs: prd (required), appName (required), template.

create_branchC

Create a new feature branch (e.g. feature/ai/create-nstok-app-w) following NSTOK git workflow.

Inputs: branchName (required), repository (required).

create_commitC

Create a structured git commit with a conventional commit message.

Inputs: message (required), repository (required), files.

create_featureB

Scaffold a new feature module from Nstok-feature-template when missing capabilities are required.

Inputs: featureName (required), capabilities (required), description.

create_feature_planC

Generate a structured feature development plan scaffolded from Nstok-feature-template.

Inputs: featureName (required), capabilities (required).

create_pull_requestB

Propose a Pull Request to main branch for human review and approval.

Inputs: body (required), title (required), repository (required), targetBranch.

find_db_entitiesC

Search database schemas and entity definitions in Nstok-db (Product, Inventory, Sale, User, etc.).

Inputs: query.

find_existing_patternsC

Search established architectural patterns, code conventions, and guidelines in NSTOK.

Inputs: query, category.

find_featuresB

Discover reusable business features from the NSTOK ecosystem (e.g. Nstok-feature-a, b, c) matching capabilities or keywords.

Inputs: query, capabilities.

find_ui_componentsB

Find reusable design system UI components in Nstok-ui (DataTable, ProductTable, SearchInput, Button, etc.).

Inputs: query, category.

get_app_contextB

Get full application architecture and composition details for a generated or production app.

Inputs: appName (required).

get_feature_contextA

Get deep-dive context for a specific feature, including capabilities, routes, UI/DB deps, and graph traversal.

Inputs: featureId (required).

get_project_contextC

Get full repository context, contained assets, and graph relationships for any NSTOK repo.

Inputs: repositoryName (required).

git_diffB

Inspect git diff in a repository before committing mutations.

Inputs: repository (required), staged.

git_statusB

Get git status, active branch, and modified files for a repository.

Inputs: repository (required).

read_fileB

Safely read a file inside an NSTOK repository with audit logging and sandbox isolation.

Inputs: path (required), repository (required).

run_buildC

Run build and TypeScript type-checking for an application or feature.

Inputs: repository (required).

run_lintC

Run linting and static analysis on an NSTOK repository.

Inputs: repository (required).

run_testsC

Run unit and integration test suites in an isolated environment.

Inputs: repository (required), testFilter.

search_knowledgeC

Search across all NSTOK knowledge assets, features, UI components, DB entities, patterns, and repositories using hybrid search.

Inputs: query (required), type, repository.

search_repo_codeC

Search for code snippets, symbol definitions, and text within an NSTOK repository.

Inputs: query (required), repository (required), extensions.

update_knowledgeC

Feed newly generated application or feature metadata back into Nstok-knowledge-master.

Inputs: id (required), name (required), type (required), repository (required), +6 more.

validate_architectureC

Validate that code obeys NSTOK architectural rules (UI-001, DB-001, ARCH-001, DEP-001).

Inputs: repository (required).

write_fileB

Safely write or update a file inside an NSTOK repository with audit logging.

Inputs: path (required), content (required), repository (required), overwrite.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    C2.9/5.0

    Scored across 29 tools

    Disambiguation3/5

    Several tools have overlapping purposes: search_knowledge, find_features, find_ui_components, find_db_entities, find_existing_patterns, and search_repo_code all perform search-like operations. Similarly, create_app_plan and create_feature_plan both generate plans. However, descriptions provide some distinction through specific resource types and workflows.

    Naming Consistency4/5

    Most tools follow a verb_noun pattern (e.g., search_knowledge, find_features, create_app_plan, clone_app_template). Minor deviations like get_project_context and run_tests are still readable and consistent with the pattern. Overall naming is predictable and consistent.

    Tool Count2/5

    With 29 tools, the set is heavy and may overwhelm an agent. The high count is somewhat justified by the complex domain of software generation and knowledge management, but several tools appear redundant (e.g., multiple find_ tools, multiple create_plan tools), suggesting over-scoping.

    Completeness4/5

    The surface covers search, planning, creation, file operations, git workflow, validation, testing, and knowledge updating, which is comprehensive for a software factory. Minor gaps might include direct code editing tools or more granular git operations (e.g., merge, delete branch), but core workflows appear covered.

    Related MCP Connectors

    Related MCP Servers