Skip to content

Commit 1937bff

Browse files
committed
limit uris to http(s): & data:
1 parent 13814ba commit 1937bff

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

mcp-server/src/services/mcp.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -653,8 +653,12 @@ export const createMcpServer = (): McpServerWrapper => {
653653
const { files, outputType } = ZipResourcesInputSchema.parse(args);
654654
const zip = new JSZip();
655655

656-
for (const [fileName, fileUrl] of Object.entries(files)) {
656+
for (const [fileName, fileUrlString] of Object.entries(files)) {
657657
try {
658+
const fileUrl = new URL(fileUrlString);
659+
if (fileUrl.protocol !== 'http:' && fileUrl.protocol !== 'https:' && fileUrl.protocol !== 'data:') {
660+
throw new Error(`Unsupported URL protocol for ${fileUrlString}. Only http, https, and data URLs are supported.`);
661+
}
658662
const response = await fetch(fileUrl);
659663
if (!response.ok) {
660664
throw new Error(

0 commit comments

Comments
 (0)