@ng-annotate/mcp-server 0.2.4 → 0.2.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md ADDED
@@ -0,0 +1,85 @@
1
+ # @ng-annotate/mcp-server
2
+
3
+ MCP server for [ng-annotate-mcp](https://github.com/yngvebn/ngagentify) — a dev-only Angular toolchain addon that lets you annotate components in the browser and have an AI agent (Claude) act on those annotations in real time.
4
+
5
+ ## What this server does
6
+
7
+ Exposes MCP tools that an AI agent uses to read and act on browser annotations:
8
+
9
+ | Tool | Description |
10
+ |---|---|
11
+ | `list_sessions` | List all browser sessions |
12
+ | `get_session` | Get a session and all its annotations |
13
+ | `get_all_pending` | All pending annotations (sorted oldest first) |
14
+ | `get_pending` | Pending annotations for one session |
15
+ | `acknowledge` | Mark annotation as acknowledged (before editing files) |
16
+ | `resolve` | Mark annotation as resolved with a summary |
17
+ | `dismiss` | Dismiss annotation with a reason |
18
+ | `reply` | Add a reply (for clarifications) |
19
+ | `watch_annotations` | Long-poll (25 s) for new pending annotations |
20
+
21
+ ## Install
22
+
23
+ ```bash
24
+ ng add @ng-annotate/angular
25
+ ```
26
+
27
+ The schematic configures the MCP server automatically. For manual setup, add to `.mcp.json` (Claude Code):
28
+
29
+ ```json
30
+ {
31
+ "mcpServers": {
32
+ "ng-annotate": {
33
+ "command": "npx",
34
+ "args": ["-y", "@ng-annotate/mcp-server"],
35
+ "env": {
36
+ "NG_ANNOTATE_PROJECT_ROOT": "/path/to/your/project"
37
+ }
38
+ }
39
+ }
40
+ }
41
+ ```
42
+
43
+ Or `.vscode/mcp.json` (VS Code Copilot):
44
+
45
+ ```json
46
+ {
47
+ "servers": {
48
+ "ng-annotate": {
49
+ "type": "stdio",
50
+ "command": "npx",
51
+ "args": ["-y", "@ng-annotate/mcp-server"],
52
+ "env": {
53
+ "NG_ANNOTATE_PROJECT_ROOT": "/path/to/your/project"
54
+ }
55
+ }
56
+ }
57
+ }
58
+ ```
59
+
60
+ ## Usage
61
+
62
+ Once the MCP server is connected, invoke the `start-polling` prompt in your AI editor:
63
+
64
+ ```
65
+ /mcp ng-annotate start-polling
66
+ ```
67
+
68
+ The agent will drain pending annotations, then enter a `watch_annotations` loop — processing browser annotations as they arrive and editing files automatically.
69
+
70
+ ## Environment variables
71
+
72
+ | Variable | Description |
73
+ |---|---|
74
+ | `NG_ANNOTATE_PROJECT_ROOT` | Absolute path to the Angular project root. Used to locate the annotation store (`.ng-annotate/store.json`). |
75
+
76
+ ## Related packages
77
+
78
+ | Package | Purpose |
79
+ |---|---|
80
+ | [`@ng-annotate/angular`](https://www.npmjs.com/package/@ng-annotate/angular) | Angular library (overlay UI, `provideNgAnnotate()`) |
81
+ | [`@ng-annotate/vite-plugin`](https://www.npmjs.com/package/@ng-annotate/vite-plugin) | Vite plugin (WebSocket server, component manifest) |
82
+
83
+ ## License
84
+
85
+ MIT
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env node
2
+ // Entry point for the ng-annotate-mcp binary.
3
+ // The shebang above causes npm to generate a correct Windows .cmd shim
4
+ // that prepends `node`, rather than trying to run the .js file directly.
5
+ import('../dist/index.js').catch(err => {
6
+ process.stderr.write('[ng-annotate-mcp] Fatal: ' + String(err) + '\n');
7
+ process.exit(1);
8
+ });
package/dist/index.js CHANGED
@@ -1,14 +1,24 @@
1
1
  import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
2
2
  import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
3
3
  import { registerTools } from './tools.js';
4
+ function log(msg) {
5
+ process.stderr.write(`[ng-annotate-mcp] ${msg}\n`);
6
+ }
4
7
  async function main() {
8
+ log(`starting up (cwd: ${process.cwd()}, node: ${process.version})`);
5
9
  const server = new McpServer({
6
10
  name: 'ng-annotate',
7
11
  version: '0.1.0',
8
12
  description: 'Connects an AI agent to a live Angular dev session for annotation-driven code changes',
9
13
  });
14
+ log('registering tools...');
10
15
  registerTools(server);
16
+ log('connecting stdio transport...');
11
17
  const transport = new StdioServerTransport();
12
18
  await server.connect(transport);
19
+ log('connected — ready for requests');
13
20
  }
14
- main().catch(console.error);
21
+ main().catch((err) => {
22
+ process.stderr.write(`[ng-annotate-mcp] fatal error: ${String(err)}\n`);
23
+ process.exit(1);
24
+ });
package/dist/store.js CHANGED
@@ -4,7 +4,11 @@ import { v4 as uuidv4 } from 'uuid';
4
4
  const EMPTY_STORE = { sessions: {}, annotations: {} };
5
5
  // ─── File paths ───────────────────────────────────────────────────────────────
6
6
  export const STORE_DIR = '.ng-annotate';
7
- export const STORE_PATH = path.join(process.cwd(), STORE_DIR, 'store.json');
7
+ // NG_ANNOTATE_PROJECT_ROOT lets the MCP server find the store even when its
8
+ // working directory differs from the Angular project root (e.g. when spawned
9
+ // by VS Code Copilot or Claude Code from a non-project cwd).
10
+ const PROJECT_ROOT = process.env.NG_ANNOTATE_PROJECT_ROOT ?? process.cwd();
11
+ export const STORE_PATH = path.join(PROJECT_ROOT, STORE_DIR, 'store.json');
8
12
  // ─── Store init ───────────────────────────────────────────────────────────────
9
13
  export function ensureStore() {
10
14
  const dir = path.join(process.cwd(), STORE_DIR);
package/package.json CHANGED
@@ -1,16 +1,28 @@
1
1
  {
2
2
  "name": "@ng-annotate/mcp-server",
3
- "version": "0.2.4",
3
+ "version": "0.2.6",
4
4
  "type": "module",
5
5
  "bin": {
6
- "ng-annotate-mcp": "dist/index.js"
6
+ "ng-annotate-mcp": "bin/ng-annotate-mcp.js"
7
7
  },
8
+ "description": "MCP server for ng-annotate-mcp — exposes Angular browser annotations as MCP tools for AI agents",
9
+ "keywords": [
10
+ "angular",
11
+ "mcp",
12
+ "mcp-server",
13
+ "ai",
14
+ "claude",
15
+ "devtools",
16
+ "ng-annotate"
17
+ ],
8
18
  "repository": {
9
19
  "type": "git",
10
20
  "url": "https://github.com/yngvebn/ngagentify"
11
21
  },
12
22
  "files": [
13
- "dist"
23
+ "dist",
24
+ "bin",
25
+ "README.md"
14
26
  ],
15
27
  "main": "dist/index.js",
16
28
  "types": "dist/index.d.ts",