@upstash/context7-mcp 1.0.1 → 1.0.3

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 CHANGED
@@ -14,16 +14,16 @@ Context7 MCP pulls up-to-date, version-specific documentation and code examples
14
14
 
15
15
  Add `use context7` to your question in Cursor:
16
16
 
17
- ```
18
- "How do I use the new Next.js `after` function? use context7"
17
+ ```txt
18
+ How do I use the new Next.js `after` function? use context7
19
19
  ```
20
20
 
21
- ```
22
- "How do I invalidate a query in React Query? use context7"
21
+ ```txt
22
+ How do I invalidate a query in React Query? use context7
23
23
  ```
24
24
 
25
- ```
26
- "How do I protect a route with NextAuth? use context7"
25
+ ```txt
26
+ How do I protect a route with NextAuth? use context7
27
27
  ```
28
28
 
29
29
  Context7 fetches up-to-date documentation and working code examples right into your LLM’s context.
@@ -45,7 +45,7 @@ No tab-switching, no hallucinated APIs that don't exist, no outdated code genera
45
45
 
46
46
  Go to: `Settings` -> `Cursor Settings` -> `MCP` -> `Add new global MCP server`
47
47
 
48
- Paste this into your Cursor `~/.cursor/mcp.json` file. See [Cursor MCP docs](https://docs.cursor.com/context/model-context-protocol) for more info.
48
+ Paste this into your Cursor `~/.cursor/mcp.json` file. See [Cursor MCP docs](https://docs.cursor.com/context/model-context-protocol) for more info.
49
49
 
50
50
  ```json
51
51
  {
@@ -75,7 +75,7 @@ Add this to your Windsurf MCP config file. See [Windsurf MCP docs](https://docs.
75
75
 
76
76
  ### Available Tools
77
77
 
78
- - `resolve-library-id`: Resolves a general npm package name into a Context7-compatible library ID.
78
+ - `resolve-library-id`: Resolves a general library name into a Context7-compatible library ID.
79
79
  - `libraryName` (optional): Search and rerank results
80
80
  - `get-library-docs`: Fetches documentation for a library using a Context7-compatible library ID.
81
81
  - `context7CompatibleLibraryID` (required)
package/dist/index.js CHANGED
@@ -7,7 +7,7 @@ import { formatProjectsList, rerankProjects } from "./lib/utils.js";
7
7
  // Create server instance
8
8
  const server = new McpServer({
9
9
  name: "Context7",
10
- description: "Retrieves up-to-date documentation and code examples for npm packages.",
10
+ description: "Retrieves up-to-date documentation and code examples for any library.",
11
11
  version: "1.0.0",
12
12
  capabilities: {
13
13
  resources: {},
package/dist/lib/api.js CHANGED
@@ -5,7 +5,7 @@ const CONTEXT7_BASE_URL = "https://context7.com";
5
5
  */
6
6
  export async function fetchProjects() {
7
7
  try {
8
- const response = await fetch(`${CONTEXT7_BASE_URL}/api/projects`);
8
+ const response = await fetch(`${CONTEXT7_BASE_URL}/api/libraries`);
9
9
  if (!response.ok) {
10
10
  console.error(`Failed to fetch projects: ${response.status}`);
11
11
  return null;
@@ -38,21 +38,18 @@ export async function fetchLibraryDocumentation(libraryName, tokens = 5000, topi
38
38
  basePath = path;
39
39
  folders = foldersParam;
40
40
  }
41
- let contextURL = `${CONTEXT7_BASE_URL}/${basePath}/llms.txt`;
42
- const params = [];
43
- if (folders) {
44
- params.push(`folders=${encodeURIComponent(folders)}`);
45
- }
46
- if (tokens) {
47
- params.push(`tokens=${tokens}`);
48
- }
49
- if (topic) {
50
- params.push(`topic=${encodeURIComponent(topic)}`);
51
- }
52
- if (params.length > 0) {
53
- contextURL += `?${params.join("&")}`;
54
- }
55
- const response = await fetch(contextURL);
41
+ const contextURL = new URL(`${CONTEXT7_BASE_URL}/${basePath}/llms.txt`);
42
+ if (folders)
43
+ contextURL.searchParams.set("folders", folders);
44
+ if (tokens)
45
+ contextURL.searchParams.set("tokens", tokens.toString());
46
+ if (topic)
47
+ contextURL.searchParams.set("topic", topic);
48
+ const response = await fetch(contextURL, {
49
+ headers: {
50
+ "X-Context7-Source": "mcp-server",
51
+ },
52
+ });
56
53
  if (!response.ok) {
57
54
  console.error(`Failed to fetch documentation: ${response.status}`);
58
55
  return null;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@upstash/context7-mcp",
3
- "version": "1.0.1",
3
+ "version": "1.0.3",
4
4
  "description": "MCP server for Context7",
5
5
  "scripts": {
6
6
  "test": "echo \"Error: no test specified\" && exit 1",