Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@
# dependencies
/node_modules

# MCP server (tools/mcp-server) build output & deps
/tools/mcp-server/dist
/tools/mcp-server/node_modules

# profiling files
chrome-profiler-events*.json
speed-measure-plugin*.json
Expand Down
8 changes: 8 additions & 0 deletions .mcp.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"mcpServers": {
"angular-generic-table": {
"command": "node",
"args": ["tools/mcp-server/dist/index.js"]
}
}
}
11 changes: 11 additions & 0 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ Two workspace projects:
- **`core`** (`projects/core/`) — the library, built with ng-packagr
- **`docs`** (`projects/docs/`) — standalone Angular app with example components (replaces Storybook)

Plus a standalone (non-Angular) Node package:
- **`mcp`** (`tools/mcp-server/`) — `@angular-generic-table/mcp`, a Model Context Protocol stdio server that exposes the `TableConfig` schema, an API reference, and config generate/validate tools so AI assistants can wire up the table correctly. Self-contained (own `package.json`/lockfile, built with `tsc`); not part of the Angular workspace.

## Tech stack

- Angular 21, RxJS 7, TypeScript 5.9, Bootstrap 5
Expand All @@ -26,6 +29,8 @@ npm test # run vitest (core library)
ng serve docs # serve docs app locally
npm run commit # commitizen interactive commit
npx agent-browser install # one-time: fetch Chromium for the agent-browser skill
npm run build:mcp # install + build the MCP server (tools/mcp-server)
npm run test:mcp # run the MCP server's vitest suite
```

## Project structure
Expand All @@ -46,6 +51,12 @@ projects/docs/src/app/
app.routes.ts # lazy-loaded example routes
examples/ # 13 example components
components/tabs/ # code snippet display with highlight.js

tools/mcp-server/
src/index.ts # MCP server bootstrap (resources + tools)
src/schema.ts # Zod schema — single source of truth, mirrors models/*.interface.ts
src/api-reference.ts # curated markdown API reference
src/tools/ # generate-config + validate-config (pure functions)
```

## Conventions
Expand Down
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
"prebuild:docs": "node scripts/generate-sources.mjs",
"build:docs": "ng build docs --configuration production --base-href=/angular-generic-table/",
"test": "cd projects/core && vitest run",
"build:mcp": "cd tools/mcp-server && npm ci && npm run build",
"test:mcp": "cd tools/mcp-server && npm test",
"lint": "ng lint --fix --force",
"e2e": "playwright test",
"commit": "git-cz",
Expand Down
64 changes: 64 additions & 0 deletions tools/mcp-server/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
# @angular-generic-table/mcp

A [Model Context Protocol](https://modelcontextprotocol.io) server for
[`@angular-generic-table/core`](https://www.npmjs.com/package/@angular-generic-table/core).

It gives AI coding assistants authoritative, structured knowledge of the table library so
they can wire it up correctly — no guessing at config shapes.

## Capabilities

**Resources**

| URI | Description |
| --- | --- |
| `agt://schema/table-config` | JSON Schema for `TableConfig` / `TableColumn`, with field descriptions and defaults. |
| `agt://api-reference` | Markdown reference: component inputs/outputs/methods, pipes, utilities, usage. |

**Tools**

| Tool | Description |
| --- | --- |
| `generate_table_config` | Build a starter `TableConfig` from sample data or a field spec (capitalized headers, sorting, search, optional pagination/footer/mobile). Returns config JSON + a template snippet. |
| `validate_table_config` | Validate a `TableConfig` against the schema and surface errors plus heuristic suggestions. |

## Usage

The server speaks MCP over stdio. Add it to any MCP-capable client.

### Claude Code

```bash
claude mcp add angular-generic-table -- npx -y @angular-generic-table/mcp
```

### Generic client config

```json
{
"mcpServers": {
"angular-generic-table": {
"command": "npx",
"args": ["-y", "@angular-generic-table/mcp"]
}
}
}
```

## Development

```bash
cd tools/mcp-server
npm install
npm run build # tsc -> dist/
npm test # vitest
npm start # run the built server over stdio

# inspect the protocol surface
npx @modelcontextprotocol/inspector node dist/index.js
```

The Zod schema in `src/schema.ts` is the single source of truth for validation, the schema
resource and the generator. It mirrors the library interfaces in
`projects/core/src/lib/models/` — keep them in sync (a drift guard test asserts the
top-level `TableConfig` keys match).
Loading
Loading