Skip to content

feat: add Context7 MCP server and agent skill - #194

Merged
alehar9320 merged 8 commits into
mainfrom
feat/add-context7-mcp-14185377194801000755
May 21, 2026
Merged

alehar9320 merged 8 commits into
mainfrom
feat/add-context7-mcp-14185377194801000755

Conversation

@alehar9320

@alehar9320 alehar9320 commented May 19, 2026 •

Copy link
Copy Markdown
Owner

This PR adds the Context7 Model Context Protocol (MCP) server to the repository. Context7 provides up-to-date, version-specific documentation and code examples for various libraries and APIs.

Changes:

  • Added context7 MCP server configuration to mcp_config.json.
  • Added detailed setup instructions for Context7 in docs/mcp.md.
  • Created a new AI agent skill for Context7 in .agents/skills/context7/SKILL.md to guide AI agents on how to use the server effectively.
  • Updated AGENTS.md to include Context7 in the list of available MCP servers and skills.

Verified with npm run format, npm run lint, npm run check, and npm run test.


PR created automatically by Jules for task 14185377194801000755 started by @alehar9320

Summary by CodeRabbit

  • New Features

    • Added Context7 skill for retrieving up-to-date, version-specific documentation and code examples via natural-language queries and library IDs.
  • Documentation

    • Added setup and configuration instructions for Context7 MCP server, including automated CLI workflow.
  • Improvements

    • Enhanced chat API error handling with appropriate status codes for missing dependencies and added security headers to chat responses.

Review Change Stack

@google-labs-jules

Copy link
Copy Markdown
Contributor

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

@qodo-code-review

Copy link
Copy Markdown

Qodo reviews are paused for this user.

Troubleshooting steps vary by plan Learn more →

On a Teams plan?
Reviews resume once this user has a paid seat and their Git account is linked in Qodo.
Link Git account →

Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center?
These require an Enterprise plan - Contact us
Contact us →

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented May 19, 2026 •

Copy link
Copy Markdown
Contributor

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
me a466438 Commit Preview URL

Branch Preview URL
May 21 2026, 06:31 PM

@codecov

codecov Bot commented May 19, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ All tests successful. No failed tests found.

📢 Thoughts on this report? Let us know!

@codecov

codecov Bot commented May 19, 2026 •

Copy link
Copy Markdown

Bundle Report

Bundle size has no change ✅

Affected Assets, Files, and Routes:

view changes for bundle: molecular-mars-esm

Assets Changed:

Asset Name Size Change Total Size Change (%)
_astro/page.bLO68Z6z.js (New) 264.73kB 264.73kB 100.0% 🚀
_astro/PostHog.astro_astro_type_script_index_0_lang.CR8rrn6X.js (New) 188.58kB 188.58kB 100.0% 🚀
_astro/github-releases.DPdvvvxz.js (New) 63.1kB 63.1kB 100.0% 🚀
_astro/whats-new.astro_astro_type_script_index_0_lang.DXVgINle.js (New) 2.85kB 2.85kB 100.0% 🚀
_astro/Footer.astro_astro_type_script_index_0_lang.BGpkrFXl.js (New) 718 bytes 718 bytes 100.0% 🚀
_astro/page.BjHlUFBB.js (Deleted) -264.73kB 0 bytes -100.0% 🗑️
_astro/PostHog.astro_astro_type_script_index_0_lang.BHpblTFJ.js (Deleted) -188.58kB 0 bytes -100.0% 🗑️
_astro/github-releases.BNujVhKr.js (Deleted) -63.1kB 0 bytes -100.0% 🗑️
_astro/whats-new.astro_astro_type_script_index_0_lang.pbyaYvw8.js (Deleted) -2.85kB 0 bytes -100.0% 🗑️
_astro/Footer.astro_astro_type_script_index_0_lang.CFRAAYXa.js (Deleted) -718 bytes 0 bytes -100.0% 🗑️

@coderabbitai

coderabbitai Bot commented May 19, 2026 •

Copy link
Copy Markdown

Warning

Rate limit exceeded

@alehar9320 has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 40 minutes and 9 seconds before requesting another review.

You’ve run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 2ed887e8-6faa-473f-8e59-364156060434

📥 Commits

Reviewing files that changed from the base of the PR and between 92e5df9 and a466438.

📒 Files selected for processing (6)
  • .agents/skills/context7/SKILL.md
  • AGENTS.md
  • docs/mcp.md
  • mcp_config.json
  • src/__tests__/chat-api.test.ts
  • src/pages/api/chat.ts
📝 Walkthrough

Walkthrough

This PR adds Context7 MCP server integration to the agent skills documentation and configuration, then refactors the chat API handler to access Cloudflare Worker bindings through the request context instead of direct imports, updates missing-binding error responses from 500 to 503, and refactors tests to use per-test environment injection.

Changes

Context7 MCP Server Integration

