|
1 | 1 | # MCP-Auth Quickstart |
2 | 2 |
|
3 | | -Welcome to the Secure MCP server Quickstart guide! In this document, you will learn to build a Node.js MCP server using Asgardeo MCP Auth SDK, secure it with {{ product_name }} and define a MCP tool to add two numbers and a `greeting` resource. |
| 3 | +Welcome to the Secure MCP server Quickstart guide! This document shows you how to build a secure MCP (Model Context Protocol) server using [MCP TypeScript SDK](https://www.npmjs.com/package/@modelcontextprotocol/sdk) and [WSO2 MCP Auth SDK](https://www.npmjs.com/package/@asgardeo/mcp-express). |
| 4 | + |
| 5 | +You will create an MCP server that: |
| 6 | + |
| 7 | +- **Implements authorization** with {{ product_name }} |
| 8 | +- **Defines a tool** that adds two numbers |
| 9 | +- **Serves a resource** that generates a greeting |
| 10 | + |
| 11 | +After completing this guide, you will have a working MCP server that uses OAuth 2.1 according to the [MCP auth specification](https://modelcontextprotocol.io/specification/2025-06-18/basic/authorization). |
4 | 12 |
|
5 | 13 | [//] STEPS_START |
6 | 14 |
|
@@ -227,7 +235,7 @@ User **MCP Inspector** as the client application to test the MCP server. |
227 | 235 | npx @modelcontextprotocol/inspector http://localhost:3000/mcp |
228 | 236 | ``` |
229 | 237 |
|
230 | | -Use it to list tools/resources, invoke the "add" tool (e.g., inputs `{ "a": 5, "b": 3 }`), or query the "greeting" resource (e.g., `greeting://world`). |
| 238 | +Use it to list tools/resources, invoke the "add" tool, or query the "greeting" resource using the inspector UI. |
231 | 239 |
|
232 | 240 |
|
233 | 241 | ## Add auth to the MCP server |
@@ -268,7 +276,7 @@ import { z } from 'zod'; |
268 | 276 | import {McpAuthServer} from '@asgardeo/mcp-express'; |
269 | 277 |
|
270 | 278 | // Define the port |
271 | | -const port = parseInt(process.env.PORT || '3000'); |
| 279 | +const port = '3000'; |
272 | 280 |
|
273 | 281 | // Initialize McpAuthServer (Asgardeo auth middleware) |
274 | 282 | const mcpAuthServer = new McpAuthServer({ |
@@ -358,7 +366,7 @@ app.listen(port, () => { |
358 | 366 | }); |
359 | 367 | ``` |
360 | 368 |
|
361 | | -Verify and update the placeholder values of `mcpAuthServer` configurations to properly connect to `{{ product_name }}`. |
| 369 | +Verify and update the placeholder values of `mcpAuthServer` configurations to properly connect to `{{ product_name }}`. Alternatively, you can use environment variables to manage these configurations securely. |
362 | 370 |
|
363 | 371 | First run the dev server by running the following command. |
364 | 372 |
|
|
0 commit comments