Commit graph typescript-sdk/src/server/index.ts
Author SHA1 Message Date
Konstantin Konstantinov
a606fb1790
SPEC COMPLIANCE: Remove loose/passthrough types not allowed/defined by MCP spec + Task types (#1242) 2025-12-09 11:52:23 +00:00
Wuma
7c9257cdf5
refactor: make Server class framework-agnostic by moving express to separate module (#1223) 2025-12-03 11:58:42 +00:00
Paul Carleton
09623e2aa5
Merge commit from fork
* Add secure default for DNS rebinding, use in examples

* Update README examples to use createMcpExpressApp, bump to 1.23.0

- Update all server examples to use createMcpExpressApp() for secure defaults
- Rewrite DNS Rebinding Protection section to document new middleware approach
- Bump version from 1.23.0-beta.0 to 1.23.0

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

* Add IPv6 support, allowedHosts option, and warning for unprotected servers

- Use native URL API to parse Host headers (handles IPv6 correctly)
- Add [::1] (IPv6 localhost) to localhostHostValidation
- Add ::1 to list of localhost hosts that get automatic protection
- Add allowedHosts option to createMcpExpressApp for custom host validation
- Warn when binding to 0.0.0.0 or :: without allowedHosts configured
- Add tests for IPv6 and allowedHosts functionality

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

* Update remaining examples to use createMcpExpressApp and add DNS rebinding docs

- Update simpleTaskInteractive.ts, ssePollingExample.ts, and elicitationUrlExample.ts
  to use createMcpExpressApp() instead of express() + express.json()
- Add DNS rebinding protection section to docs/server.md explaining how to use
  createMcpExpressApp() and hostHeaderValidation middleware

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

---------

Co-authored-by: Claude <noreply@anthropic.com>
2025-12-02 13:23:06 +00:00
Felix Weinberger
cf51343cc1
feat: backwards-compatible createMessage overloads for SEP-1577 (#1212) 2025-12-02 13:18:22 +00:00
Luca Chang
b9538a222a
SEP-1686: Tasks (#1041)
Co-authored-by: Felix Weinberger <3823880+felixweinberger@users.noreply.github.com>
Co-authored-by: Felix Weinberger <fweinberger@anthropic.com>
2025-11-27 20:11:25 +00:00
Felix Weinberger
b59a2bde7d
fix: React to upstream RC schema changes for form mode elicitation requests (#1164)
Co-authored-by: Nate Barbettini <nate@arcade.dev>
2025-11-25 11:21:07 +00:00
Olivier Chafik
2a55dfd5f2
sampling: validate tools, tool_use, tool_result constraints (#1156) 2025-11-22 23:56:59 -05:00
Nate Barbettini
9df0972774
chore: Add deprecated marker to old elicitInput overload (#1142) 2025-11-20 18:26:22 +00:00
Devin Clark
418b7f9b85
feat: zod v4 with backwards compatibility for v3.25+ (#1040) 2025-11-19 20:24:53 +00:00
Nate Barbettini
4debc740a5
SEP-1036: URL Elicitation (#1105) 2025-11-18 10:53:15 +00:00
Konstantin Konstantinov
f59996ae66
SEP-1319: Decouple Request Payloads, Remove passthrough iteration, Typecheck fixes (#1086) 2025-11-07 16:50:20 +00:00
adam jones
216604720b
Add @deprecated annotations to legacy APIs (#1018)
Co-authored-by: Claude <noreply@anthropic.com>
2025-11-03 15:21:18 +00:00
Matt
5a8fb39430
feat: pluggable JSON schema validator providers (#1012) 2025-10-25 11:56:42 -04:00
Inna Harper
1150b1d843
run prettier (#995) 2025-10-02 18:21:00 +01:00
Cliff Hall
ebf39330f3
Fix automatic log level handling for sessionless connections (#917) 2025-09-09 21:35:08 +01:00
Cliff Hall
79d11dc53f
Automatic handling of logging level (#882)
Co-authored-by: Felix Weinberger <3823880+felixweinberger@users.noreply.github.com>
2025-08-27 15:09:07 -04:00
ihrpr
54c30109fb
Merge branch 'main' into ihrpr/elicitation 2025-06-16 19:11:57 +01:00
Olivier Chafik
33257f14d4
switch to optional Transport.setProtocolVersion 2025-06-13 13:36:04 +01:00
Olivier Chafik
84971c83ea
Set Mcp-Protocol-Version in client requests after init, and warn when it doesn't match negotiated version (it SHOULD match) 2025-06-11 17:29:09 +01:00
Basil Hosmer
eea1519994
lint 2025-05-21 23:42:00 -04:00
Basil Hosmer
a89f950222
post-rebase fixes 2025-05-21 17:12:42 -04:00
ihrpr
04cbbfbb0d
elicitation example 2025-05-21 16:59:37 -04:00
Justin Spahr-Summers
21f492f531
Revert "Merge pull request #334 from m-paternostro/mp/notifier"
This reverts commit 3ef902328a, reversing
changes made to 5b6d35eb12.
2025-04-22 11:35:49 +01:00
Marcelo Paternostro
b5e6d7bc32
add server.getVersion() 2025-04-18 10:05:09 -04:00
Justin Spahr-Summers
2e35b15353
Merge branch 'main' into justin/simplified-api 2025-01-13 20:34:08 +00:00
Kalvin Chau
1bb51d0fca style: remove private getter for getInstructions 2025-01-13 09:50:02 -08:00
Kalvin Chau
54472d2ae1 feat: add optional instructions field to server _oninitialize 2025-01-13 09:09:05 -08:00
Justin Spahr-Summers
2289dbc0d0
Factor out convenience APIs into another class 2025-01-08 21:59:38 +00:00
Justin Spahr-Summers
189cc84113
Autocomplete on resource template variables 2025-01-08 15:46:43 +00:00
Justin Spahr-Summers
8635c6384f
Autocomplete on prompt arguments 2025-01-08 15:19:16 +00:00
Justin Spahr-Summers
9b95fa8203
Server.prompt() convenience API 2025-01-08 14:20:44 +00:00
Justin Spahr-Summers
5ddfa0a0d9
Add extra to resource request handlers 2025-01-08 14:20:43 +00:00
Justin Spahr-Summers
f090c93127
Move Server helper definitions to bottom of file 2025-01-08 13:47:38 +00:00
Justin Spahr-Summers
8356cb900c
Create ResourceTemplate class and move listCallback into it 2025-01-08 13:44:12 +00:00
Justin Spahr-Summers
45f99e6590
Make Variables non-optional with resource template URIs 2025-01-07 22:36:20 +00:00
Justin Spahr-Summers
1970509131
Method documentation 2025-01-07 22:05:55 +00:00
Justin Spahr-Summers
098266ae22
Add simplified API for registering resources and resource templates 2025-01-07 22:01:41 +00:00
Justin Spahr-Summers
aac1959855
Errors invoking tools should be erroneous tool results, not McpErrors 2025-01-07 14:53:56 +00:00
Justin Spahr-Summers
b538731af0
Fix string type check 2025-01-07 14:40:53 +00:00
Justin Spahr-Summers
7ac5a5fcf5
Automatically register tools capability 2025-01-07 14:34:00 +00:00
Justin Spahr-Summers
1506bd1b51
Allow capabilities to be dynamically registered after initialization 2025-01-07 14:34:00 +00:00
Justin Spahr-Summers
4bf5c5358a
Assert tool request handlers do not already exist 2025-01-07 14:34:00 +00:00
Justin Spahr-Summers
f8f5686966
Server.tool() convenience API 2025-01-07 14:33:56 +00:00
Justin Spahr-Summers
1451d0ea24
Explicitly allow cancelled notifications without any capability 2024-11-14 14:07:28 +00:00
Justin Spahr-Summers
54d146bbdc
Support passing an AbortSignal to request() 2024-11-14 13:42:18 +00:00
Justin Spahr-Summers
8b307a5d62
Check capabilities when request handlers are set 2024-11-12 12:16:43 +00:00
Justin Spahr-Summers
64c2862883
Check and add tests for notification capabilities too 2024-11-12 12:02:10 +00:00
Justin Spahr-Summers
dc45f5d148
Handle capabilities checks at the request() level, make non-strict by default 2024-11-12 10:57:59 +00:00
Justin Spahr-Summers
8e369b7171
Lint 2024-11-11 22:49:53 +00:00
Justin Spahr-Summers
7ab5880569
Use explicit capabilities lists for now 2024-11-11 22:38:43 +00:00