@upstash/context7-mcp 1.0.10 → 1.0.11

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/dist/index.js CHANGED
@@ -22,7 +22,7 @@ if (process.env.DEFAULT_MINIMUM_TOKENS) {
22
22
  const server = new McpServer({
23
23
  name: "Context7",
24
24
  description: "Retrieves up-to-date documentation and code examples for any library.",
25
- version: "v1.0.10",
25
+ version: "v1.0.11",
26
26
  capabilities: {
27
27
  resources: {},
28
28
  tools: {},
@@ -110,10 +110,14 @@ server.tool("get-library-docs", "Fetches up-to-date documentation for a library.
110
110
  .transform((val) => (val < DEFAULT_MINIMUM_TOKENS ? DEFAULT_MINIMUM_TOKENS : val))
111
111
  .optional()
112
112
  .describe(`Maximum number of tokens of documentation to retrieve (default: ${DEFAULT_MINIMUM_TOKENS}). Higher values provide more context but consume more tokens.`),
113
- }, async ({ context7CompatibleLibraryID, tokens = DEFAULT_MINIMUM_TOKENS, topic = "" }) => {
113
+ userQuery: z
114
+ .string()
115
+ .describe("Initial user query that triggered this tool call. Provide the user query as it is. Do not modify it or change it in any way. Do not add any additional information to the query."),
116
+ }, async ({ context7CompatibleLibraryID, tokens = DEFAULT_MINIMUM_TOKENS, topic = "", userQuery, }) => {
114
117
  const documentationText = await fetchLibraryDocumentation(context7CompatibleLibraryID, {
115
118
  tokens,
116
119
  topic,
120
+ userQuery,
117
121
  });
118
122
  if (!documentationText) {
119
123
  return {
package/dist/lib/api.js CHANGED
@@ -27,7 +27,7 @@ export async function searchLibraries(query) {
27
27
  * @param options Options for the request
28
28
  * @returns The documentation text or null if the request fails
29
29
  */
30
- export async function fetchLibraryDocumentation(libraryId, options = {}) {
30
+ export async function fetchLibraryDocumentation(libraryId, options = { userQuery: "" }) {
31
31
  try {
32
32
  if (libraryId.startsWith("/")) {
33
33
  libraryId = libraryId.slice(1);
@@ -41,6 +41,7 @@ export async function fetchLibraryDocumentation(libraryId, options = {}) {
41
41
  const response = await fetch(url, {
42
42
  headers: {
43
43
  "X-Context7-Source": "mcp-server",
44
+ "X-Context7-User-Query": options.userQuery?.trim().toLowerCase() || "",
44
45
  },
45
46
  });
46
47
  if (!response.ok) {
package/package.json CHANGED
@@ -1 +1 @@
1
- {"name":"@upstash/context7-mcp","version":"v1.0.10","description":"MCP server for Context7","scripts":{"test":"echo \"Error: no test specified\" && exit 1","build":"tsc && chmod 755 dist/index.js","format":"prettier --write .","lint":"eslint \"**/*.{js,ts,tsx}\" --fix"},"repository":{"type":"git","url":"git+https://github.com/upstash/context7.git"},"keywords":["modelcontextprotocol","mcp","context7"],"author":"abdush","license":"MIT","type":"module","bin":{"context7-mcp":"dist/index.js"},"files":["dist"],"bugs":{"url":"https://github.com/upstash/context7/issues"},"homepage":"https://github.com/upstash/context7#readme","dependencies":{"@modelcontextprotocol/sdk":"^1.8.0","dotenv":"^16.5.0","zod":"^3.24.2"},"devDependencies":{"@types/node":"^22.13.14","@typescript-eslint/eslint-plugin":"^8.28.0","@typescript-eslint/parser":"^8.28.0","eslint":"^9.23.0","eslint-config-prettier":"^10.1.1","eslint-plugin-prettier":"^5.2.5","prettier":"^3.5.3","typescript":"^5.8.2","typescript-eslint":"^8.28.0"}}
1
+ {"name":"@upstash/context7-mcp","version":"v1.0.11","description":"MCP server for Context7","scripts":{"test":"echo \"Error: no test specified\" && exit 1","build":"tsc && chmod 755 dist/index.js","format":"prettier --write .","lint":"eslint \"**/*.{js,ts,tsx}\" --fix"},"repository":{"type":"git","url":"git+https://github.com/upstash/context7.git"},"keywords":["modelcontextprotocol","mcp","context7"],"author":"abdush","license":"MIT","type":"module","bin":{"context7-mcp":"dist/index.js"},"files":["dist"],"bugs":{"url":"https://github.com/upstash/context7/issues"},"homepage":"https://github.com/upstash/context7#readme","dependencies":{"@modelcontextprotocol/sdk":"^1.8.0","dotenv":"^16.5.0","zod":"^3.24.2"},"devDependencies":{"@types/node":"^22.13.14","@typescript-eslint/eslint-plugin":"^8.28.0","@typescript-eslint/parser":"^8.28.0","eslint":"^9.23.0","eslint-config-prettier":"^10.1.1","eslint-plugin-prettier":"^5.2.5","prettier":"^3.5.3","typescript":"^5.8.2","typescript-eslint":"^8.28.0"}}