Loading video player...
In this video, we build a secure Model Context Protocol (MCP) backend using Next.js and Descope. You’ll see how to handle Dynamic Client Registration (DCR), issue short‑lived JWTs, and lock down tool access with least‑privilege scopes for your agents. We’ll start from the Fast MCP Starter repo, wire up Descope Auth, and then implement three key API routes: - Auth route – register agents, create access keys, exchange them for tokens, fetch connection tokens (e.g. GitHub), and write audit events. - Validate session route – verify Descope session tokens on demand and safely preview JWTs. - MCP tools route – define MCP tools for listing tables, reading/inserting/deleting records, running limited queries, and fetching - GitHub issues, all enforced by role‑based scopes. By the end, you’ll have a fully working MCP backend that: - Ties every tool call to a real user - Enforces mcp:read / mcp:write / mcp:admin / mcp:connections scopes - Audits actions via Descope - Uses a simple JSON file database to demo real tool behavior What you’ll learn: - How Model Context Protocol (MCP) works in practice - How to implement Dynamic Client Registration for agents - How to map Descope roles/permissions to MCP scopes - How to secure tool execution with least privilege - How to integrate GitHub via Descope Connections Tech stack: - Next.js (App Router) - Descope Next.js SDK - TypeScript - Node.js (file‑based JSON “database”) Links: - Fast MCP Starter repo: https://github.com/mendsalbert/fast_mcp_starter - Descope docs: https://www.descope.com/ If you want a follow‑up where we build the Python version of this exact stack, drop a comment and subscribe so you don’t miss it.