[PR #28] [CLOSED] fix(context7): make API key optional, fix search response parsing #28

Closed
opened 2026-02-15 18:15:12 -05:00 by yindo · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/openclaw/skills/pull/28
Author: @petter-b
Created: 2/3/2026
Status: Closed

Base: mainHead: fix/context7-optional-api-key


📝 Commits (1)

  • c73a5f0 fix(context7): make API key optional, fix search response parsing

📊 Changes

1 file changed (+17 additions, -21 deletions)

View changed files

📝 skills/thesethrose/context7/query.ts (+17 -21)

📄 Description

Summary

The Context7 REST API works without authentication. The context7 skill (by TheSethRose) previously hard-required CONTEXT7_API_KEY and exited if not set, preventing out-of-the-box usage.

Changes

  • Remove hard exit when API key is missing — key is now optional
  • Pass Authorization header only when a key is available
  • Handle actual API response shape (data.results array vs bare array)
  • Use nullish coalescing (??) for score display (so 0 isn't shown as N/A)
  • Show library ID and title in search results

Testing

Verified both search and context commands work without an API key:

npx tsx query.ts search "nextjs" "middleware"
# Returns 5 results successfully

npx tsx query.ts context "vercel/next.js" "middleware"
# Returns documentation context successfully

Also verified the upstream API accepts unauthenticated requests:

curl -s "https://context7.com/api/v2/libs/search?libraryName=nextjs&query=middleware"
# 200 OK with results

Relates to: openclaw/clawhub#114


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/openclaw/skills/pull/28 **Author:** [@petter-b](https://github.com/petter-b) **Created:** 2/3/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `fix/context7-optional-api-key` --- ### 📝 Commits (1) - [`c73a5f0`](https://github.com/openclaw/skills/commit/c73a5f03d6414a18b0b38bdda38faf30027d52a5) fix(context7): make API key optional, fix search response parsing ### 📊 Changes **1 file changed** (+17 additions, -21 deletions) <details> <summary>View changed files</summary> 📝 `skills/thesethrose/context7/query.ts` (+17 -21) </details> ### 📄 Description ## Summary The Context7 REST API works without authentication. The `context7` skill (by TheSethRose) previously hard-required `CONTEXT7_API_KEY` and exited if not set, preventing out-of-the-box usage. ## Changes - Remove hard exit when API key is missing — key is now optional - Pass `Authorization` header only when a key is available - Handle actual API response shape (`data.results` array vs bare array) - Use nullish coalescing (`??`) for score display (so `0` isn't shown as N/A) - Show library ID and title in search results ## Testing Verified both `search` and `context` commands work without an API key: ```bash npx tsx query.ts search "nextjs" "middleware" # Returns 5 results successfully npx tsx query.ts context "vercel/next.js" "middleware" # Returns documentation context successfully ``` Also verified the upstream API accepts unauthenticated requests: ```bash curl -s "https://context7.com/api/v2/libs/search?libraryName=nextjs&query=middleware" # 200 OK with results ``` Relates to: openclaw/clawhub#114 --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
yindo added the pull-request label 2026-02-15 18:15:12 -05:00
yindo closed this issue 2026-02-15 18:15:12 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: openclaw/skills#28