|
1 | 1 | # MCP TypeScript SDK   |
2 | 2 |
|
3 | 3 | ## Table of Contents |
| 4 | + |
4 | 5 | - [Overview](#overview) |
5 | 6 | - [Installation](#installation) |
6 | | -- [Quickstart](#quickstart) |
| 7 | +- [Quickstart](#quick-start) |
7 | 8 | - [What is MCP?](#what-is-mcp) |
8 | 9 | - [Core Concepts](#core-concepts) |
9 | 10 | - [Server](#server) |
|
18 | 19 | - [Echo Server](#echo-server) |
19 | 20 | - [SQLite Explorer](#sqlite-explorer) |
20 | 21 | - [Advanced Usage](#advanced-usage) |
| 22 | + - [Dynamic Servers](#dynamic-servers) |
21 | 23 | - [Low-Level Server](#low-level-server) |
22 | 24 | - [Writing MCP Clients](#writing-mcp-clients) |
23 | | - - [Server Capabilities](#server-capabilities) |
24 | | - - [Proxy OAuth Server](#proxy-authorization-requests-upstream) |
| 25 | + - [Proxy Authorization Requests Upstream](#proxy-authorization-requests-upstream) |
25 | 26 | - [Backwards Compatibility](#backwards-compatibility) |
| 27 | +- [Documentation](#documentation) |
| 28 | +- [Contributing](#contributing) |
| 29 | +- [License](#license) |
26 | 30 |
|
27 | 31 | ## Overview |
28 | 32 |
|
@@ -377,6 +381,7 @@ app.listen(PORT, () => { |
377 | 381 | ``` |
378 | 382 |
|
379 | 383 | This stateless approach is useful for: |
| 384 | + |
380 | 385 | - Simple API wrappers |
381 | 386 | - RESTful scenarios where each request is independent |
382 | 387 | - Horizontally scaled deployments without shared session state |
@@ -512,7 +517,7 @@ server.tool( |
512 | 517 |
|
513 | 518 | ### Dynamic Servers |
514 | 519 |
|
515 | | -If you want to offer an initial set of tools/prompts/resources, but later add additional ones based on user action or external state change, you can add/update/remove them _after_ the Server is connected. This will automatically emit the corresponding `listChanged` notificaions: |
| 520 | +If you want to offer an initial set of tools/prompts/resources, but later add additional ones based on user action or external state change, you can add/update/remove them _after_ the Server is connected. This will automatically emit the corresponding `listChanged` notifications: |
516 | 521 |
|
517 | 522 | ```ts |
518 | 523 | import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js"; |
@@ -543,7 +548,7 @@ putMessageTool.disable() |
543 | 548 |
|
544 | 549 | const upgradeAuthTool = server.tool( |
545 | 550 | "upgradeAuth", |
546 | | - { permission: z.enum(["write', vadmin"])}, |
| 551 | + { permission: z.enum(["write', admin"])}, |
547 | 552 | // Any mutations here will automatically emit `listChanged` notifications |
548 | 553 | async ({ permission }) => { |
549 | 554 | const { ok, err, previous } = await upgradeAuthAndStoreToken(permission) |
@@ -686,7 +691,8 @@ You can proxy OAuth requests to an external authorization provider: |
686 | 691 |
|
687 | 692 | ```typescript |
688 | 693 | import express from 'express'; |
689 | | -import { ProxyOAuthServerProvider, mcpAuthRouter } from '@modelcontextprotocol/sdk'; |
| 694 | +import { ProxyOAuthServerProvider } from '@modelcontextprotocol/sdk/server/auth/providers/proxyProvider.js'; |
| 695 | +import { mcpAuthRouter } from '@modelcontextprotocol/sdk/server/auth/router.js'; |
690 | 696 |
|
691 | 697 | const app = express(); |
692 | 698 |
|
@@ -720,6 +726,7 @@ app.use(mcpAuthRouter({ |
720 | 726 | ``` |
721 | 727 |
|
722 | 728 | This setup allows you to: |
| 729 | + |
723 | 730 | - Forward OAuth requests to an external provider |
724 | 731 | - Add custom token validation logic |
725 | 732 | - Manage client registrations |
@@ -833,7 +840,7 @@ app.listen(3000); |
833 | 840 |
|
834 | 841 | ## Contributing |
835 | 842 |
|
836 | | -Issues and pull requests are welcome on GitHub at https://github.com/modelcontextprotocol/typescript-sdk. |
| 843 | +Issues and pull requests are welcome on GitHub at <https://github.com/modelcontextprotocol/typescript-sdk>. |
837 | 844 |
|
838 | 845 | ## License |
839 | 846 |
|
|
0 commit comments