@neuledge/context 0.1.0
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/LICENSE +202 -0
- package/README.md +484 -0
- package/dist/build.d.ts +25 -0
- package/dist/build.js +309 -0
- package/dist/build.js.map +1 -0
- package/dist/cli.d.ts +12 -0
- package/dist/cli.js +454 -0
- package/dist/cli.js.map +1 -0
- package/dist/db.d.ts +4 -0
- package/dist/db.js +24 -0
- package/dist/db.js.map +1 -0
- package/dist/git.d.ts +74 -0
- package/dist/git.js +397 -0
- package/dist/git.js.map +1 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.js +9 -0
- package/dist/index.js.map +1 -0
- package/dist/package-builder.d.ts +22 -0
- package/dist/package-builder.js +80 -0
- package/dist/package-builder.js.map +1 -0
- package/dist/search.d.ts +12 -0
- package/dist/search.js +152 -0
- package/dist/search.js.map +1 -0
- package/dist/server.d.ts +20 -0
- package/dist/server.js +108 -0
- package/dist/server.js.map +1 -0
- package/dist/store.d.ts +31 -0
- package/dist/store.js +58 -0
- package/dist/store.js.map +1 -0
- package/dist/test-utils.d.ts +17 -0
- package/dist/test-utils.js +37 -0
- package/dist/test-utils.js.map +1 -0
- package/package.json +69 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
178
|
+
|
|
179
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
180
|
+
|
|
181
|
+
To apply the Apache License to your work, attach the following
|
|
182
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
183
|
+
replaced with your own identifying information. (Don't include
|
|
184
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
185
|
+
comment syntax for the file format. We also recommend that a
|
|
186
|
+
file or class name and description of purpose be included on the
|
|
187
|
+
same "printed page" as the copyright notice for easier
|
|
188
|
+
identification within third-party archives.
|
|
189
|
+
|
|
190
|
+
Copyright [yyyy] [name of copyright owner]
|
|
191
|
+
|
|
192
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
193
|
+
you may not use this file except in compliance with the License.
|
|
194
|
+
You may obtain a copy of the License at
|
|
195
|
+
|
|
196
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
197
|
+
|
|
198
|
+
Unless required by applicable law or agreed to in writing, software
|
|
199
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
200
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
201
|
+
See the License for the specific language governing permissions and
|
|
202
|
+
limitations under the License.
|
package/README.md
ADDED
|
@@ -0,0 +1,484 @@
|
|
|
1
|
+
<p align="center">
|
|
2
|
+
<h1 align="center">Context</h1>
|
|
3
|
+
<p align="center">
|
|
4
|
+
<strong>Local-first documentation for AI agents</strong><br/>
|
|
5
|
+
Give your AI assistant expert knowledge of any library—offline, instant, private.
|
|
6
|
+
</p>
|
|
7
|
+
</p>
|
|
8
|
+
|
|
9
|
+
<p align="center">
|
|
10
|
+
<a href="https://www.npmjs.com/package/@neuledge/context"><img src="https://img.shields.io/npm/v/@neuledge/context.svg" alt="npm version"></a>
|
|
11
|
+
<a href="https://github.com/neuledge/context/blob/main/LICENSE"><img src="https://img.shields.io/badge/license-Apache--2.0-blue.svg" alt="License"></a>
|
|
12
|
+
<a href="https://www.typescriptlang.org/"><img src="https://img.shields.io/badge/TypeScript-5.0-blue.svg" alt="TypeScript"></a>
|
|
13
|
+
</p>
|
|
14
|
+
|
|
15
|
+
---
|
|
16
|
+
|
|
17
|
+
## The Problem
|
|
18
|
+
|
|
19
|
+
You're building with Next.js 15, and your AI assistant confidently suggests code using the old Pages Router because that's what it learned from training data. You paste the docs. It hallucinates anyway. You paste more docs. The context window fills up. Repeat.
|
|
20
|
+
|
|
21
|
+
**AI assistants are powerful, but they're stuck in the past.** Their training data is months or years old, and they don't know the specifics of the libraries you're using today.
|
|
22
|
+
|
|
23
|
+
---
|
|
24
|
+
|
|
25
|
+
## The Solution
|
|
26
|
+
|
|
27
|
+
Context connects your AI assistant directly to up-to-date documentation—locally, instantly, and privately.
|
|
28
|
+
|
|
29
|
+
```
|
|
30
|
+
You: "How do I create middleware in Next.js 15?"
|
|
31
|
+
|
|
32
|
+
AI: [automatically queries local docs]
|
|
33
|
+
"In Next.js 15, create a middleware.ts file in your project root..."
|
|
34
|
+
[accurate, version-specific answer]
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
No copy-pasting. No hallucinations about deprecated APIs. No waiting for cloud lookups.
|
|
38
|
+
|
|
39
|
+
---
|
|
40
|
+
|
|
41
|
+
## Real-World Use Cases
|
|
42
|
+
|
|
43
|
+
### :muscle: "Make my AI actually useful for the stack I use"
|
|
44
|
+
|
|
45
|
+
Add docs for your entire tech stack. Your AI assistant becomes an expert in the exact versions you're using:
|
|
46
|
+
|
|
47
|
+
```bash
|
|
48
|
+
context add https://github.com/vercel/next.js
|
|
49
|
+
context add https://github.com/prisma/prisma
|
|
50
|
+
context add https://github.com/tailwindlabs/tailwindcss
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
Now ask things like:
|
|
54
|
+
- *"How do I set up Prisma with Next.js App Router?"*
|
|
55
|
+
- *"What's the Tailwind config for dark mode?"*
|
|
56
|
+
- *"Show me the new Server Actions syntax"*
|
|
57
|
+
|
|
58
|
+
### :building_construction: "Stop answering the same questions for my team"
|
|
59
|
+
|
|
60
|
+
Building an internal library? Package your documentation once, share it with your team:
|
|
61
|
+
|
|
62
|
+
```bash
|
|
63
|
+
# Build docs from your repo
|
|
64
|
+
context add https://github.com/your-company/design-system
|
|
65
|
+
|
|
66
|
+
# Your whole team can now ask:
|
|
67
|
+
# "How do I use the DataTable component?"
|
|
68
|
+
# "What props does Button accept?"
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
### :airplane: "Code on flights and in coffee shops"
|
|
72
|
+
|
|
73
|
+
Context works 100% offline. Download docs once, query forever—no internet required.
|
|
74
|
+
|
|
75
|
+
### :lock: "Keep proprietary code discussions private"
|
|
76
|
+
|
|
77
|
+
Cloud documentation services see your queries. Context runs entirely on your machine. Your questions about internal APIs stay internal.
|
|
78
|
+
|
|
79
|
+
---
|
|
80
|
+
|
|
81
|
+
## Why Context Over Cloud Alternatives?
|
|
82
|
+
|
|
83
|
+
| | Context7 | Deepcon | **Context** |
|
|
84
|
+
|---|:---:|:---:|:---:|
|
|
85
|
+
| **Price** | $10/month | $8/month | **Free forever** |
|
|
86
|
+
| **Free tier** | 1,000 req/month ¹ | 100 req/month | **Unlimited** |
|
|
87
|
+
| **Rate limits** | 60 req/hour | Throttled | **None** |
|
|
88
|
+
| **Latency** | 100-500ms | 100-300ms | **<10ms** |
|
|
89
|
+
| **Works offline** | :x: | :x: | :white_check_mark: |
|
|
90
|
+
| **Privacy** | Queries sent to cloud | Queries sent to cloud | **100% local** |
|
|
91
|
+
| **Private repos** | $15/1M tokens | :x: | **Free** |
|
|
92
|
+
|
|
93
|
+
<sub>¹ Context7 reduced free tier from ~6,000 to 1,000 requests/month in January 2026</sub>
|
|
94
|
+
|
|
95
|
+
---
|
|
96
|
+
|
|
97
|
+
## :zap: Key Features
|
|
98
|
+
|
|
99
|
+
- **Single tool** - One MCP tool does everything, no multi-step lookups
|
|
100
|
+
- **Token-aware** - Smart relevance filtering, never overwhelms the context window
|
|
101
|
+
- **Dynamic schema** - Available libraries shown in tool definition
|
|
102
|
+
- **Offline-first** - Zero network calls during operation
|
|
103
|
+
- **SQLite + FTS5** - Fast full-text search with stemming
|
|
104
|
+
|
|
105
|
+
---
|
|
106
|
+
|
|
107
|
+
## :rocket: Quick Start
|
|
108
|
+
|
|
109
|
+
### 1. Install
|
|
110
|
+
|
|
111
|
+
```bash
|
|
112
|
+
npm install -g @neuledge/context
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
### 2. Add documentation
|
|
116
|
+
|
|
117
|
+
```bash
|
|
118
|
+
# From any git repository (GitHub, GitLab, Bitbucket, etc.)
|
|
119
|
+
context add https://github.com/vercel/next.js
|
|
120
|
+
context add https://gitlab.com/org/repo
|
|
121
|
+
context add git@github.com:user/repo.git
|
|
122
|
+
|
|
123
|
+
# From a local directory
|
|
124
|
+
context add ./my-project
|
|
125
|
+
context add /path/to/docs
|
|
126
|
+
|
|
127
|
+
# From URL (pre-built package)
|
|
128
|
+
context add https://example.com/react@18.db
|
|
129
|
+
|
|
130
|
+
# From local file
|
|
131
|
+
context add ./my-package.db
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
### 3. Configure your AI agent
|
|
135
|
+
|
|
136
|
+
Context works with any MCP-compatible agent. Choose your setup below:
|
|
137
|
+
|
|
138
|
+
<details>
|
|
139
|
+
<summary><strong>Claude Desktop</strong></summary>
|
|
140
|
+
|
|
141
|
+
Add to your config file:
|
|
142
|
+
- **Linux**: `~/.config/claude/claude_desktop_config.json`
|
|
143
|
+
- **macOS**: `~/Library/Application Support/Claude/claude_desktop_config.json`
|
|
144
|
+
- **Windows**: `%APPDATA%\Claude\claude_desktop_config.json`
|
|
145
|
+
|
|
146
|
+
```json
|
|
147
|
+
{
|
|
148
|
+
"mcpServers": {
|
|
149
|
+
"context": {
|
|
150
|
+
"command": "context",
|
|
151
|
+
"args": ["serve"]
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
Restart Claude Desktop to apply changes.
|
|
158
|
+
|
|
159
|
+
</details>
|
|
160
|
+
|
|
161
|
+
<details>
|
|
162
|
+
<summary><strong>Cursor</strong></summary>
|
|
163
|
+
|
|
164
|
+
Add to `~/.cursor/mcp.json` (global) or `.cursor/mcp.json` (project-specific):
|
|
165
|
+
|
|
166
|
+
```json
|
|
167
|
+
{
|
|
168
|
+
"mcpServers": {
|
|
169
|
+
"context": {
|
|
170
|
+
"command": "context",
|
|
171
|
+
"args": ["serve"]
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
Or use **Settings > Developer > Edit Config** to add the server through the UI.
|
|
178
|
+
|
|
179
|
+
</details>
|
|
180
|
+
|
|
181
|
+
<details>
|
|
182
|
+
<summary><strong>VS Code (GitHub Copilot)</strong></summary>
|
|
183
|
+
|
|
184
|
+
> Requires VS Code 1.102+ with GitHub Copilot
|
|
185
|
+
|
|
186
|
+
Add to `.vscode/mcp.json` in your workspace:
|
|
187
|
+
|
|
188
|
+
```json
|
|
189
|
+
{
|
|
190
|
+
"servers": {
|
|
191
|
+
"context": {
|
|
192
|
+
"type": "stdio",
|
|
193
|
+
"command": "context",
|
|
194
|
+
"args": ["serve"]
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
```
|
|
199
|
+
|
|
200
|
+
Click the **Start** button that appears in the file, then use Agent mode in Copilot Chat.
|
|
201
|
+
|
|
202
|
+
</details>
|
|
203
|
+
|
|
204
|
+
<details>
|
|
205
|
+
<summary><strong>Windsurf</strong></summary>
|
|
206
|
+
|
|
207
|
+
Add to `~/.codeium/windsurf/mcp_config.json`:
|
|
208
|
+
- **Windows**: `%USERPROFILE%\.codeium\windsurf\mcp_config.json`
|
|
209
|
+
|
|
210
|
+
```json
|
|
211
|
+
{
|
|
212
|
+
"mcpServers": {
|
|
213
|
+
"context": {
|
|
214
|
+
"command": "context",
|
|
215
|
+
"args": ["serve"]
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
```
|
|
220
|
+
|
|
221
|
+
Or access via **Windsurf Settings > Cascade > MCP Servers**.
|
|
222
|
+
|
|
223
|
+
</details>
|
|
224
|
+
|
|
225
|
+
<details>
|
|
226
|
+
<summary><strong>Zed</strong></summary>
|
|
227
|
+
|
|
228
|
+
Add to your Zed settings (`cmd+,` or `ctrl+,`):
|
|
229
|
+
|
|
230
|
+
```json
|
|
231
|
+
{
|
|
232
|
+
"context_servers": {
|
|
233
|
+
"context": {
|
|
234
|
+
"command": {
|
|
235
|
+
"path": "context",
|
|
236
|
+
"args": ["serve"]
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
```
|
|
242
|
+
|
|
243
|
+
Check the Agent Panel settings to verify the server shows a green indicator.
|
|
244
|
+
|
|
245
|
+
</details>
|
|
246
|
+
|
|
247
|
+
<details>
|
|
248
|
+
<summary><strong>Goose</strong></summary>
|
|
249
|
+
|
|
250
|
+
Run `goose configure` and select **Command-line Extension**, or add directly to `~/.config/goose/config.yaml`:
|
|
251
|
+
|
|
252
|
+
```yaml
|
|
253
|
+
extensions:
|
|
254
|
+
context:
|
|
255
|
+
type: stdio
|
|
256
|
+
command: context
|
|
257
|
+
args:
|
|
258
|
+
- serve
|
|
259
|
+
timeout: 300
|
|
260
|
+
```
|
|
261
|
+
|
|
262
|
+
</details>
|
|
263
|
+
|
|
264
|
+
### 4. Start using it
|
|
265
|
+
|
|
266
|
+
That's it! Now just ask your AI agent:
|
|
267
|
+
|
|
268
|
+
> "How do I create middleware in Next.js?"
|
|
269
|
+
|
|
270
|
+
The agent automatically uses the `get_docs` tool when relevant.
|
|
271
|
+
|
|
272
|
+
---
|
|
273
|
+
|
|
274
|
+
## :books: CLI Reference
|
|
275
|
+
|
|
276
|
+
### `context add <source>`
|
|
277
|
+
|
|
278
|
+
Install a documentation package. The source type is auto-detected.
|
|
279
|
+
|
|
280
|
+
**From git repository:**
|
|
281
|
+
|
|
282
|
+
Works with GitHub, GitLab, Bitbucket, Codeberg, or any git URL:
|
|
283
|
+
|
|
284
|
+
```bash
|
|
285
|
+
# HTTPS URLs
|
|
286
|
+
context add https://github.com/vercel/next.js
|
|
287
|
+
context add https://gitlab.com/org/repo
|
|
288
|
+
context add https://bitbucket.org/org/repo
|
|
289
|
+
|
|
290
|
+
# Specific tag or branch
|
|
291
|
+
context add https://github.com/vercel/next.js/tree/v15.0.0
|
|
292
|
+
|
|
293
|
+
# SSH URLs
|
|
294
|
+
context add git@github.com:user/repo.git
|
|
295
|
+
context add ssh://git@github.com/user/repo.git
|
|
296
|
+
|
|
297
|
+
# Custom options
|
|
298
|
+
context add https://github.com/vercel/next.js --docs-path packages/docs --name nextjs
|
|
299
|
+
```
|
|
300
|
+
|
|
301
|
+
**From local directory:**
|
|
302
|
+
|
|
303
|
+
Build a package from documentation in a local folder:
|
|
304
|
+
|
|
305
|
+
```bash
|
|
306
|
+
# Auto-detects docs folder (docs/, documentation/, doc/)
|
|
307
|
+
context add ./my-project
|
|
308
|
+
|
|
309
|
+
# Specify docs path explicitly
|
|
310
|
+
context add /path/to/repo --docs-path docs
|
|
311
|
+
|
|
312
|
+
# Custom package name and version
|
|
313
|
+
context add ./my-lib --name my-library --version 1.0.0
|
|
314
|
+
```
|
|
315
|
+
|
|
316
|
+
| Option | Description |
|
|
317
|
+
|--------|-------------|
|
|
318
|
+
| `--version <version>` | Custom version label |
|
|
319
|
+
| `--docs-path <path>` | Path to docs folder in repo/directory |
|
|
320
|
+
| `--name <name>` | Custom package name |
|
|
321
|
+
| `--save <path>` | Save a copy of the package to the specified path |
|
|
322
|
+
|
|
323
|
+
**Saving packages for sharing:**
|
|
324
|
+
|
|
325
|
+
```bash
|
|
326
|
+
# Save to a directory (auto-names as name@version.db)
|
|
327
|
+
context add https://github.com/vercel/next.js --save ./packages/
|
|
328
|
+
|
|
329
|
+
# Save to a specific file
|
|
330
|
+
context add ./my-docs --save ./my-package.db
|
|
331
|
+
```
|
|
332
|
+
|
|
333
|
+
**From URL:**
|
|
334
|
+
|
|
335
|
+
```bash
|
|
336
|
+
context add https://cdn.example.com/react@18.db
|
|
337
|
+
```
|
|
338
|
+
|
|
339
|
+
**From local file:**
|
|
340
|
+
|
|
341
|
+
```bash
|
|
342
|
+
context add ./nextjs@15.0.db
|
|
343
|
+
```
|
|
344
|
+
|
|
345
|
+
**Finding the right documentation repository:**
|
|
346
|
+
|
|
347
|
+
Many popular projects keep their documentation in a separate repository from their main codebase. If you see a warning about few sections found, the docs likely live elsewhere:
|
|
348
|
+
|
|
349
|
+
```bash
|
|
350
|
+
# Example: React's docs are in a separate repo
|
|
351
|
+
context add https://github.com/facebook/react
|
|
352
|
+
# ⚠️ Warning: Only 45 sections found...
|
|
353
|
+
# The warning includes a Google search link to help find the docs repo
|
|
354
|
+
|
|
355
|
+
# The actual React docs repository:
|
|
356
|
+
context add https://github.com/reactjs/react.dev
|
|
357
|
+
```
|
|
358
|
+
|
|
359
|
+
Common patterns for documentation repositories:
|
|
360
|
+
- `project-docs` (e.g., `prisma/docs`)
|
|
361
|
+
- `project.dev` or `project.io` (e.g., `reactjs/react.dev`)
|
|
362
|
+
- `project-website` (e.g., `expressjs/expressjs.com`)
|
|
363
|
+
|
|
364
|
+
When the CLI detects few documentation sections, it will show a Google search link to help you find the correct repository.
|
|
365
|
+
|
|
366
|
+
### `context list`
|
|
367
|
+
|
|
368
|
+
Show installed packages.
|
|
369
|
+
|
|
370
|
+
```bash
|
|
371
|
+
$ context list
|
|
372
|
+
|
|
373
|
+
Installed packages:
|
|
374
|
+
|
|
375
|
+
nextjs@15.0 4.2 MB 847 sections
|
|
376
|
+
react@18 2.1 MB 423 sections
|
|
377
|
+
|
|
378
|
+
Total: 2 packages (6.3 MB)
|
|
379
|
+
```
|
|
380
|
+
|
|
381
|
+
### `context remove <name>`
|
|
382
|
+
|
|
383
|
+
Remove a package.
|
|
384
|
+
|
|
385
|
+
```bash
|
|
386
|
+
context remove nextjs
|
|
387
|
+
```
|
|
388
|
+
|
|
389
|
+
### `context serve`
|
|
390
|
+
|
|
391
|
+
Start the MCP server (used by Claude Desktop).
|
|
392
|
+
|
|
393
|
+
```bash
|
|
394
|
+
context serve
|
|
395
|
+
```
|
|
396
|
+
|
|
397
|
+
### `context query <library> <topic>`
|
|
398
|
+
|
|
399
|
+
Query documentation directly from the command line. Useful for testing and debugging.
|
|
400
|
+
|
|
401
|
+
```bash
|
|
402
|
+
# Query a package (use name@version format from 'context list')
|
|
403
|
+
context query 'nextjs@15.0' 'middleware authentication'
|
|
404
|
+
|
|
405
|
+
# Returns the same JSON format as the MCP get_docs tool
|
|
406
|
+
```
|
|
407
|
+
|
|
408
|
+
---
|
|
409
|
+
|
|
410
|
+
## :gear: How It Works
|
|
411
|
+
|
|
412
|
+
```
|
|
413
|
+
┌─────────────────────────────────────────────────────┐
|
|
414
|
+
│ Your Machine │
|
|
415
|
+
│ │
|
|
416
|
+
│ ┌──────────┐ ┌────────────┐ ┌───────────┐ │
|
|
417
|
+
│ │ Claude │────▶│ MCP Server │────▶│ ~/.context│ │
|
|
418
|
+
│ │ │ │ (get_docs) │ │ /packages│ │
|
|
419
|
+
│ └──────────┘ └────────────┘ └───────────┘ │
|
|
420
|
+
│ │ │
|
|
421
|
+
│ ▼ │
|
|
422
|
+
│ ┌────────────┐ │
|
|
423
|
+
│ │ SQLite │ │
|
|
424
|
+
│ │ FTS5 │ │
|
|
425
|
+
│ └────────────┘ │
|
|
426
|
+
└─────────────────────────────────────────────────────┘
|
|
427
|
+
```
|
|
428
|
+
|
|
429
|
+
**When you add a package:**
|
|
430
|
+
|
|
431
|
+
1. Repository is cloned (for git URLs) or read (for local directories)
|
|
432
|
+
2. Documentation is parsed and split into sections
|
|
433
|
+
3. Sections are indexed with FTS5 full-text search
|
|
434
|
+
4. The package is stored in `~/.context/packages/`
|
|
435
|
+
|
|
436
|
+
**When Claude queries:**
|
|
437
|
+
|
|
438
|
+
1. FTS5 finds relevant sections by keyword matching
|
|
439
|
+
2. Results are filtered by relevance score
|
|
440
|
+
3. Token budget ensures responses stay concise
|
|
441
|
+
4. Claude receives focused, relevant documentation
|
|
442
|
+
|
|
443
|
+
---
|
|
444
|
+
|
|
445
|
+
## :package: Package Format
|
|
446
|
+
|
|
447
|
+
Packages are SQLite databases (`.db` files) containing pre-indexed documentation.
|
|
448
|
+
|
|
449
|
+
```
|
|
450
|
+
~/.context/packages/
|
|
451
|
+
├── nextjs@15.0.db
|
|
452
|
+
├── react@18.db
|
|
453
|
+
└── typescript@5.5.db
|
|
454
|
+
```
|
|
455
|
+
|
|
456
|
+
You can:
|
|
457
|
+
- Build from any git repository (GitHub, GitLab, Bitbucket, etc.)
|
|
458
|
+
- Build from local directories
|
|
459
|
+
- Download pre-built packages from URLs
|
|
460
|
+
- Share packages via releases or any file host
|
|
461
|
+
|
|
462
|
+
---
|
|
463
|
+
|
|
464
|
+
## :wrench: Development
|
|
465
|
+
|
|
466
|
+
```bash
|
|
467
|
+
# Install dependencies
|
|
468
|
+
pnpm install
|
|
469
|
+
|
|
470
|
+
# Build
|
|
471
|
+
pnpm build
|
|
472
|
+
|
|
473
|
+
# Test
|
|
474
|
+
pnpm test
|
|
475
|
+
|
|
476
|
+
# Lint
|
|
477
|
+
pnpm lint
|
|
478
|
+
```
|
|
479
|
+
|
|
480
|
+
---
|
|
481
|
+
|
|
482
|
+
## :page_facing_up: License
|
|
483
|
+
|
|
484
|
+
[Apache-2.0](LICENSE)
|