Перейти к содержимому

MCP #32 | Connect Cursor to a Remote MCP Server - Bearer Token Setup

LZX - QuickFlow

0:00 / 0:00

MCP #32 | Connect Cursor to a Remote MCP Server - Bearer Token Setup

16 просмотров · 5 дн. назад
LZX - QuickFlow
1 подписчик
16 просмотров · 5 дн. назад
Connect Cursor to a remote MCP server over HTTPS using Bearer token authentication in .cursor/mcp.json. Watch a 401 Unauthorized response turn into a working MCP connection, then use Cursor to search hotels and inspect a booking through backend tools. In QuickFlow MCP #32, we expose a Laravel MCP server through an ngrok HTTPS tunnel, configure Cursor's Authorization header, and verify the results against backend data. Follow the complete workflow from connection setup to the code that authenticates and dispatches tool requests. CHAPTERS 00:00 Local stdio vs remote MCP connections 00:36 HTTPS endpoint and Bearer authentication 01:14 Demo setup: expose the MCP server 01:23 Start the ngrok tunnel with php artisan mcp:tunnel 01:59 Test access without a token: 401 Unauthorized 02:52 Add the Bearer token and connect 12 tools 03:43 Search hotels in Paris from Cursor 05:35 Inspect booking BK-PAR-8060 and verify the data 07:41 Cursor configuration: .cursor/mcp.json 08:02 Request routing: McpController.php 08:23 Bearer authentication: McpAuthenticate.php 08:42 Reservation lookup: GetReservationTool.php 09:00 End-to-end MCP execution flow 09:33 Implementation checklist and action plan 09:54 Outro WHAT YOU'LL LEARN • How a remote MCP URL differs from a local stdio command. • Where to configure the Bearer token in Cursor's MCP settings. • How authentication blocks an unauthenticated request before tool execution. • How MCP tools query the database and return results to Cursor. • How to verify an AI response against the underlying application data. The demo uses a local backend exposed through an HTTPS tunnel. Cursor connects to the MCP server; the backend tools access the database. BUILD IT WITH AI Copy this prompt into Cursor, Claude Code, or your AI coding assistant: "Extend our Laravel project with a remote Model Context Protocol (MCP) endpoint compatible with our target Cursor version. Inspect the existing implementation first and preserve its supported transport. Provide a .cursor/mcp.json example using url and an Authorization: Bearer header with a demo token placeholder. Implement McpAuthenticate middleware that reads the expected token from server-side configuration, rejects missing or invalid credentials with HTTP 401 before tool execution, and uses constant-time comparison. Keep real secrets out of committed files and logs. Add a database-backed lookup tool using demo data. Include checks for unauthenticated access, authenticated tool discovery, tool execution, and verification against the database." RESOURCES GitHub repository: https://github.com/lzxuniverse/quickflow MCP specification: https://modelcontextprotocol.io Full MCP series:    • MCP Series | From Zero to Real-World AI Wo...   AI client connection guides:    • MCP Series | Connect AI Clients to Your Se...   Subscribe to LZX - QuickFlow for practical AI and software workflows, real experiments, and observable results. Quick Starter, Master Flow. #Cursor #MCP #RemoteMCP #BearerAuth #Laravel