# accp

> The code is generated automatically by referring to the pattern file. Includes MCP server for LLM integration.

Latest version **2.0.1** (published 2026-03-05) · MIT license · 0 weekly downloads

## Install

```sh
npm install accp
pnpm add accp
yarn add accp
bun add accp
```

Provides the commands `accp`, `accp-mcp`.

## Health

**Score 50/100 (C)** — status: stable.

Positive: no vulnerabilities; high maintenance score.

Warnings: low downloads; no types; no esm support.

## Facts

| | |
|---|---|
| Version | 2.0.1 |
| Published | 2026-03-05 |
| First published | 2019-12-11 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 5 |
| Unpacked size | 1021.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Bettep |
| Maintainers | hongdaesik |
| Keywords | api, code, auto, swift, mysql, mssql, kotlin, nodejs, create, angular, flutter, pattern, generate, mcp, llm, ai |

## Links

- npm: https://www.npmjs.com/package/accp
- Repository: https://github.com/bettep-dev/accp
- Homepage: https://bettep.org
- npm.io page: https://npm.io/package/accp

## Dependencies (5)

- [zod](https://npm.io/package/zod.md) ^3.24.0
- [colors](https://npm.io/package/colors.md) 1.4.0
- [commander](https://npm.io/package/commander.md) 4.0.1
- [n-readlines](https://npm.io/package/n-readlines.md) 1.0.0
- [@modelcontextprotocol/sdk](https://npm.io/package/@modelcontextprotocol/sdk.md) ^1.12.0

## Alternatives

- [@expo/fingerprint](https://npm.io/package/@expo/fingerprint.md) — 6.2M weekly downloads
- [@azure/monitor-opentelemetry-exporter](https://npm.io/package/@azure/monitor-opentelemetry-exporter.md) — 850.0K weekly downloads
- [@azure/monitor-opentelemetry](https://npm.io/package/@azure/monitor-opentelemetry.md) — 624.0K weekly downloads
- [@posthog/ai](https://npm.io/package/@posthog/ai.md) — 423.3K weekly downloads
- [fakefilter](https://npm.io/package/fakefilter.md) — 63.9K weekly downloads

## Recent versions

- 2.0.1 (latest) — 2026-03-05
- 1.4.4 — 2026-02-19
- 1.4.3 — 2025-07-18
- 1.4.2 — 2025-07-18
- 1.4.1 — 2025-07-16
- 1.4.0 — 2025-07-16
- 1.3.4 — 2025-07-14
- 1.3.3 — 2024-11-04
- 1.3.2 — 2024-11-04
- 1.3.1-beta — 2024-03-13
- 1.3.0-beta — 2024-03-12
- 1.2.4-beta — 2024-03-12
- 1.2.3-beta — 2023-03-07
- 1.2.2-beta — 2021-03-05
- 1.2.1-beta — 2021-02-10
- … 11 more at https://npm.io/package/accp/versions

## README

![](https://cdn.bettep.org/accp/icon.512x256.webp)

# accp

**Auto Create Code with Pattern files.**

[![npm version](https://img.shields.io/npm/v/accp)](https://www.npmjs.com/package/accp)
[![license](https://img.shields.io/npm/l/accp)](LICENSE)

Define your API in `.api` files, then generate any language — TypeScript, Flutter, Swagger, and more — through customizable pattern files. Includes an MCP server for LLM integration.

```
.api / .code / .struct  →  accp --compile  →  pattern/*.js  →  Generated code
```

## Installation

```bash
npm install accp -g
```

## Quick Start

```bash
# 1. Create example project
accp --examples my-project

# 2. Compile
cd my-project && accp --compile
```

## Project Structure

| Folder    | Extension  | Description                      |
| --------- | ---------- | -------------------------------- |
| `api/`    | `.api`     | API endpoint definitions         |
| `code/`   | `.code`    | Error codes and translations     |
| `struct/` | `.struct`  | Data structures used in API      |
| `pattern/`| `.js`      | Code generation templates        |

All folders are required.

## Syntax

### .api — API Endpoints

![API Syntax](demo/API.png)

### .code — Error Codes

![CODE Syntax](demo/CODE.png)

### .struct — Data Structures

![STRUCT Syntax](demo/STRUCT.png)

### Compile

![Compile Demo](demo/DEMO.png)

## CLI

| Command              | Description                    |
| -------------------- | ------------------------------ |
| `accp --compile`     | Compile and generate code      |
| `accp --examples <dir>` | Create example project      |

## Pattern Files

Pattern files receive `OBJ` (compiled data) and `GEN` (file writer) as arguments:

```javascript
module.exports = function (OBJ, GEN) {
  const file = new GEN("output/api.ts");
  file.open();
  file.print("// generated code\n");
  file.close();
};
```

### GEN Methods

| Method              | Description                          |
| ------------------- | ------------------------------------ |
| `new GEN(path)`     | Create instance (auto-creates dirs)  |
| `.open(encoding?)`  | Start writing (default: `utf8`)      |
| `.print(string)`    | Append content                       |
| `.close()`          | Flush buffer to file                 |

### OBJ Structure

```javascript
OBJ = {
  API: [{
    BASE: String,          // base path
    NAME: String,          // class name
    MARK: String,          // description
    FUNC: [{
      CODE: Int,           // endpoint code
      NAME: String,        // function name
      DESC: String,        // description
      (GET|PUT|POST|PATCH|DELETE): String,  // method: path
      PARAM: [String],     // path parameters
      COMP: Boolean,       // completion status
      PROC: [{ CODE, NAME }],              // related endpoints
      MARK: [{ NAME, MARK }],              // comments
      REQ: [{ NAME, MARK, CLASS, ARRAY, OPTION }],  // request fields
      RES: [{ ... }],      // response fields (same as REQ)
      OPT: { key: Boolean } // user-defined options
    }]
  }],

  CODE: [{
    NAME: String,
    MARK: String,
    CODE: [{ CODE: Int, NAME: String, MARK: { lang: String } }]
  }],

  STRUCT: [{
    NAME: String,
    MARK: String,
    DATA: [{ ... }]        // same as REQ fields
  }]
}
```

## MCP Server

accp includes an MCP server (`accp-mcp`) for integration with LLM tools like Claude Code.

### Setup

Add to your Claude Code settings (`~/.claude/settings.json`):

```json
{
  "mcpServers": {
    "accp": {
      "command": "accp-mcp"
    }
  }
}
```

### Available Tools

| Tool                | Description                                    |
| ------------------- | ---------------------------------------------- |
| `accp_compile`      | Parse `.api`/`.code`/`.struct` into JSON (OBJ) |
| `accp_generate`     | Compile and run pattern files to generate code  |
| `accp_validate`     | Check syntax without generating                |
| `accp_list_patterns`| List available pattern files                   |
| `accp_read_file`    | Read an accp source file                       |
| `accp_write_file`   | Write an accp source file                      |
| `accp_parse_string` | Parse accp syntax from a string                |

## VS Code Extension

[accp language support](https://marketplace.visualstudio.com/items?itemName=Bettep.accp) — syntax highlighting and snippets for `.api`, `.code`, `.struct` files.

Snippets: `API`, `CODE`, `STRUCT`

## Built-in Types

`Int` `Float` `Double` `String` `Boolean` `Data`

## Programmatic Usage

```javascript
const accp = require('accp');
```

The `core.js` module exposes the compiler for use in Node.js applications.

## License

[MIT](LICENSE)

---
_Source: https://npm.io/package/accp · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
