Better Context7 Output Quality with Code Scoring
Blog post from Upstash
Context7 is an MCP server designed to enhance the reliability of code generated by Language Learning Models (LLMs) such as Cursor and Windsurf by providing access to a repository of documentation. To combat issues with LLMs producing outdated or incorrect code, Context7 utilizes a library called c7score, which measures the quality of documentation snippets by evaluating their relevance, clarity, and correctness. Initial approaches focused on comparing snippets with their original Github sources, but these were limited in scope and accuracy. The current methodology involves using Gemini's Google Search tool to source documentation from a variety of websites, coupled with a dual LLM-based evaluation to assess syntax, clarity, and information uniqueness. c7score is integrated with Context7 but can also be used independently via npm, offering customizable metrics and methods for evaluating or comparing library documentation. This system ensures that LLMs are guided by high-quality, reliable context, thereby improving the quality of the code they generate.