Skip to content

feat(ng-schematics): add ai-config schematic for AI/MCP server config…#1624

Open
Marina-L-Stoyanova wants to merge 7 commits intomasterfrom
mstoyanova/schematics-mcp-rule
Open

feat(ng-schematics): add ai-config schematic for AI/MCP server config…#1624
Marina-L-Stoyanova wants to merge 7 commits intomasterfrom
mstoyanova/schematics-mcp-rule

Conversation

@Marina-L-Stoyanova
Copy link
Copy Markdown
Contributor

…uration

Closes # .

Additional information related to this pull request:

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a new Angular schematic entry to expose the existing addAIConfig rule as a standalone schematic, enabling generation/augmentation of .vscode/mcp.json AI/MCP server configuration via the schematics collection.

Changes:

  • Register a new ai-config schematic in the schematics collection.
  • Wire ai-config to ./cli-config/index#addAIConfig.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@coveralls
Copy link
Copy Markdown

coveralls commented Apr 15, 2026

Coverage Status

coverage: 86.117% (+0.01%) from 86.103% — mstoyanova/schematics-mcp-rule into master

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a new Angular schematic entry for generating AI/MCP server configuration and updates the existing config writer to accept JSONC input when updating .vscode/mcp.json.

Changes:

  • Register a new ai-config schematic in the schematics collection.
  • Update .vscode/mcp.json parsing to use jsonc-parser (JSONC support) when the file already exists.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

File Description
packages/ng-schematics/src/collection.json Adds the ai-config schematic entry pointing to addAIConfig.
packages/ng-schematics/src/cli-config/index.ts Uses JSONC parsing for existing .vscode/mcp.json before merging server entries.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 133 to 137
if (tree.exists(mcpFilePath)) {
const content = JSON.parse(tree.read(mcpFilePath)!.toString());
const content = parseJsonc(tree.read(mcpFilePath)!.toString()) as any;
const servers = content.servers ?? {};
let modified = false;
if (!servers["igniteui-cli"]) {
@@ -1,5 +1,6 @@
import * as ts from "typescript";
import { DependencyNotFoundException } from "@angular-devkit/core";
import { parse as parseJsonc } from "jsonc-parser";
Comment on lines 133 to 136
if (tree.exists(mcpFilePath)) {
const content = JSON.parse(tree.read(mcpFilePath)!.toString());
const content = parseJsonc(tree.read(mcpFilePath)!.toString()) as any;
const servers = content.servers ?? {};
let modified = false;
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a dedicated ai-config Angular schematic to generate/merge AI/MCP server configuration under .vscode/mcp.json, and expands the generated config to include an angular-cli MCP server.

Changes:

  • Register new ai-config schematic in the schematics collection.
  • Extend addAIConfig() to add an angular-cli MCP server entry alongside the existing Ignite UI servers.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
packages/ng-schematics/src/collection.json Adds a new ai-config schematic entry pointing at addAIConfig.
packages/ng-schematics/src/cli-config/index.ts Updates MCP config generation/merge logic to include an angular-cli server definition.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 123 to +143
@@ -133,6 +137,10 @@ export function addAIConfig(): Rule {
const content = JSON.parse(tree.read(mcpFilePath)!.toString());
const servers = content.servers ?? {};
let modified = false;
if (!servers["angular-cli"]) {
servers["angular-cli"] = angularCliServer;
modified = true;
}
Comment on lines +36 to +39
"ai-config": {
"description": "Adds AI/MCP server configuration to .vscode/mcp.json.",
"factory": "./cli-config/index#addAIConfig"
},
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a new Angular schematic entry for generating AI/MCP server configuration and updates the existing CLI config schematic logic to safely merge server entries into .vscode/mcp.json (including JSON-with-comments support).

Changes:

  • Adds a new ai-config schematic to the schematics collection.
  • Updates addAIConfig() to merge MCP server entries via jsonc-parser edits (preserving existing formatting/content) and adds an angular-cli server entry.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

File Description
packages/ng-schematics/src/collection.json Registers a new ai-config schematic pointing to addAIConfig.
packages/ng-schematics/src/cli-config/index.ts Switches MCP config updates to JSONC-aware parsing/editing and adds the angular-cli MCP server entry.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

import * as ts from "typescript";
import { DependencyNotFoundException } from "@angular-devkit/core";
import { chain, FileDoesNotExistException, Rule, SchematicContext, Tree } from "@angular-devkit/schematics";
import * as jsonc from "jsonc-parser";
Comment on lines +138 to 140
let text = tree.read(mcpFilePath)!.toString();
const content = jsonc.parse(text);
const servers = content.servers ?? {};
Comment on lines 124 to 146
@@ -130,24 +135,31 @@ export function addAIConfig(): Rule {
};

if (tree.exists(mcpFilePath)) {
const content = JSON.parse(tree.read(mcpFilePath)!.toString());
let text = tree.read(mcpFilePath)!.toString();
const content = jsonc.parse(text);
const servers = content.servers ?? {};
let modified = false;
const formattingOptions: jsonc.FormattingOptions = { tabSize: 2, insertSpaces: true };
const newServers: Record<string, object> = {};
if (!servers["angular-cli"]) {
newServers["angular-cli"] = angularCliServer;
}
if (!servers["igniteui-cli"]) {
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants