Skip to content

Commit 8c74778

Browse files
Copilotk3nsei
andcommitted
Configure Angular MCP integration with official MCP server setup
Co-authored-by: k3nsei <190422+k3nsei@users.noreply.github.com>
1 parent ff0664e commit 8c74778

File tree

9 files changed

+62
-49
lines changed

9 files changed

+62
-49
lines changed

README.md

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,11 @@
1313

1414
## Compatibility matrix 🔢
1515

16-
| **ng-in-viewport** | **Angular** |
17-
| ------------------ | ------------------------------------------------ |
16+
| **ng-in-viewport** | **Angular** |
17+
| ------------------ | ----------------------------------------------- |
1818
| `16.1.x` | `>= 17.x.y \|\| 18.x.y \|\| 19.x.y \|\| 20.x.y` |
19-
| `16.0.x` | `16.x.y \|\| 15.x.y` |
20-
| `15.0.x` | `15.x.y \|\| 14.x.y` |
19+
| `16.0.x` | `16.x.y \|\| 15.x.y` |
20+
| `15.0.x` | `15.x.y \|\| 14.x.y` |
2121

2222
## Support the Project 💖
2323

@@ -31,6 +31,25 @@ By sponsoring, you'll help to:
3131

3232
Every contribution makes a difference, and even a small gesture goes a long way in keeping `ng-in-viewport` up to date for the community.
3333

34+
## Development 🛠️
35+
36+
### Angular MCP Integration
37+
38+
This project includes Model Context Protocol (MCP) integration for enhanced AI development assistance. The MCP configuration can be found in `mcp-config.json`:
39+
40+
```json
41+
{
42+
"servers": {
43+
"angular-cli": {
44+
"command": "npx",
45+
"args": ["-y", "@angular/cli", "mcp"]
46+
}
47+
}
48+
}
49+
```
50+
51+
This configuration enables AI tools like Claude Desktop to interact with Angular CLI commands through the MCP protocol. For more information about Angular MCP, visit the [official documentation](https://angular.dev/ai/mcp).
52+
3453
## License 📝
3554

3655
[MIT](https://github.com/k3nsei/ng-in-viewport/blob/stable/LICENSE)

e2e/demo/demo.spec.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,11 +69,11 @@ test.describe('GIVEN: Demo Application', () => {
6969
async function assertColumnItems(page: any, column: 'first' | 'second', start: number, end?: number): Promise<void> {
7070
const items = page.locator(`.example--${column} .item`);
7171
const itemCount = await items.count();
72-
72+
7373
for (let i = 0; i < itemCount; i++) {
7474
const item = items.nth(i);
7575
const number = i + 1;
76-
76+
7777
if (inRange(number, start, end)) {
7878
await expect(item).toHaveClass(/item--active/);
7979
} else {
@@ -87,4 +87,4 @@ function inRange(value: number, start: number, end?: number): boolean {
8787
return value === start;
8888
}
8989
return value >= start && value <= end;
90-
}
90+
}

e2e/example/page-highlighting.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,4 @@ test.describe('GIVEN: Example Application', () => {
1818
await expect(activeTab).toContainText('Highlighting');
1919
});
2020
});
21-
});
21+
});

eslint.config.js

Lines changed: 18 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,7 @@ const globals = require('globals');
1212

1313
module.exports = [
1414
{
15-
ignores: [
16-
'dist/**',
17-
'node_modules/**',
18-
'coverage/**',
19-
'*.d.ts',
20-
],
15+
ignores: ['dist/**', 'node_modules/**', 'coverage/**', '*.d.ts'],
2116
},
2217
// Base config for TypeScript files
2318
{
@@ -37,57 +32,50 @@ module.exports = [
3732
plugins: {
3833
'@typescript-eslint': tseslint,
3934
'@angular-eslint': angular,
40-
'import': importPlugin,
41-
'prettier': prettier,
35+
import: importPlugin,
36+
prettier: prettier,
4237
},
4338
rules: {
4439
...eslint.configs.recommended.rules,
4540
...tseslint.configs.recommended.rules,
4641
...angular.configs.recommended.rules,
4742
...prettierConfig.rules,
48-
43+
4944
// Import rules
5045
'sort-imports': [
5146
'error',
5247
{
53-
'ignoreDeclarationSort': true,
54-
'allowSeparatedGroups': true,
48+
ignoreDeclarationSort: true,
49+
allowSeparatedGroups: true,
5550
},
5651
],
5752
'import/first': 'error',
5853
'import/order': [
5954
'error',
6055
{
61-
'alphabetize': { 'order': 'asc', 'caseInsensitive': true },
56+
alphabetize: { order: 'asc', caseInsensitive: true },
6257
'newlines-between': 'always',
63-
'groups': [
64-
['builtin', 'external'],
65-
'internal',
66-
'parent',
67-
['sibling', 'index'],
68-
'object',
69-
'type',
70-
],
58+
groups: [['builtin', 'external'], 'internal', 'parent', ['sibling', 'index'], 'object', 'type'],
7159
},
7260
],
7361

7462
// TypeScript rules
7563
'@typescript-eslint/no-unused-vars': [
7664
'error',
7765
{
78-
'argsIgnorePattern': '^_',
79-
'caughtErrors': 'all',
80-
'caughtErrorsIgnorePattern': '^(_|ignore)',
81-
'destructuredArrayIgnorePattern': '^_',
82-
'ignoreRestSiblings': true,
66+
argsIgnorePattern: '^_',
67+
caughtErrors: 'all',
68+
caughtErrorsIgnorePattern: '^(_|ignore)',
69+
destructuredArrayIgnorePattern: '^_',
70+
ignoreRestSiblings: true,
8371
},
8472
],
8573
'@typescript-eslint/explicit-member-accessibility': [
8674
'error',
8775
{
88-
'accessibility': 'explicit',
89-
'overrides': {
90-
'constructors': 'no-public',
76+
accessibility: 'explicit',
77+
overrides: {
78+
constructors: 'no-public',
9179
},
9280
},
9381
],
@@ -110,11 +98,11 @@ module.exports = [
11098
},
11199
plugins: {
112100
'@angular-eslint/template': angularTemplate,
113-
'prettier': prettier,
101+
prettier: prettier,
114102
},
115103
rules: {
116104
...angularTemplate.configs.recommended.rules,
117105
'prettier/prettier': 'error',
118106
},
119107
},
120-
];
108+
];

mcp-config.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"servers": {
3+
"angular-cli": {
4+
"command": "npx",
5+
"args": ["-y", "@angular/cli", "mcp"]
6+
}
7+
}
8+
}

playwright.config.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,15 +28,15 @@ export default defineConfig({
2828
projects: [
2929
{
3030
name: 'demo-app-chromium',
31-
use: {
31+
use: {
3232
...devices['Desktop Chrome'],
3333
baseURL: 'http://localhost:4200',
3434
},
3535
testDir: './e2e/demo',
3636
},
3737
{
3838
name: 'example-app-chromium',
39-
use: {
39+
use: {
4040
...devices['Desktop Chrome'],
4141
baseURL: 'http://localhost:4300',
4242
},
@@ -57,4 +57,4 @@ export default defineConfig({
5757
reuseExistingServer: !process.env.CI,
5858
},
5959
],
60-
});
60+
});

projects/ng-in-viewport/src/lib/services/in-viewport.service.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,9 @@ export class InViewportService {
2828

2929
#getCache(): ObserverCache {
3030
if (!this.#cache) {
31-
this.#cache = this.zone.runOutsideAngular(() => new ObserverCache((entries) => this.#onIntersectionEvent(entries)));
31+
this.#cache = this.zone.runOutsideAngular(
32+
() => new ObserverCache((entries) => this.#onIntersectionEvent(entries))
33+
);
3234
}
3335
return this.#cache;
3436
}

projects/ng-in-viewport/src/lib/utils/observer-cache.spec.ts

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -38,16 +38,12 @@ vi.mock('./observer-cache-item', () => ({
3838

3939
// Helper functions to check if any mock instance was called with the node
4040
function expectAnyAddNodeCalledWith(node: Element) {
41-
const wasCalled = mockInstances.some(instance =>
42-
instance.addNode.mock.calls.some(call => call[0] === node)
43-
);
41+
const wasCalled = mockInstances.some((instance) => instance.addNode.mock.calls.some((call) => call[0] === node));
4442
expect(wasCalled).toBe(true);
4543
}
4644

4745
function expectAnyDeleteNodeCalledWith(node: Element) {
48-
const wasCalled = mockInstances.some(instance =>
49-
instance.deleteNode.mock.calls.some(call => call[0] === node)
50-
);
46+
const wasCalled = mockInstances.some((instance) => instance.deleteNode.mock.calls.some((call) => call[0] === node));
5147
expect(wasCalled).toBe(true);
5248
}
5349

test-setup/global-mocks.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,4 +60,4 @@ Object.defineProperty(global, 'IntersectionObserver', {
6060
writable: true,
6161
configurable: true,
6262
value: MockIntersectionObserver,
63-
});
63+
});

0 commit comments

Comments
 (0)