{"_id":"@corsenai/corsen-context-nextjs","_rev":"4-0fe9cb7467664b96714588051c8ab483","name":"@corsenai/corsen-context-nextjs","dist-tags":{"latest":"2.0.1"},"versions":{"1.2.0":{"name":"@corsenai/corsen-context-nextjs","version":"1.2.0","keywords":["mcp","llms-txt","nextjs","ai","corsen"],"author":{"name":"Corsen AI","email":"contact@corsen.ai"},"license":"MIT","_id":"@corsenai/corsen-context-nextjs@1.2.0","maintainers":[{"name":"corsenai","email":"mordehai.attia@corsen.ai"}],"homepage":"https://github.com/CorsenAI/corsen-context","bugs":{"url":"https://github.com/CorsenAI/corsen-context/issues"},"dist":{"shasum":"39d1d821f42dfd20b28fe65fbffe97827aaee4ad","tarball":"https://registry.npmjs.org/@corsenai/corsen-context-nextjs/-/corsen-context-nextjs-1.2.0.tgz","fileCount":7,"integrity":"sha512-yRmwYBR822obaix/34cB4EIbrN8r9ok9TMNUjATCXdQHIcCq+dt5NbdNvBR0CnTs8ON32Kb+r26mZiLx3RA5FA==","signatures":[{"sig":"MEYCIQCJ5+srj6fnhby3WxoOpDiRj1g+Vk7Oqu13izczGT/l+AIhALXnTFuAyefrLyq08QQ/fZlltxNXtY59zW5qce283mIF","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":30522},"main":"./dist/index.js","_from":"file:corsenai-corsen-context-nextjs-1.2.0.tgz","types":"./dist/index.d.ts","module":"./dist/index.mjs","engines":{"node":">=18.0.0"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.mjs","require":"./dist/index.js"}},"scripts":{"test":"vitest run","build":"tsup src/index.ts --format cjs,esm --dts --clean","clean":"rm -rf dist","typecheck":"tsc --noEmit"},"_npmUser":{"name":"corsenai","email":"mordehai.attia@corsen.ai"},"_resolved":"C:\\Users\\RTX6000\\AppData\\Local\\Temp\\claude\\C--Users-RTX6000-projects-corsen-context\\d6c21ee7-40cc-449c-8035-09b87447b4ef\\scratchpad\\tgz\\corsenai-corsen-context-nextjs-1.2.0.tgz","_integrity":"sha512-yRmwYBR822obaix/34cB4EIbrN8r9ok9TMNUjATCXdQHIcCq+dt5NbdNvBR0CnTs8ON32Kb+r26mZiLx3RA5FA==","repository":{"url":"git+https://github.com/CorsenAI/corsen-context.git","type":"git","directory":"packages/nextjs-adapter"},"_npmVersion":"11.18.0","description":"Next.js adapter for Corsen Context — AI Context Layer with MCP + llms.txt","directories":{},"sideEffects":false,"_nodeVersion":"24.12.0","dependencies":{"@corsenai/corsen-context":"1.2.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"next":"^15.0.0","tsup":"^8.3.0","vitest":"^2.1.0","typescript":"^5.7.0","@types/node":"^22.0.0"},"peerDependencies":{"next":">=13.0.0"},"_npmOperationalInternal":{"tmp":"tmp/corsen-context-nextjs_1.2.0_1783991406536_0.18991168776368217","host":"s3://npm-registry-packages-npm-production"}},"1.3.0":{"name":"@corsenai/corsen-context-nextjs","version":"1.3.0","keywords":["mcp","llms-txt","nextjs","ai","corsen"],"author":{"name":"Corsen AI","email":"contact@corsen.ai"},"license":"MIT","_id":"@corsenai/corsen-context-nextjs@1.3.0","maintainers":[{"name":"corsenai","email":"mordehai.attia@corsen.ai"}],"homepage":"https://github.com/CorsenAI/corsen-context","bugs":{"url":"https://github.com/CorsenAI/corsen-context/issues"},"dist":{"shasum":"8a82037c463fcb40efbc122eb48e399e1a4e3823","tarball":"https://registry.npmjs.org/@corsenai/corsen-context-nextjs/-/corsen-context-nextjs-1.3.0.tgz","fileCount":7,"integrity":"sha512-GX59nTFA3xtzIdbxPBc2hS2hqvmE0uLY39zvxKgHL6NI/3xJEAMeQ30IgowvTKIRRGla3SjRGxBhSNxnqI71rQ==","signatures":[{"sig":"MEUCIFvbFmol+4f5GD4K0VfUZiMabNiXkhcE5erQ23xori1dAiEAzs307vxwfuUtdz3CmRCw3JG9t+QSsEylnSpI60q/X7w=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":33025},"main":"./dist/index.js","_from":"file:corsenai-corsen-context-nextjs-1.3.0.tgz","types":"./dist/index.d.ts","module":"./dist/index.mjs","engines":{"node":">=18.0.0"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.mjs","require":"./dist/index.js"}},"scripts":{"test":"vitest run","build":"tsup src/index.ts --format cjs,esm --dts --clean","clean":"rm -rf dist","typecheck":"tsc --noEmit"},"_npmUser":{"name":"corsenai","email":"mordehai.attia@corsen.ai"},"_resolved":"/tmp/f84c001c65496e6c27aa09fdc9283f1d/corsenai-corsen-context-nextjs-1.3.0.tgz","_integrity":"sha512-GX59nTFA3xtzIdbxPBc2hS2hqvmE0uLY39zvxKgHL6NI/3xJEAMeQ30IgowvTKIRRGla3SjRGxBhSNxnqI71rQ==","repository":{"url":"git+https://github.com/CorsenAI/corsen-context.git","type":"git","directory":"packages/nextjs-adapter"},"_npmVersion":"11.17.0","description":"Next.js adapter for Corsen Context — AI Context Layer with MCP + llms.txt","directories":{},"sideEffects":false,"_nodeVersion":"24.19.0","dependencies":{"@corsenai/corsen-context":"1.3.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"next":"^15.0.0","tsup":"^8.3.0","vitest":"^2.1.0","typescript":"^5.7.0","@types/node":"^22.0.0"},"peerDependencies":{"next":">=13.0.0"},"_npmOperationalInternal":{"tmp":"tmp/corsen-context-nextjs_1.3.0_1788093402718_0.20338248305347695","host":"s3://npm-registry-packages-npm-production"}},"2.0.0":{"name":"@corsenai/corsen-context-nextjs","version":"2.0.0","keywords":["mcp","llms-txt","nextjs","ai","corsen"],"author":{"name":"Corsen AI","email":"contact@corsen.ai"},"license":"MIT","_id":"@corsenai/corsen-context-nextjs@2.0.0","maintainers":[{"name":"corsenai","email":"mordehai.attia@corsen.ai"}],"homepage":"https://github.com/CorsenAI/corsen-context","bugs":{"url":"https://github.com/CorsenAI/corsen-context/issues"},"dist":{"shasum":"e5055b4d8e236c63dc7be9ce25262724d1c3d79b","tarball":"https://registry.npmjs.org/@corsenai/corsen-context-nextjs/-/corsen-context-nextjs-2.0.0.tgz","fileCount":7,"integrity":"sha512-VXt9ehDhaZihnCRjLVRNPv3i6fryrPRk/XHGF4pGdwaEF3g1oX7EsvjJgYrlbEbphIPsTnxn4Ic6Mosrp0BOVg==","signatures":[{"sig":"MEQCIEiRLfQogMZuwvPdMHbCO0O+Shn+i8HKQ7nE6/OvJdr1AiAIZuatmifHGRP52BfxWn/iChmv9BjGpisswT7mJRDetg==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":45655},"main":"./dist/index.js","_from":"file:corsenai-corsen-context-nextjs-2.0.0.tgz","types":"./dist/index.d.ts","module":"./dist/index.mjs","engines":{"node":">=22.12.0"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.mjs","require":"./dist/index.js"}},"scripts":{"test":"vitest run","build":"tsup src/index.ts --format cjs,esm --dts --clean","clean":"rm -rf dist","typecheck":"tsc --noEmit"},"_npmUser":{"name":"corsenai","email":"mordehai.attia@corsen.ai"},"_resolved":"C:\\Users\\RTX6000\\projects\\wordpressplugins\\corsen-context\\packages\\nextjs-adapter\\corsenai-corsen-context-nextjs-2.0.0.tgz","_integrity":"sha512-VXt9ehDhaZihnCRjLVRNPv3i6fryrPRk/XHGF4pGdwaEF3g1oX7EsvjJgYrlbEbphIPsTnxn4Ic6Mosrp0BOVg==","repository":{"url":"git+https://github.com/CorsenAI/corsen-context.git","type":"git","directory":"packages/nextjs-adapter"},"_npmVersion":"11.18.0","description":"Next.js adapter for owner-controlled MCP, WebMCP, llms.txt, and sitemap surfaces","directories":{},"sideEffects":false,"_nodeVersion":"24.12.0","dependencies":{"@corsenai/corsen-context":"2.0.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"next":"^16.3.3","tsup":"^8.5.1","vite":"^8.2.2","vitest":"^4.1.11","typescript":"^5.9.3","@types/node":"^22.0.0","@upstash/redis":"^1.38.3"},"peerDependencies":{"next":">=13.0.0"},"_npmOperationalInternal":{"tmp":"tmp/corsen-context-nextjs_2.0.0_1788120436856_0.8423188340363936","host":"s3://npm-registry-packages-npm-production"}},"2.0.1":{"name":"@corsenai/corsen-context-nextjs","version":"2.0.1","description":"Next.js adapter for owner-controlled MCP, WebMCP, llms.txt, and sitemap surfaces","author":"Corsen AI <contact@corsen.ai>","license":"MIT","homepage":"https://github.com/CorsenAI/corsen-context","repository":{"type":"git","url":"https://github.com/CorsenAI/corsen-context.git","directory":"packages/nextjs-adapter"},"keywords":["mcp","llms-txt","nextjs","ai","corsen"],"main":"./dist/index.js","module":"./dist/index.mjs","types":"./dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.mjs","require":"./dist/index.js"}},"dependencies":{"@corsenai/corsen-context":"2.0.1"},"peerDependencies":{"next":">=13.0.0"},"devDependencies":{"@upstash/redis":"^1.38.3","@types/node":"^22.0.0","next":"^16.3.3","tsup":"^8.5.1","typescript":"^5.9.3","vite":"^8.2.2","vitest":"^4.1.11"},"publishConfig":{"access":"public"},"bugs":{"url":"https://github.com/CorsenAI/corsen-context/issues"},"sideEffects":false,"engines":{"node":">=22.12.0"},"scripts":{"build":"tsup src/index.ts --format cjs,esm --dts --clean","test":"vitest run","typecheck":"tsc --noEmit","clean":"rm -rf dist"},"_nodeVersion":"24.19.0","_id":"@corsenai/corsen-context-nextjs@2.0.1","dist":{"integrity":"sha512-5N/8Xyg1BrjSEc9CaTHSRMSDGurwdDdrpYnfYB3tS9A2zbe5aRWrY+PG/ZiHAuTuU4fAWMxPTPgQgj6Tniwj9w==","shasum":"4513f39430cf088845d364966c3be784e4913a6f","tarball":"https://registry.npmjs.org/@corsenai/corsen-context-nextjs/-/corsen-context-nextjs-2.0.1.tgz","fileCount":7,"unpackedSize":45634,"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@corsenai%2fcorsen-context-nextjs@2.0.1","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIQCnV2+lO1cjubn7Vy8PZzcikF4mUkMZwoKEUW/XS112VwIgMMQO7vSeKkphrFzI/jfXKqUDMnwiBx2Gc9vJPqEixpI="}]},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:7a306146-cfe0-4338-91c9-753893412c1f"}},"directories":{},"maintainers":[{"name":"corsenai","email":"mordehai.attia@corsen.ai"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/corsen-context-nextjs_2.0.1_1788360549798_0.6431647516798042"},"_hasShrinkwrap":false}},"time":{"created":"2026-07-14T01:10:06.376Z","modified":"2026-09-02T14:49:10.386Z","1.2.0":"2026-07-14T01:10:06.685Z","1.3.0":"2026-08-30T12:36:42.852Z","2.0.0":"2026-08-30T20:07:16.990Z","2.0.1":"2026-09-02T14:49:09.965Z"},"bugs":{"url":"https://github.com/CorsenAI/corsen-context/issues"},"author":"Corsen AI <contact@corsen.ai>","license":"MIT","homepage":"https://github.com/CorsenAI/corsen-context","keywords":["mcp","llms-txt","nextjs","ai","corsen"],"repository":{"type":"git","url":"https://github.com/CorsenAI/corsen-context.git","directory":"packages/nextjs-adapter"},"description":"Next.js adapter for owner-controlled MCP, WebMCP, llms.txt, and sitemap surfaces","maintainers":[{"name":"corsenai","email":"mordehai.attia@corsen.ai"}],"readme":"# @corsenai/corsen-context-nextjs\n\nNext.js adapter for **[Corsen Context](https://github.com/CorsenAI/corsen-context)** — drop-in route handlers for the MCP endpoint and `llms.txt`, with built-in auth, rate limiting, CORS, and security headers.\n\n```bash\nnpm install @corsenai/corsen-context @corsenai/corsen-context-nextjs\n```\n\n**App Router** — `app/v1/mcp/route.ts`:\n\n```typescript\nimport { createMCPHandler } from '@corsenai/corsen-context-nextjs';\nimport { corsenConfig } from '@/lib/corsen-context.server';\nimport { siteProvider } from '@/lib/corsen-provider';\n\nconst { GET, POST, OPTIONS } = createMCPHandler(corsenConfig, siteProvider);\nexport { GET, POST, OPTIONS };\n```\n\nKeep the full Corsen Context configuration in a server-only module and import\nit directly into each route handler. `withCorsenContext` only adds enabled\nstatic rewrite rules; it does not copy the configuration into\n`nextConfig.env`, serialize it into the client bundle, or make it available as\n`NEXT_PUBLIC_*`. Never use a public Next.js environment variable for an API\nkey or other server credential.\n\n**Static exports** — mount `createLlmsTxtHandler` and, only when explicitly\nrequired, `createLlmsFullTxtHandler` on their own routes. Full content is\ndisabled by default:\n\n```typescript\nimport { createLlmsTxtHandler } from '@corsenai/corsen-context-nextjs';\nimport { corsenConfig } from '@/lib/corsen-context.server';\nimport { siteProvider } from '@/lib/corsen-provider';\n\nexport const GET = createLlmsTxtHandler(corsenConfig, siteProvider);\n// In app/llms-full.txt/route.ts, set includeFullContent: true deliberately.\n```\n\n**WebMCP bridge** — `app/webmcp.js/route.ts`:\n\n```typescript\nimport { createWebMCPScriptHandler } from '@corsenai/corsen-context-nextjs';\nimport { corsenConfig } from '@/lib/corsen-context.server';\nimport { siteProvider } from '@/lib/corsen-provider';\n\nexport const GET = createWebMCPScriptHandler(corsenConfig, siteProvider);\n```\n\nLoad the same-origin bridge from the root layout:\n\n```tsx\n<script src=\"/webmcp.js\" defer />\n```\n\nThis requires both `/webmcp.js` and `/v1/mcp` on the page's public origin.\nThe browser bridge intentionally sends no API key or visitor credentials. If\nWebMCP is enabled, keep the four-tool endpoint public, read-only, rate-limited,\nand backed only by public content. A key-protected endpoint is for\nauthenticated server-side MCP clients and cannot be called by this bridge.\n\n`mcp.enabled: false` makes the adapter's MCP `GET`/`POST`/`OPTIONS`, legacy SSE,\nand WebMCP script handlers return `404`. `static.generateLlmsTxt: false` makes\nboth static handlers return `404`; `static.includeFullContent: false` keeps the\nfull-content handler at `404`. Static output defaults to a 5 MiB UTF-8 byte\nlimit and the core accepts 64 KiB through 10 MiB. `content.maxPages` accepts 1\nthrough 5000 and defaults to 500.\n\nThe MCP handler validates Origin before parsing, requires JSON request and\nresponse media compatibility, rate-limits before optional authentication, and\nreads at most 100 KiB from the actual body. Malformed JSON and oversized bodies\nproduce bounded JSON errors. `GET` returns `405`, a valid `OPTIONS` returns\n`204`, and accepted notifications return an empty `202`; SSE and resumable\nsessions are not implemented on the MCP endpoint.\n\nFor production (multi-instance / Vercel), install the Upstash SDK and inject\nthe same client into both stores:\n\n```bash\nnpm install @upstash/redis\n```\n\nCreate `lib/corsen-upstash.server.ts`:\n\n<!-- upstash-recipe:start -->\n\n```typescript\nimport { Redis } from '@upstash/redis';\nimport {\n  RedisCache,\n  RedisRateLimitStore,\n  type ContentProvider,\n  type CorsenContextConfig,\n} from '@corsenai/corsen-context';\nimport { createMCPHandler } from '@corsenai/corsen-context-nextjs';\n\nexport function createUpstashMCPHandler(config: CorsenContextConfig, provider: ContentProvider) {\n  // Server-only: reads UPSTASH_REDIS_REST_URL and UPSTASH_REDIS_REST_TOKEN.\n  const redis = Redis.fromEnv();\n  return createMCPHandler(config, provider, {\n    cache: new RedisCache(redis),\n    rateLimitStore: new RedisRateLimitStore(redis),\n  });\n}\n```\n\n<!-- upstash-recipe:end -->\n\nThen call `createUpstashMCPHandler(corsenConfig, siteProvider)` from\n`app/v1/mcp/route.ts` and export the returned `GET`, `POST`, and `OPTIONS`.\nKeep both variables server-only; do not expose either as `NEXT_PUBLIC_*`.\nRaw ioredis clients use a different command shape and must first be passed\nthrough `adaptIORedisClient` from the core package.\n\n- **Full docs:** https://github.com/CorsenAI/corsen-context#readme\n- **License:** MIT\n","readmeFilename":""}