Skip to content

Commit 3dcc262

Browse files
committed
fix tool siteUrl
1 parent 107f44c commit 3dcc262

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

server/mcp/tools/get-page.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@ WORKFLOW: This tool returns the complete page content including title, descripti
1919
cache: '1h',
2020
handler: async ({ path }) => {
2121
const event = useEvent()
22-
const siteUrl = import.meta.dev ? 'http://localhost:3000' : getRequestURL(event).origin
22+
const url = getRequestURL(event)
23+
const siteUrl = import.meta.dev ? `${url.protocol}//${url.hostname}:${url.port}` : url.origin
2324

2425
try {
2526
const page = await queryCollection(event, 'docs')

server/mcp/tools/list-pages.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@ OUTPUT: Returns a structured list with:
2222
cache: '1h',
2323
handler: async () => {
2424
const event = useEvent()
25-
const siteUrl = import.meta.dev ? 'http://localhost:3000' : getRequestURL(event).origin
25+
const url = getRequestURL(event)
26+
const siteUrl = import.meta.dev ? `${url.protocol}//${url.hostname}:${url.port}` : url.origin
2627

2728
try {
2829
const pages = await queryCollection(event, 'docs')

0 commit comments

Comments
 (0)