This is a practical example of securing a Model Context Protocol (MCP) server with Auth0 using the Express framework.
Install the dependencies using npm:
npm installRename .env.example to .env and configure the domain and audience:
AUTH0_DOMAIN=
AUTH0_AUDIENCE=With the configuration in place, the example can be started by running:
npm run startUse an MCP client like MCP Inspector to test your server interactively:
npx @modelcontextprotocol/inspectorThe server will start up and the UI will be accessible at http://localhost:6274.
In the MCP Inspector, select Streamable HTTP as the Transport Type and enter http://localhost:3001/mcp as the URL.
For detailed instructions on setting up your Auth0 tenant for MCP server integration, please refer to the Auth0 Tenant Setup guide in the FastMCP example.