Compare commits
4 Commits
5b87676ef4
...
5bfcee6918
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5bfcee6918 | ||
|
|
30a62d9a1d | ||
|
|
50ccc0e2a1 | ||
|
|
fea9d2bd92 |
@@ -59,8 +59,9 @@ return [
|
|||||||
El Docker debe estar corriendo. Hacer curl al endpoint del hook:
|
El Docker debe estar corriendo. Hacer curl al endpoint del hook:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
curl http://localhost:8080/hooks/example_hook/
|
curl {ACAI_WEB_URL}/hooks/example_hook/
|
||||||
```
|
```
|
||||||
|
(Use the project's actual URL, never localhost:8080)
|
||||||
|
|
||||||
No usar X-Hooks-Token en desarrollo local.
|
No usar X-Hooks-Token en desarrollo local.
|
||||||
|
|
||||||
|
|||||||
@@ -4,9 +4,10 @@ This is an Acai CMS website project. Follow these instructions when working with
|
|||||||
|
|
||||||
## Environment
|
## Environment
|
||||||
|
|
||||||
- The site runs in Docker, typically at **http://localhost:8080**
|
- The site runs in Docker. **Before using fetch or Playwright, call the `get_web_url` tool** to get the correct development URL. Never hardcode or guess URLs.
|
||||||
- You can make HTTP requests to test pages, APIs, or form submissions
|
- **ALWAYS append `?pruebas=1`** to any URL you visit (e.g. `http://.../?pruebas=1`). This query param is required to view the site in development mode.
|
||||||
- If you need to inspect the live site, use browser tools (Playwright MCP) or HTTP requests to localhost:8080
|
- **NEVER navigate to the production domain** (e.g. `keepsailing.es`, `tienda.com`). The production site is NOT your development environment.
|
||||||
|
- **NEVER use localhost:8080 or https://** — use HTTP (not HTTPS) with the URL from `get_web_url`.
|
||||||
|
|
||||||
## Project Structure
|
## Project Structure
|
||||||
|
|
||||||
|
|||||||
45
mcp-server/tools/project/getWebUrl.js
Normal file
45
mcp-server/tools/project/getWebUrl.js
Normal file
@@ -0,0 +1,45 @@
|
|||||||
|
import { z } from "zod";
|
||||||
|
import { withAuth, getSessionCredentials } from "../../auth/index.js";
|
||||||
|
import { handleToolError } from "../helpers/errorHandler.js";
|
||||||
|
import { withAuthParams } from "../helpers/authSchema.js";
|
||||||
|
|
||||||
|
export function registerGetWebUrlTool(server) {
|
||||||
|
server.tool(
|
||||||
|
"get_web_url",
|
||||||
|
`Get the correct URL for the project's development website. Always use this URL for fetch, Playwright, or any HTTP request to the site. Never guess or use production domains.`,
|
||||||
|
withAuthParams({}),
|
||||||
|
{ readOnlyHint: true, destructiveHint: false },
|
||||||
|
withAuth(async (_params, extra) => {
|
||||||
|
try {
|
||||||
|
const credentials = await getSessionCredentials(extra.sessionId);
|
||||||
|
|
||||||
|
if (!credentials || !credentials.web_url) {
|
||||||
|
return {
|
||||||
|
content: [{ type: "text", text: "Error: no web_url available. Run select_project first." }],
|
||||||
|
isError: true,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
// Inside Docker, HTTPS is not available — force HTTP for internal requests
|
||||||
|
let webUrl = credentials.web_url;
|
||||||
|
if (webUrl && webUrl.startsWith("https://") && webUrl.includes(".forge.")) {
|
||||||
|
webUrl = webUrl.replace("https://", "http://");
|
||||||
|
}
|
||||||
|
|
||||||
|
return {
|
||||||
|
content: [{
|
||||||
|
type: "text",
|
||||||
|
text: JSON.stringify({
|
||||||
|
web_url: webUrl,
|
||||||
|
api_web_url: credentials.api_web_url || null,
|
||||||
|
website: credentials.website || null,
|
||||||
|
note: "Always use web_url for Playwright/fetch. IMPORTANT: Always append ?pruebas=1 to any URL you visit (e.g. web_url + '/?pruebas=1' or web_url + '/servicios/?pruebas=1'). Never use the production domain directly.",
|
||||||
|
})
|
||||||
|
}],
|
||||||
|
};
|
||||||
|
} catch (error) {
|
||||||
|
return handleToolError(error, "get_web_url", {});
|
||||||
|
}
|
||||||
|
})
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -1,5 +1,7 @@
|
|||||||
import { registerSaveProjectStylesTool } from "./saveStyles.js";
|
import { registerSaveProjectStylesTool } from "./saveStyles.js";
|
||||||
|
import { registerGetWebUrlTool } from "./getWebUrl.js";
|
||||||
|
|
||||||
export function registerProjectTools(server) {
|
export function registerProjectTools(server) {
|
||||||
registerSaveProjectStylesTool(server);
|
registerSaveProjectStylesTool(server);
|
||||||
|
registerGetWebUrlTool(server);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user