constQUERY_DESCRIPTION=`A piece of JavaScript code that will be executed.
It can access the module graph and extract information it finds useful.
The \`console.log\` function can be used to log messages, which will also be returned in the response.
No Node.js or browser APIs are available, but JavaScript language features are available.
When the user is interested in used exports of modules, you can use the \`export\` property of ModuleReferences (\`incomingReferences\`).
When the user is interested in the import path of a module, follow one of the \`incomingReferences\` with a smaller \`depth\` value than the current module until you hit the root.
Do not try to make any assumptions or estimations. See the typings to see which data you have available. If you don't have the data, tell the user that this data is not available and list alternatives that are available.
See the following TypeScript typings for reference:
\`\`\` typescript
interface Module {
/// The identifier of the module, which is a unique string.
/// Example: "[project]/packages/next-app/src/app/folder/page.tsx [app-rsc] (ecmascript, Next.js Server Component)"
/// These layers exist in App Router:
/// * Server Components: [app-rsc], [app-edge-rsc]
/// * API routes: [app-route], [app-edge-route]
/// * Client Components: [app-client]
/// * Server Side Rendering of Client Components: [app-ssr], [app-edge-ssr]
/// How this reference affects chunking of the module.
/// hoisted | sync: The module is placed in the same chunk group as the referencing module.
/// hoisted: The module is loaded before all "sync" modules.
/// async: The module forms a separate chunk group which is loaded asynchronously.
/// isolated: The module forms a separate chunk group which is loaded as separate entry. When it has a name, all modules imported with this name are placed in the same chunk group.
/// shared: The module forms a separate chunk group which is loaded before the current chunk group. When it has a name, all modules imported with this name are placed in the same chunk group.
/// traced: The module is not bundled, but the graph is still traced and all modules are included unbundled.
'Query details about the module graph the whole application. This is a expensive operation and should only be used when module graph of the whole application is needed.',
// "Internal error" see https://www.jsonrpc.org/specification
code:-32603,
message,
},
id:null,
})
)
return{finished:true}
}
if(!mcpSecret){
Log.error('Next.js MCP server is not enabled')
Log.info(
'To enable it, set the NEXT_EXPERIMENTAL_MCP_SECRET environment variable to a secret value. This will make the MCP server available at /_next/mcp?{NEXT_EXPERIMENTAL_MCP_SECRET}'