-
Notifications
You must be signed in to change notification settings - Fork 11.9k
refactor(@angular/cli): provide a find examples MCP server tool #30717
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
2ee5662
to
e0991f1
Compare
e0991f1
to
22d76fc
Compare
queryStatement = db.prepare('SELECT * from examples WHERE examples MATCH ? ORDER BY rank;'); | ||
} | ||
|
||
const sanitizedQuery = sanitizeSearchQuery(query); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there no library we can use for sanitization, or do we just avoid another dependency? I'd prefer us not having to maintain this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's particular to the Sqlite FTS5 query microsyntax. It's mainly about wrapping query substrings to avoid unintentionally using some of the more esoteric query features like column filters via -
. The entire query string is properly escaped due to the prepared statement usage.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there no library for this? It feels like logic that can be hard to revisit in the future
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no. It's not SQL. it's a custom microsyntax for the FTS5 extension that's being used as a string literal in the parent SQL query.
The built-in stdio MCP server (`ng mcp`) for the Angular CLI now includes a tool that can find Angular code usage examples. The code examples are indexed and stored locally within the Angular CLI install. This removes the need for network requests to find the examples. It also ensures that the examples are relevant for the version of Angular currently being used. This tool requires Node.js 22.16 or higher. Lower versions will not have this specific tool available for use. The tool is currently disabled by default but can be enabled for experimental purposes via the `NG_MCP_CODE_EXAMPLES=1` environment variable.
22d76fc
to
d6835ff
Compare
The built-in stdio MCP server (
ng mcp
) for the Angular CLI now includes a tool that can find Angular code usage examples. The code examples are indexed and stored locally within the Angular CLI install. This removes the need for network requests to find the examples. It also ensures that the examples are relevant for the version of Angular currently being used. This tool requires Node.js 22.16 or higher. Lower versions will not have this specific tool available for use.The tool is currently disabled by default but can be enabled for experimental purposes via the
NG_MCP_CODE_EXAMPLES=1
environment variable.