[v2] URI template strict expansions leave !'()* unencoded
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 84/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- typescript
- Domain
- api
Research direction
Start with packages/core-internal/src/shared/uriTemplate.ts, focusing on UriTemplate.expand() and encodeValue(), then run the repro.mjs example with Node.js 24 or later. Done means simple and query expansions percent-encode !'()* as shown, while reserved and fragment expansions retain their permitted characters.
Written by the indexing model from the issue text.
Description
What happened?
UriTemplate.expand() leaves !'()* unchanged in simple expansions. Query values have the same problem: search{?q} with q: 'hello!' produces search?q=hello!.
encodeURIComponent() leaves these characters unchanged, and encodeValue() returns that output directly for strict expansion operators.
What did you expect?
Expected output from the snippet below:
%21%27%28%29%2A
search?q=hello%21
RFC 6570 section 3.2.1 permits unreserved characters in strict variable expansions. The five characters above are reserved and need percent-encoding. Reserved and fragment expansions can keep them.
Code to reproduce
Save this as repro.mjs at the SDK repository root and run node repro.mjs with Node.js 24 or later. It imports the source module directly.
import { UriTemplate } from './packages/core-internal/src/shared/uriTemplate.ts';
const value = "!'()*";
console.log(new UriTemplate('{value}').expand({ value }));
console.log(new UriTemplate('search{?q}').expand({ q: 'hello!' }));
Current output:
!'()*
search?q=hello!
SDK version
main at e16d27729ea2fae144a6d957fd0372d9eb0e6c58 (v2 source checkout). Tested with Node.js 24.12.0.
Area
Other
- Dominant language
- TypeScript
- Stars
- 13.5k
- Forks
- 2.2k
- Avg merge
- 2d 16h
- Merged PRs (30d)
- 46
Getting set up
- No Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from modelcontextprotocol/typescript-sdk
-
v1 v2
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
modelcontextprotocol/typescript-sdk#2946 ·
Maintainers usually reply within 1 day
-
v1 v2
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
modelcontextprotocol/typescript-sdk#2920 · 1 comment ·
Maintainers usually reply within 1 day
-
v1 v2
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
modelcontextprotocol/typescript-sdk#2916 · 2 comments ·
Maintainers usually reply within 1 day
-
v1 v2
Difficulty 1/5 Under an hour Newbie friendliness 90/100
modelcontextprotocol/typescript-sdk#2867 · 1 comment ·
Maintainers usually reply within 1 day
-
v1 v2
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
modelcontextprotocol/typescript-sdk#2854 · 1 comment ·
Maintainers usually reply within 1 day
All issues in modelcontextprotocol/typescript-sdk
Similar issues
-
bug via-triage
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
pingdotgg/t3code#15221 · 1 comment ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
521xueweihan/HelloGitHub#3847 ·
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
MystenLabs/MemWal#1085 · 1 comment ·
Maintainers usually reply within 1 day
-
needs-triage
Difficulty 1/5 Under an hour Newbie friendliness 92/100
PhyberApex/kuroshiro#1187 ·
Maintainers usually reply within 1 day