Skip to content

Commit adec265

Browse files
committed
feat(ng-schematics): add MCP server integration for AI assistant support
1 parent 1bb5488 commit adec265

13 files changed

Lines changed: 231 additions & 46 deletions

File tree

README.md

Lines changed: 17 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
[![npm version](https://badge.fury.io/js/igniteui-cli.svg)](https://badge.fury.io/js/igniteui-cli)
88
[![Discord](https://img.shields.io/discord/836634487483269200?logo=discord&logoColor=ffffff)](https://discord.gg/39MjrTRqds)
99

10-
Quickly create projects including [Ignite UI for Angular](https://www.infragistics.com/products/ignite-ui-angular) and [Ignite UI for jQuery](https://www.infragistics.com/products/ignite-ui) components for a variety of frameworks.
10+
Quickly create projects including [Ignite UI for Angular](https://www.infragistics.com/products/ignite-ui-angular), [Ignite UI for React](https://www.infragistics.com/products/ignite-ui-react), [Ignite UI for Web Components](https://www.infragistics.com/products/ignite-ui-web-components) and [Ignite UI for jQuery](https://www.infragistics.com/products/ignite-ui) components.
1111

1212
## Overview
1313
### Features:
@@ -19,9 +19,10 @@ Quickly create projects including [Ignite UI for Angular](https://www.infragisti
1919
- Step by step guide
2020

2121
### Supported frameworks
22-
* jQuery
2322
* Angular
2423
* React
24+
* Web Components
25+
* jQuery
2526

2627
### Prerequisites
2728
The repository houses multiple packages and orchestrates building and publishing them with [lerna](https://github.com/lerna/lerna) and [yarn workspaces](https://yarnpkg.com/lang/en/docs/workspaces/).
@@ -95,7 +96,7 @@ ig new <project name> --framework=<framework> --type=<proj-type> --theme=<theme>
9596
```
9697
This will create the project and will install the needed dependencies.
9798

98-
Parameters besides name are optional. Framework default to "jquery", project type defaults to the first available in the framework and theme to the first available for the project. For more information visit [ig new](https://github.com/IgniteUI/igniteui-cli/wiki/New) Wiki page.
99+
Parameters besides name are optional. Framework defaults to "jquery", project type defaults to the first available in the framework and theme to the first available for the project. For more information visit [ig new](https://github.com/IgniteUI/igniteui-cli/wiki/New) Wiki page.
99100

100101
#### Generate Ignite UI for Angular project
101102

@@ -180,7 +181,7 @@ The MCP server exposes the following tools to AI assistants:
180181
| `search_docs` | Full-text search across Ignite UI documentation |
181182
| `get_api_reference` | Retrieve the full API reference for a component or class |
182183
| `search_api` | Search API entries by keyword or partial component name |
183-
| `generate_ignite_app` | Return a setup guide for a new Ignite UI project |
184+
| `get_project_setup_guide` | Return a setup guide for a new Ignite UI project |
184185

185186
### Testing with MCP Inspector
186187

@@ -190,7 +191,7 @@ npx @modelcontextprotocol/inspector ig mcp
190191
```
191192

192193
## Schematics
193-
You can also add `Ignite UI for Angular` components to your projects by using the `igniteui/angular-schematics` package. It included schematic definitions for most of the logic present in the [`igniteui-cli`](/packages/cli). These can be called in any existing Angular project or even when creating one. You can learn more about the schematics package on from its [readme](/package/ng-schematics).
194+
You can also add `Ignite UI for Angular` components to your projects by using the `@igniteui/angular-schematics` package. It includes schematic definitions for most of the logic present in the [`igniteui-cli`](/packages/cli), as well as an Architect Builder for starting the MCP server via `ng run <project>:mcp`. These can be called in any existing Angular project or even when creating one. You can learn more about the schematics package from its [readme](/packages/ng-schematics).
194195

195196
## Contribution
196197

@@ -199,20 +200,12 @@ See the [Contribution guide](https://github.com/IgniteUI/igniteui-cli/blob/maste
199200
### Run locally
200201
1. Clone the repository
201202
2. Install dependencies with `yarn install`
202-
3. Build the MCP server and bundle it into the CLI:
203-
```bash
204-
cd packages/igniteui-mcp/igniteui-doc-mcp
205-
npm install
206-
npm run build
207-
cd ../../..
208-
npm run build:mcp-bundle
209-
```
210-
4. Build the monorepo packages: `npm run build`
211-
5. Open in Visual Studio Code
203+
3. Build the monorepo packages (includes MCP server): `npm run build`
204+
4. Open in Visual Studio Code
212205

213-
There is a predefined launch.config file for VS Code in the root folder, so you can use VS Code View/Debug window and choose one of the predefined actions. These include launching the step by step guide, create new project for a particular framework or add components.
206+
There is a predefined `.vscode/launch.json` file for VS Code, so you can use VS Code View/Debug window and choose one of the predefined actions. These include launching the step by step guide, create new project for a particular framework or add components.
214207

215-
6. Hit Start Debugging/F5
208+
5. Hit Start Debugging/F5
216209

217210
#### MCP Server development
218211

@@ -238,55 +231,38 @@ npm run build:docs:all # Build both
238231

239232
> **Note:** Web Components requires a one-time library build (`npm run build:publish` in the submodule) before TypeDoc can run. The build script handles this automatically.
240233
241-
**Bundle MCP into CLI** (from the repo root):
242-
```bash
243-
npm run build:mcp-bundle # Copies dist/ and docs/ into packages/cli/mcp/
244-
```
245-
246-
This copies the compiled MCP server, SQLite documentation database, and API reference docs into the CLI package. The `packages/cli/mcp/` directory is a build artifact (gitignored) and must be regenerated before publishing.
247-
248234
**Test the MCP server locally:**
249235
```bash
250-
npm run build:mcp-bundle
251236
npm run build
252237
node packages/cli/lib/cli.js mcp # Start via CLI
253-
# or directly:
254-
node packages/cli/mcp/dist/index.js # Start the bundled server
255238
```
256239

257-
#### Building CLI package with bundled MCP server
240+
#### Building CLI package with MCP server
258241

259-
The CLI package includes the MCP server as a bundled build artifact (not an npm dependency). To produce a complete CLI package with full MCP functionality, follow these steps:
242+
The CLI package depends on `@igniteui/mcp-server` as an npm dependency. To produce a complete CLI package with full MCP functionality, follow these steps:
260243

261244
```bash
262245
# 1. Install monorepo dependencies
263246
yarn install
264247

265-
# 2. Build the MCP server
248+
# 2. Build API reference docs (optional but recommended for full functionality)
266249
cd packages/igniteui-mcp/igniteui-doc-mcp
267-
npm install
268-
npm run build # Compile TypeScript + copy SQLite DB
269-
270-
# 3. Build API reference docs (optional but recommended for full functionality)
271250
npm run build:docs:all # Init submodules + generate Angular + WC API docs via TypeDoc
272251

273-
# 4. Bundle MCP into CLI (from repo root)
252+
# 3. Build all packages for publishing (from repo root)
274253
cd ../../..
275-
npm run build:mcp-bundle # Copy dist/ + docs/ → packages/cli/mcp/
276-
277-
# 5. Build all packages for publishing
278254
npm run build-pack
279255
```
280256

281-
After step 5, `npm pack` from the repo root or `packages/cli/` will produce a tarball with the MCP server, documentation database, and API reference docs all included.
257+
After step 3, `npm pack` from the repo root or `packages/cli/` will produce a tarball with the MCP server, documentation database, and API reference docs all included.
282258

283-
> **Skipping API docs:** If you skip step 3, the MCP server will still work for `list_components`, `get_doc`, `search_docs`, and `generate_ignite_app` tools using the bundled SQLite database. Only the `get_api_reference` and `search_api` tools require API docs.
259+
> **Skipping API docs:** If you skip step 2, the MCP server will still work for `list_components`, `get_doc`, `search_docs`, and `get_project_setup_guide` tools using the bundled SQLite database. Only the `get_api_reference` and `search_api` tools require API docs.
284260
285261
## Data Collection
286262

287263
The Ignite UI CLI tool uses Google Analytics to anonymously report feature usage statistics and basic crash reports. This data is used to help improve the Ignite UI CLI tools over time. You can opt out of analytics before any data is sent by using
288264

289-
```bach
265+
```bash
290266
ig config set disableAnalytics true -g
291267
```
292268

packages/ng-schematics/README.md

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,4 +43,21 @@ ng g @igniteui/angular-schematics:component [templateId] [componentName]
4343
```
4444

4545
You can find all of the template definitions in the [official documentation](https://www.infragistics.com/products/ignite-ui-angular/angular/components/general/cli/component-templates.html)
46-
46+
47+
## MCP Server
48+
49+
The package includes an Architect Builder that starts the [Ignite UI MCP server](../igniteui-mcp/igniteui-doc-mcp) for AI assistant integration. The `mcp` target is automatically registered in `angular.json` when you create a new project or run `ng add`.
50+
51+
```bash
52+
ng run <project>:mcp
53+
```
54+
55+
Options:
56+
57+
- `--remote <url>` — Use a remote backend instead of the local SQLite database
58+
- `--debug` — Enable debug logging to `mcp-server.log`
59+
60+
```bash
61+
ng run my-app:mcp --remote https://your-backend-url.com
62+
ng run my-app:mcp --debug
63+
```

packages/ng-schematics/package.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,14 @@
1717
"author": "",
1818
"license": "MIT",
1919
"schematics": "./src/collection.json",
20+
"builders": "./src/builders.json",
2021
"dependencies": {
22+
"@angular-devkit/architect": "^0.2100.0",
2123
"@angular-devkit/core": "^21.0.0",
2224
"@angular-devkit/schematics": "^21.0.0",
2325
"@igniteui/angular-templates": "~21.1.1500-rc.0",
2426
"@igniteui/cli-core": "~15.0.0-rc.0",
27+
"@igniteui/mcp-server": "~15.0.0-rc.0",
2528
"@schematics/angular": "^21.0.0",
2629
"minimatch": "^10.0.1",
2730
"rxjs": "~7.8.1"
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"builders": {
3+
"mcp": {
4+
"implementation": "./builders/mcp/index",
5+
"schema": "./builders/mcp/schema.json",
6+
"description": "Starts the Ignite UI MCP server for AI assistant integration"
7+
}
8+
}
9+
}
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
import * as fs from "fs";
2+
import * as path from "path";
3+
import { createBuilder, BuilderContext, BuilderOutput } from "@angular-devkit/architect";
4+
import { Util } from "@igniteui/cli-core";
5+
import { McpOptions } from "../../mcp/schema";
6+
7+
export default createBuilder<McpOptions>((options: McpOptions, context: BuilderContext): BuilderOutput => {
8+
let mcpEntry: string;
9+
try {
10+
const mcpPkgJson = require.resolve("@igniteui/mcp-server/package.json");
11+
mcpEntry = path.resolve(path.dirname(mcpPkgJson), "dist", "index.js");
12+
} catch {
13+
context.logger.error(
14+
"MCP server package not found. Install it first:\n" +
15+
" yarn install\n"
16+
);
17+
return { success: false };
18+
}
19+
20+
if (!fs.existsSync(mcpEntry)) {
21+
context.logger.error(
22+
"MCP server not built. Build it first:\n" +
23+
" npm run build:mcp\n"
24+
);
25+
return { success: false };
26+
}
27+
28+
const args: string[] = [];
29+
if (options.remote) {
30+
args.push("--remote", options.remote);
31+
}
32+
if (options.debug) {
33+
args.push("--debug");
34+
}
35+
36+
Util.execSync(
37+
`node "${mcpEntry}" ${args.join(" ")}`,
38+
{ stdio: "inherit", killSignal: "SIGINT" }
39+
);
40+
return { success: true };
41+
});
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"$schema": "http://json-schema.org/draft-07/schema",
3+
"type": "object",
4+
"properties": {
5+
"remote": {
6+
"type": "string",
7+
"description": "Backend URL for remote mode (uses HTTP instead of local SQLite)"
8+
},
9+
"debug": {
10+
"type": "boolean",
11+
"description": "Enable debug logging to mcp-server.log",
12+
"default": false
13+
}
14+
}
15+
}

packages/ng-schematics/src/cli-config/index.ts

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import * as ts from "typescript";
2-
import { DependencyNotFoundException } from "@angular-devkit/core";
2+
import { DependencyNotFoundException, workspaces } from "@angular-devkit/core";
33
import { chain, FileDoesNotExistException, Rule, SchematicContext, Tree } from "@angular-devkit/schematics";
4-
import { addClassToBody, FormatSettings, NPM_ANGULAR, resolvePackage, TypeScriptAstTransformer, TypeScriptUtils } from "@igniteui/cli-core";
4+
import { addClassToBody, createWorkspaceHost, FormatSettings, NPM_ANGULAR, resolvePackage, TypeScriptAstTransformer, TypeScriptUtils } from "@igniteui/cli-core";
55
import { AngularTypeScriptFileUpdate } from "@igniteui/angular-templates";
66
import { createCliConfig } from "../utils/cli-config";
77
import { setVirtual } from "../utils/NgFileSystem";
@@ -157,6 +157,25 @@ export function addAIConfig(): Rule {
157157
};
158158
}
159159

160+
export function addMcpBuilderTarget(): Rule {
161+
return async (tree: Tree) => {
162+
const host = createWorkspaceHost(tree);
163+
const { workspace } = await workspaces.readWorkspace("/", host);
164+
165+
const project = workspace.extensions.defaultProject ?
166+
workspace.projects.get(workspace.extensions.defaultProject as string) :
167+
workspace.projects.values().next().value as workspaces.ProjectDefinition;
168+
169+
if (project && !project.targets.has("mcp")) {
170+
project.targets.set("mcp", {
171+
builder: "@igniteui/angular-schematics:mcp",
172+
options: {}
173+
});
174+
await workspaces.writeWorkspace(workspace, host);
175+
}
176+
};
177+
}
178+
160179
export default function (): Rule {
161180
return (tree: Tree) => {
162181
setVirtual(tree);
@@ -166,7 +185,8 @@ export default function (): Rule {
166185
importBrowserAnimations(),
167186
createCliConfig(),
168187
displayVersionMismatch(),
169-
addAIConfig()
188+
addAIConfig(),
189+
addMcpBuilderTarget()
170190
]);
171191
};
172192
}

packages/ng-schematics/src/collection.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,12 @@
3737
"description": "Upgrades to the licensed Ignite UI for Angular packages",
3838
"factory": "./upgrade-packages/index",
3939
"schema": "./upgrade-packages/schema.json"
40+
},
41+
"mcp": {
42+
"description": "Starts the Ignite UI MCP server for AI assistant integration",
43+
"factory": "./mcp/index",
44+
"schema": "./mcp/schema.json",
45+
"hidden": true
4046
}
4147
}
4248
}
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
import * as fs from "fs";
2+
import * as path from "path";
3+
import { Rule, SchematicContext, Tree } from "@angular-devkit/schematics";
4+
import { Util } from "@igniteui/cli-core";
5+
import { defer } from "rxjs";
6+
import { McpOptions } from "./schema";
7+
8+
export default function(options: McpOptions): Rule {
9+
return (_tree: Tree, _context: SchematicContext) => {
10+
return defer(async () => {
11+
let mcpEntry: string;
12+
try {
13+
const mcpPkgJson = require.resolve("@igniteui/mcp-server/package.json");
14+
mcpEntry = path.resolve(path.dirname(mcpPkgJson), "dist", "index.js");
15+
} catch {
16+
_context.logger.error(
17+
"MCP server package not found. Install it first:\n" +
18+
" yarn install\n"
19+
);
20+
return _tree;
21+
}
22+
23+
if (!fs.existsSync(mcpEntry)) {
24+
_context.logger.error(
25+
"MCP server not built. Build it first:\n" +
26+
" npm run build:mcp\n"
27+
);
28+
return _tree;
29+
}
30+
31+
const args: string[] = [];
32+
if (options.remote) {
33+
args.push("--remote", options.remote);
34+
}
35+
if (options.debug) {
36+
args.push("--debug");
37+
}
38+
39+
Util.execSync(
40+
`node "${mcpEntry}" ${args.join(" ")}`,
41+
{ stdio: "inherit", killSignal: "SIGINT" }
42+
);
43+
return _tree;
44+
});
45+
};
46+
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
"$schema": "http://json-schema.org/draft-07/schema",
3+
"type": "object",
4+
"properties": {
5+
"remote": {
6+
"type": "string",
7+
"description": "Backend URL for remote mode (uses HTTP instead of local SQLite)",
8+
"alias": "r"
9+
},
10+
"debug": {
11+
"type": "boolean",
12+
"description": "Enable debug logging to mcp-server.log",
13+
"default": false,
14+
"alias": "d"
15+
}
16+
}
17+
}

0 commit comments

Comments
 (0)