context7 skill: API key should be optional #53

Closed
opened 2026-02-15 17:15:23 -05:00 by yindo · 1 comment
Owner

Originally created by @petter-b on GitHub (Feb 3, 2026).

Summary

The context7 skill (by TheSethRose, v1.0.3) hard-requires a CONTEXT7_API_KEY and exits if it's not set. However, the upstream Context7 API works fine without an API key.

Problem

In query.ts:

if (!API_KEY) {
  console.error("Error: CONTEXT7_API_KEY not found");
  console.error("Set it in environment or in .env file in this directory");
  process.exit(1);
}

This prevents the skill from being used out of the box.

Additionally, the search response handling doesn't account for the actual API response shape — results are nested under a results key (data.results), not returned as a bare array.

Suggested Fix

  1. Make the API key check optional (use it if present, skip if not)
  2. Pass the Authorization header only when a key is available
  3. Handle both data.results (actual API shape) and bare array responses in search

Tested

Verified the Context7 REST API works without authentication:

curl -s "https://context7.com/api/v2/libs/search?libraryName=nextjs&query=middleware"
# Returns results successfully with no auth header

Environment

  • ClawHub CLI v0.5.0
  • context7 skill v1.0.3
Originally created by @petter-b on GitHub (Feb 3, 2026). ## Summary The `context7` skill (by TheSethRose, v1.0.3) hard-requires a `CONTEXT7_API_KEY` and exits if it's not set. However, the upstream Context7 API works fine without an API key. ## Problem In `query.ts`: ```typescript if (!API_KEY) { console.error("Error: CONTEXT7_API_KEY not found"); console.error("Set it in environment or in .env file in this directory"); process.exit(1); } ``` This prevents the skill from being used out of the box. Additionally, the search response handling doesn't account for the actual API response shape — results are nested under a `results` key (`data.results`), not returned as a bare array. ## Suggested Fix 1. Make the API key check optional (use it if present, skip if not) 2. Pass the `Authorization` header only when a key is available 3. Handle both `data.results` (actual API shape) and bare array responses in search ## Tested Verified the Context7 REST API works without authentication: ``` curl -s "https://context7.com/api/v2/libs/search?libraryName=nextjs&query=middleware" # Returns results successfully with no auth header ``` ## Environment - ClawHub CLI v0.5.0 - context7 skill v1.0.3
yindo closed this issue 2026-02-15 17:15:23 -05:00
Author
Owner

@petter-b commented on GitHub (Feb 3, 2026):

Closing in favor of openclaw/skills#28 which contains the fix.

@petter-b commented on GitHub (Feb 3, 2026): Closing in favor of [openclaw/skills#28](https://github.com/openclaw/skills/pull/28) which contains the fix.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: openclaw/clawhub#53