Layer / File(s) Summary
Context7 skill documentation and agent listing
.agents/skills/context7/SKILL.md, AGENTS.md
Introduces the Context7 skill with its purpose, usage workflow (library IDs, queries, ID resolution, and agent rules), and example prompts; adds context7 to the documented MCP server list and registers the skill in the agent skills section.
Context7 configuration and setup documentation
mcp_config.json, docs/mcp.md
Registers context7 as a new MCP server with endpoint and API key header configuration; documents editor-specific setup for Cursor and Claude Desktop, and provides automated CLI setup workflow instructions.

Chat API Handler Binding Refactoring

Layer / File(s) Summary
POST handler signature and binding access update
src/pages/api/chat.ts
Changes the POST route handler signature to accept full context instead of destructured request, removes the direct cloudflare:workers import, updates AI and KV binding access to read from context.locals.runtime.env via type assertion, changes missing-AI error response from 500 to 503, and adds Cache-Control: no-store and X-Content-Type-Options: nosniff headers to the SSE stream response.
Test context and environment injection helpers
src/__tests__/chat-api.test.ts (helpers section)
Refactors test setup to replace the shared mutable mockEnv with per-test environment injection; updates createContext to accept and store a runtimeEnv parameter under locals.runtime.env; updates postChat helper to inject { AI: ai, CHAT_STORE: undefined } directly into the context; adjusts the AI mock typing from vi.fn<() => Env>() to vi.fn<() => Promise<ReadableStream>>().
Error scenario and rate-limiting test updates
src/__tests__/chat-api.test.ts (test cases)
Expands error handling coverage with three distinct 503 scenarios (missing AI binding, missing locals.runtime, missing locals.runtime.env), each asserting the exact JSON error message; updates the invalid JSON test to use the new env-injection path; updates all rate-limiting tests (exceeded, increment counter, counter initialization) to pass environment via createContext instead of global mutation; adjusts AI failure mock cases to use the new typed vi.fn with proper rejection shapes.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main changes: adding Context7 MCP server integration and agent skill, which aligns with all file modifications across configuration, documentation, and skill definitions.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/add-context7-mcp-14185377194801000755

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

google-labs-jules Bot and others added 5 commits May 20, 2026 21:19
- Update mcp_config.json with Context7 server details
- Add Context7 setup instructions to docs/mcp.md
- Create new agent skill for Context7 documentation retrieval
- Update AGENTS.md with Context7 server and skill reference

Co-authored-by: alehar9320 <5390430+alehar9320@users.noreply.github.com>
Co-authored-by: alehar9320 <5390430+alehar9320@users.noreply.github.com>
- Add test case for missing runtime/env fallback in chat API
- Ensure 100% coverage for src/pages/api/chat.ts

Co-authored-by: alehar9320 <5390430+alehar9320@users.noreply.github.com>
- Add Context7 MCP server configuration and agent skill
- Update docs/mcp.md with setup instructions
- Fix Render build failure by using locals.runtime.env for Cloudflare bindings
- Improve chat API test coverage and fix merge conflicts

Co-authored-by: alehar9320 <5390430+alehar9320@users.noreply.github.com>
- Integrate Context7 MCP server and agent skill
- Update documentation with Context7 setup instructions
- Fix Render build failure by removing direct 'cloudflare:workers' import
- Improve chat API test coverage for binding resolution logic
- Resolve merge conflicts with latest main branch

Co-authored-by: alehar9320 <5390430+alehar9320@users.noreply.github.com>
- Fixes linting error (no-unused-vars) in src/__tests__/chat-api.test.ts
- Ensures CI quality checks pass

Co-authored-by: alehar9320 <5390430+alehar9320@users.noreply.github.com>
- Add beforeEach hook to reset mockEnv state between tests
- Replace runtime env parameter with shared mockEnv object for better test isolation
- Update AI binding mock to use proper Env type signature
- Change missing AI binding error status from 503 to 500
- Simplify test context creation by removing runtimeEnv parameter
- Add comments explaining process.env fallback test behavior
- Integrate Context7 MCP server and agent skill
- Update documentation with Context7 setup instructions
- Fix Render build failure by removing direct 'cloudflare:workers' import
- Improve chat API test coverage for binding resolution logic
- Resolve linting and type errors in tests

Co-authored-by: alehar9320 <5390430+alehar9320@users.noreply.github.com>
@alehar9320
alehar9320 temporarily deployed to feat/add-context7-mcp-14185377194801000755 - astro-cloudflare-personal-website-web-service PR #194 May 21, 2026 18:30 — with Render Destroyed
@mergify mergify Bot added the size/L label May 21, 2026
@alehar9320
alehar9320 merged commit f1b7503 into main May 21, 2026
14 checks passed

This branch was successfully deployed

No deployments
feat/add-context7-mcp-14185377194801000755 - astro-cloudflare-personal-website-web-service PR #194 — a4664381 Deployed May 21, 2026 by alehar9320
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant