link
Symlink local npm packages for development by connecting directory paths to package names, enabling real-time testing and iteration without publishing.
Instructions
Symlink a local package for development
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| path | Yes | Absolute path to the package directory | |
| package | No | Package name to link (omit to link current dir globally) |
Implementation Reference
- src/index.ts:981-1001 (handler)Implementation of the "link" tool, which runs `npm link` in the specified directory, optionally linking a specific package.
server.tool( "link", "Symlink a local package for development", { path: z.string().describe("Absolute path to the package directory"), package: z.string().optional().describe("Package name to link (omit to link current dir globally)"), }, async ({ path, package: pkg }) => { const args = ["link"]; if (pkg) args.push(pkg); try { const { stdout, stderr } = await run(args, path); return { content: [{ type: "text", text: stdout + stderr }] }; } catch (e: any) { return { content: [{ type: "text", text: `Error: ${e.stderr || e.message}` }], isError: true, }; } }, );