@knip/mcp 0.0.2 → 0.0.4
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.
|
@@ -1,26 +1,37 @@
|
|
|
1
1
|
---
|
|
2
2
|
title: Knip for Editors & Agents
|
|
3
|
-
date: 2025-12-
|
|
3
|
+
date: 2025-12-17
|
|
4
4
|
sidebar:
|
|
5
5
|
order: 1
|
|
6
6
|
---
|
|
7
7
|
|
|
8
|
-
_Published: 2025-12-
|
|
8
|
+
_Published: 2025-12-17_
|
|
9
|
+
|
|
10
|
+
Three years in, Knip has founds its place in [over 10.000 projects][1] and is
|
|
11
|
+
downloaded [over 18M times/month][2]. A long period of steady growth in usage
|
|
12
|
+
and stability allows Knip to become more accessible to more people. That's why
|
|
13
|
+
I'm excited and proud to introduce the brand new VS Code Extension **and** MCP
|
|
14
|
+
Server. For humans and coding agents alike, Knip will help keep your codebases
|
|
15
|
+
tidy.
|
|
16
|
+
|
|
17
|
+
Don't forget... Knip it before you ship it!
|
|
9
18
|
|
|
10
19
|
## VS Code Extension
|
|
11
20
|
|
|
12
21
|
This one is for you.
|
|
13
22
|
|
|
14
|
-
[The usual suspects][
|
|
23
|
+
[The usual suspects][3] like red squiggles for unused exports are there. What
|
|
15
24
|
really moves the needle for DX with Knip's module graph is **navigation**. A
|
|
16
25
|
completely unique way to view & fly through codebases for developers who care.
|
|
17
26
|
Connect the dots during development and refactors, while keeping things in
|
|
18
|
-
check. We're starting out with [3 key features][
|
|
27
|
+
check. We're starting out with [3 key features][4]:
|
|
19
28
|
|
|
20
29
|
1. **Hover over Export** for import & usage locations
|
|
21
30
|
2. **Imports Tree View** for direct links to implementations
|
|
22
31
|
3. **Exports Tree View** for direct links to import & usage locations
|
|
23
32
|
|
|
33
|
+
Find [Knip on the VS Code Marketplace][5].
|
|
34
|
+
|
|
24
35
|
## MCP Server
|
|
25
36
|
|
|
26
37
|
Configuring Knip has always been a major headache to many. No more. Tell your
|
|
@@ -28,7 +39,7 @@ coding agent to "configure knip" and it will RTFM so you don't have to. Using a
|
|
|
28
39
|
newer model like Opus 4.5 or GPT 5.2 results in an optimized `knip.json` file
|
|
29
40
|
and an uncluttered codebase.
|
|
30
41
|
|
|
31
|
-
The [MCP Server is available][
|
|
42
|
+
The [MCP Server is available][6] separately and built into the VS Code
|
|
32
43
|
Extension.
|
|
33
44
|
|
|
34
45
|
## Language Server
|
|
@@ -40,25 +51,25 @@ information. Queries like "where is an export imported" or "is this import part
|
|
|
40
51
|
of a circular dependency" are just scratching the surface here.
|
|
41
52
|
|
|
42
53
|
Extensions for other IDEs can be built on top. See
|
|
43
|
-
[language-server/README.md][
|
|
54
|
+
[language-server/README.md][7]
|
|
44
55
|
|
|
45
56
|
## Screenshots
|
|
46
57
|
|
|
47
|
-
- [Lint Findings][
|
|
48
|
-
- [Imports & Exports][
|
|
49
|
-
- [Contention][
|
|
50
|
-
- [Circular Dependencies][
|
|
51
|
-
- [Conflicts][
|
|
52
|
-
- [Branching][
|
|
53
|
-
- [VS Code Extension Settings][
|
|
58
|
+
- [Lint Findings][3]
|
|
59
|
+
- [Imports & Exports][4]
|
|
60
|
+
- [Contention][8]
|
|
61
|
+
- [Circular Dependencies][9]
|
|
62
|
+
- [Conflicts][10]
|
|
63
|
+
- [Branching][11]
|
|
64
|
+
- [VS Code Extension Settings][12]
|
|
54
65
|
|
|
55
66
|
### Lint Findings
|
|
56
67
|
|
|
57
|
-
![Lint Findings][
|
|
68
|
+
![Lint Findings][13]
|
|
58
69
|
|
|
59
70
|
### Imports & Exports
|
|
60
71
|
|
|
61
|
-
![hover][
|
|
72
|
+
![hover][14]
|
|
62
73
|
|
|
63
74
|
### Contention
|
|
64
75
|
|
|
@@ -70,7 +81,7 @@ branched/diamond-shaped import chains.
|
|
|
70
81
|
|
|
71
82
|
If an import is part of a circular dependency, Knip will display:
|
|
72
83
|
|
|
73
|
-
![Circular Dependencies][
|
|
84
|
+
![Circular Dependencies][15]
|
|
74
85
|
|
|
75
86
|
#### Conflicts
|
|
76
87
|
|
|
@@ -78,7 +89,7 @@ TypeScript shows direct conflicts when importing or re-exporting the same named
|
|
|
78
89
|
export from different files. Except when the problem is more subtle and the
|
|
79
90
|
chain spans more than one file. Knip warns:
|
|
80
91
|
|
|
81
|
-
![Conflicts][
|
|
92
|
+
![Conflicts][16]
|
|
82
93
|
|
|
83
94
|
#### Branching
|
|
84
95
|
|
|
@@ -86,24 +97,28 @@ Branched or diamond-shaped imports chains indicate unnecessary re-exports and
|
|
|
86
97
|
complexity. They help to untangle large codebases and shrink or get rid of
|
|
87
98
|
barrel files. Knip warns:
|
|
88
99
|
|
|
89
|
-
![Branching][
|
|
100
|
+
![Branching][17]
|
|
90
101
|
|
|
91
102
|
### VS Code Extension Settings
|
|
92
103
|
|
|
93
|
-
![VS Code Extension Settings][
|
|
94
|
-
|
|
95
|
-
[1]:
|
|
96
|
-
[2]:
|
|
97
|
-
[3]:
|
|
98
|
-
[4]:
|
|
99
|
-
[5]:
|
|
100
|
-
[6]:
|
|
101
|
-
[7]:
|
|
102
|
-
|
|
103
|
-
[
|
|
104
|
-
[
|
|
105
|
-
[
|
|
106
|
-
[
|
|
107
|
-
[
|
|
108
|
-
[
|
|
109
|
-
[
|
|
104
|
+
![VS Code Extension Settings][18]
|
|
105
|
+
|
|
106
|
+
[1]: https://github.com/webpro-nl/knip/network/dependents
|
|
107
|
+
[2]: https://www.npmjs.com/package/knip
|
|
108
|
+
[3]: #lint-findings
|
|
109
|
+
[4]: #imports--exports
|
|
110
|
+
[5]: https://marketplace.visualstudio.com/items?itemName=webpro.vscode-knip
|
|
111
|
+
[6]: https://www.npmjs.com/package/@knip/mcp
|
|
112
|
+
[7]:
|
|
113
|
+
https://github.com/webpro-nl/knip/blob/main/packages/language-server/README.md
|
|
114
|
+
[8]: #contention
|
|
115
|
+
[9]: #circular-dependencies
|
|
116
|
+
[10]: #conflicts
|
|
117
|
+
[11]: #branching
|
|
118
|
+
[12]: #vs-code-extension-settings
|
|
119
|
+
[13]: /screenshots/editors-and-agents/diagnostics.webp
|
|
120
|
+
[14]: /screenshots/editors-and-agents/imports-exports.webp
|
|
121
|
+
[15]: /screenshots/editors-and-agents/circular-dependency.webp
|
|
122
|
+
[16]: /screenshots/editors-and-agents/conflict.webp
|
|
123
|
+
[17]: /screenshots/editors-and-agents/branch.webp
|
|
124
|
+
[18]: /screenshots/editors-and-agents/vscode-extension-settings.webp
|
|
@@ -73,10 +73,11 @@ This will give a lengthy output, including:
|
|
|
73
73
|
|
|
74
74
|
## Trace
|
|
75
75
|
|
|
76
|
-
Use `--trace` to see where
|
|
76
|
+
Use `--trace` to see where exports or dependencies are used:
|
|
77
77
|
|
|
78
78
|
- Use `--trace-file [path]` to output this only for the given file.
|
|
79
79
|
- Use `--trace-export [name]` to output this only for the given export name.
|
|
80
|
+
- Use `--trace-dependency [name]` to find where a dependency is imported
|
|
80
81
|
- Use both to trace a specific named or default export of a certain file.
|
|
81
82
|
|
|
82
83
|
This works across re-exports, barrel files and workspaces. Here's an example
|
|
@@ -87,6 +88,13 @@ screenshot:
|
|
|
87
88
|
It's like a reversed module graph. Instead of traversing imports it goes in the
|
|
88
89
|
opposite direction and shows where exports are imported.
|
|
89
90
|
|
|
91
|
+
The `--trace-dependency` accepts strings for exact matches, but if it looks like
|
|
92
|
+
a regex that works too:
|
|
93
|
+
|
|
94
|
+
<img src="/screenshots/trace-dependency.png" alt="trace dependency" class="mw500" />
|
|
95
|
+
|
|
96
|
+
Use [--workspace \[dir\]][8] to filter accordingly.
|
|
97
|
+
|
|
90
98
|
#### Legend
|
|
91
99
|
|
|
92
100
|
| | Description |
|
|
@@ -101,16 +109,16 @@ If you want to open an issue, please see [issue reproduction][6].
|
|
|
101
109
|
|
|
102
110
|
## Understanding Knip
|
|
103
111
|
|
|
104
|
-
Looking to better understand how Knip works? The [entry files][
|
|
105
|
-
[plugins][
|
|
106
|
-
check out features like [production mode][
|
|
112
|
+
Looking to better understand how Knip works? The [entry files][9] and
|
|
113
|
+
[plugins][10] explanations cover two core concepts. After this you might want to
|
|
114
|
+
check out features like [production mode][11] and [monorepos & workspaces][12].
|
|
107
115
|
|
|
108
|
-
In a more general sense, [Why use Knip?][
|
|
116
|
+
In a more general sense, [Why use Knip?][13] explains what Knip can do for you.
|
|
109
117
|
|
|
110
118
|
## Asking for help
|
|
111
119
|
|
|
112
120
|
If you can't find your answer in any of the aforementioned resources, feel free
|
|
113
|
-
to [open an issue on GitHub][
|
|
121
|
+
to [open an issue on GitHub][14].
|
|
114
122
|
|
|
115
123
|
[1]: #lint-issues-reported-by-knip
|
|
116
124
|
[2]: #exceptions-thrown-by-knip
|
|
@@ -119,9 +127,10 @@ to [open an issue on GitHub][13].
|
|
|
119
127
|
[5]: ../guides/handling-issues.md
|
|
120
128
|
[6]: ./issue-reproduction.md
|
|
121
129
|
[7]: ../reference/known-issues.md
|
|
122
|
-
[8]: ../
|
|
123
|
-
[9]: ../explanations/
|
|
124
|
-
[10]: ../
|
|
125
|
-
[11]: ../features/
|
|
126
|
-
[12]: ../
|
|
127
|
-
[13]:
|
|
130
|
+
[8]: ../reference/cli.md#--workspace-dir
|
|
131
|
+
[9]: ../explanations/entry-files.md
|
|
132
|
+
[10]: ../explanations/plugins.md
|
|
133
|
+
[11]: ../features/production-mode.md
|
|
134
|
+
[12]: ../features/monorepos-and-workspaces.md
|
|
135
|
+
[13]: ../explanations/why-use-knip.md
|
|
136
|
+
[14]: https://github.com/webpro-nl/knip/issues
|
package/docs/reference/cli.md
CHANGED
|
@@ -155,6 +155,10 @@ Trace exports to see where they are imported.
|
|
|
155
155
|
|
|
156
156
|
Also see [Trace][7].
|
|
157
157
|
|
|
158
|
+
### `--trace-dependency [name]`
|
|
159
|
+
|
|
160
|
+
Trace package or binary name to see where it's referenced. Implies [--trace][8].
|
|
161
|
+
|
|
158
162
|
### `--trace-export [name]`
|
|
159
163
|
|
|
160
164
|
Trace export name to see where it's imported. Implies [--trace][8].
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@knip/mcp",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.4",
|
|
4
4
|
"description": "Knip MCP Server",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
"dependencies": {
|
|
30
30
|
"@modelcontextprotocol/sdk": "^1.24.3",
|
|
31
31
|
"zod": "^4.1.11",
|
|
32
|
-
"knip": "5.
|
|
32
|
+
"knip": "5.76.0"
|
|
33
33
|
},
|
|
34
34
|
"engines": {
|
|
35
35
|
"node": ">=18.18.0"
|