From 99833eef28bddfc9ddfe488b5df9a66c9641dfb1 Mon Sep 17 00:00:00 2001 From: Abdusshh Date: Wed, 23 Apr 2025 00:03:09 +0300 Subject: [PATCH 1/4] chore: Update README with MCP client error solutions and fix formatting --- README.md | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 273d93a..5451421 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,5 @@ # Context7 MCP - Up-to-date Docs For Any Prompt + [![Website](https://img.shields.io/badge/Website-context7.com-blue)](https://context7.com) [![smithery badge](https://smithery.ai/badge/@upstash/context7-mcp)](https://smithery.ai/server/@upstash/context7-mcp) ## ❌ Without Context7 @@ -23,7 +24,6 @@ Create a basic Next.js project with app router. use context7 Create a script to delete the rows where the city is "" given PostgreSQL credentials. use context7 ``` - Context7 fetches up-to-date code examples and documentation right into your LLM's context. - 1️⃣ Write your prompt naturally @@ -153,7 +153,7 @@ Add this to your Claude Desktop `claude_desktop_config.json` file. See [Claude D ### Available Tools - `resolve-library-id`: Resolves a general library name into a Context7-compatible library ID. - - `libraryName` (optional): Search and rerank results + - `libraryName` (required) - `get-library-docs`: Fetches documentation for a library using a Context7-compatible library ID. - `context7CompatibleLibraryID` (required) - `topic` (optional): Focus the docs on a specific topic (e.g., "routing", "hooks") @@ -211,9 +211,17 @@ If you see this error, try using `bunx` instead of `npx`. This often resolves module resolution issues, especially in environments where `npx` does not properly install or resolve packages. +### MCP Client Errors + +1. Try removing `@latest` from the package name. + +2. Try using `bunx` as an alternative. + +3. Try using `deno` as an alternative. + ## Context7 in media -+ [Better Stack: "Free Tool Makes Cursor 10x Smarter"](https://youtu.be/52FC3qObp9E) +- [Better Stack: "Free Tool Makes Cursor 10x Smarter"](https://youtu.be/52FC3qObp9E) ## License From 1d04132816185abd4941768ee44f647309666698 Mon Sep 17 00:00:00 2001 From: Abdusshh Date: Wed, 23 Apr 2025 00:04:03 +0300 Subject: [PATCH 2/4] chore: add star history chart to README.md --- README.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/README.md b/README.md index 5451421..2508c33 100644 --- a/README.md +++ b/README.md @@ -223,6 +223,10 @@ This often resolves module resolution issues, especially in environments where ` - [Better Stack: "Free Tool Makes Cursor 10x Smarter"](https://youtu.be/52FC3qObp9E) +## Star History + +[![Star History Chart](https://api.star-history.com/svg?repos=upstash/context7&type=Date)](https://www.star-history.com/#upstash/context7&Date) + ## License MIT From 1afaa5982e0c6ccf66ccfdeb1cdb9571dc9d2f57 Mon Sep 17 00:00:00 2001 From: Abdusshh Date: Wed, 23 Apr 2025 00:11:04 +0300 Subject: [PATCH 3/4] chore: add new media links to README --- README.md | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 2508c33..837a06f 100644 --- a/README.md +++ b/README.md @@ -219,9 +219,14 @@ This often resolves module resolution issues, especially in environments where ` 3. Try using `deno` as an alternative. -## Context7 in media +## Context7 In Media - [Better Stack: "Free Tool Makes Cursor 10x Smarter"](https://youtu.be/52FC3qObp9E) +- [Cole Medin: "This is Hands Down the BEST MCP Server for AI Coding Assistants"](https://www.youtube.com/watch?v=G7gK8H6u7Rs) +- [Income stream surfers: "Context7 + SequentialThinking MCPs: Is This AGI?"](https://www.youtube.com/watch?v=-ggvzyLpK6o) +- [Julian Goldie SEO: "Context7: New MCP AI Agent Update"](https://www.youtube.com/watch?v=CTZm6fBYisc) +- [JeredBlu: "Context 7 MCP: Get Documentation Instantly + VS Code Setup"](https://www.youtube.com/watch?v=-ls0D-rtET4) +- [Income stream surfers: "Context7: The New MCP Server That Will CHANGE AI Coding"](https://www.youtube.com/watch?v=PS-2Azb-C3M) ## Star History From b199a1645ee0a69a57234fe1a9b70279c15f79b6 Mon Sep 17 00:00:00 2001 From: Abdusshh Date: Wed, 23 Apr 2025 00:18:15 +0300 Subject: [PATCH 4/4] feat: enforce minimum token limit of 5000 for library docs retrieval --- README.md | 2 +- src/index.ts | 4 +--- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 837a06f..4890a08 100644 --- a/README.md +++ b/README.md @@ -157,7 +157,7 @@ Add this to your Claude Desktop `claude_desktop_config.json` file. See [Claude D - `get-library-docs`: Fetches documentation for a library using a Context7-compatible library ID. - `context7CompatibleLibraryID` (required) - `topic` (optional): Focus the docs on a specific topic (e.g., "routing", "hooks") - - `tokens` (optional, default 5000): Max number of tokens to return + - `tokens` (optional, default 5000): Max number of tokens to return. Values less than 5000 are automatically increased to 5000. ## Development diff --git a/src/index.ts b/src/index.ts index 19d88dc..0111f5e 100644 --- a/src/index.ts +++ b/src/index.ts @@ -81,9 +81,7 @@ server.tool( .describe("Topic to focus documentation on (e.g., 'hooks', 'routing')."), tokens: z .preprocess((val) => (typeof val === "string" ? Number(val) : val), z.number()) - .refine((val) => typeof val === "number" && val >= DEFAULT_MINIMUM_TOKENS, { - message: `Must be a number >= ${DEFAULT_MINIMUM_TOKENS}`, - }) + .transform((val) => (val < DEFAULT_MINIMUM_TOKENS ? DEFAULT_MINIMUM_TOKENS : val)) .optional() .describe( `Maximum number of tokens of documentation to retrieve (default: ${DEFAULT_MINIMUM_TOKENS}). Higher values provide more context but consume more tokens.`