@upstash/context7-mcp 0.0.1 → 1.0.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/README.md +13 -0
- package/build/index.js +2 -2
- package/build/lib/api.js +16 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -70,6 +70,19 @@ npm run lint
|
|
|
70
70
|
npm run build
|
|
71
71
|
```
|
|
72
72
|
|
|
73
|
+
### Local Configuration
|
|
74
|
+
|
|
75
|
+
```json
|
|
76
|
+
{
|
|
77
|
+
"mcpServers": {
|
|
78
|
+
"context7": {
|
|
79
|
+
"command": "node",
|
|
80
|
+
"args": ["/ABSOLUTE/PATH/TO/PARENT/FOLDER/context7-mcp/build/index.js"]
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
```
|
|
85
|
+
|
|
73
86
|
### Testing with MCP Inspector
|
|
74
87
|
|
|
75
88
|
You can also use the MCP Inspector to test the tools by following the MCP documentation for setting up the inspector.
|
package/build/index.js
CHANGED
|
@@ -61,7 +61,7 @@ server.tool("list-available-docs", "Lists all available library documentation fr
|
|
|
61
61
|
server.tool("get-library-documentation", "Retrieves documentation for a specific library from Context7. Use 'list-available-docs' first to see what's available.", {
|
|
62
62
|
libraryName: z
|
|
63
63
|
.string()
|
|
64
|
-
.describe("Name of the library to retrieve documentation for (e.g., '
|
|
64
|
+
.describe("Name of the library to retrieve documentation for (e.g., 'mongodb/docs', 'vercel/nextjs'). Must match exactly a library name from 'list-available-docs'."),
|
|
65
65
|
topic: z
|
|
66
66
|
.string()
|
|
67
67
|
.optional()
|
|
@@ -70,7 +70,7 @@ server.tool("get-library-documentation", "Retrieves documentation for a specific
|
|
|
70
70
|
.number()
|
|
71
71
|
.min(5000)
|
|
72
72
|
.optional()
|
|
73
|
-
.describe("Maximum number of tokens of documentation to retrieve (default: 5000).Higher values provide more comprehensive documentation but use more context window."),
|
|
73
|
+
.describe("Maximum number of tokens of documentation to retrieve (default: 5000). Higher values provide more comprehensive documentation but use more context window."),
|
|
74
74
|
}, async ({ libraryName, tokens = 5000, topic = "" }) => {
|
|
75
75
|
const documentationText = await fetchLibraryDocumentation(libraryName, tokens, topic);
|
|
76
76
|
if (!documentationText) {
|
package/build/lib/api.js
CHANGED
|
@@ -26,8 +26,23 @@ export async function fetchProjects() {
|
|
|
26
26
|
*/
|
|
27
27
|
export async function fetchLibraryDocumentation(libraryName, tokens = 5000, topic = "") {
|
|
28
28
|
try {
|
|
29
|
-
|
|
29
|
+
// if libraryName has a "/" as the first character, remove it
|
|
30
|
+
if (libraryName.startsWith("/")) {
|
|
31
|
+
libraryName = libraryName.slice(1);
|
|
32
|
+
}
|
|
33
|
+
// Handle folders parameter
|
|
34
|
+
let basePath = libraryName;
|
|
35
|
+
let folders = "";
|
|
36
|
+
if (libraryName.includes("?folders=")) {
|
|
37
|
+
const [path, foldersParam] = libraryName.split("?folders=");
|
|
38
|
+
basePath = path;
|
|
39
|
+
folders = foldersParam;
|
|
40
|
+
}
|
|
41
|
+
let contextURL = `${CONTEXT7_BASE_URL}/${basePath}/llms.txt`;
|
|
30
42
|
const params = [];
|
|
43
|
+
if (folders) {
|
|
44
|
+
params.push(`folders=${encodeURIComponent(folders)}`);
|
|
45
|
+
}
|
|
31
46
|
if (tokens) {
|
|
32
47
|
params.push(`tokens=${tokens}`);
|
|
33
48
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@upstash/context7-mcp",
|
|
3
|
-
"version": "0.0
|
|
3
|
+
"version": "1.0.0",
|
|
4
4
|
"description": "MCP server for Context7",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"test": "echo \"Error: no test specified\" && exit 1",
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
"license": "MIT",
|
|
18
18
|
"type": "module",
|
|
19
19
|
"bin": {
|
|
20
|
-
"context7-mcp": "
|
|
20
|
+
"context7-mcp": "build/index.js"
|
|
21
21
|
},
|
|
22
22
|
"files": [
|
|
23
23
|
"build"
|