Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -371,6 +371,7 @@

let allTools: AAPMcpToolDefinition[] = [];

const processUUID = randomUUID();
// Initialize logger only if recording is enabled
const toolLogger = recordApiQueries ? new ToolLogger() : null;

Expand Down Expand Up @@ -833,6 +834,25 @@
}
};

async function sendStatusEvent(): null {

Check failure on line 837 in src/index.ts

View workflow job for this annotation

GitHub Actions / build (22.x)

A function whose declared type is neither 'undefined', 'void', nor 'any' must return a value.

Check failure on line 837 in src/index.ts

View workflow job for this annotation

GitHub Actions / build (22.x)

The return type of an async function or method must be the global Promise<T> type. Did you mean to write 'Promise<null>'?

Check failure on line 837 in src/index.ts

View workflow job for this annotation

GitHub Actions / build (20.x)

A function whose declared type is neither 'undefined', 'void', nor 'any' must return a value.

Check failure on line 837 in src/index.ts

View workflow job for this annotation

GitHub Actions / build (20.x)

The return type of an async function or method must be the global Promise<T> type. Did you mean to write 'Promise<null>'?
console.log("---");
console.log(`Server process UUID ${processUUID}`);
console.log(`Active session ${Object.keys(sessionData).length}`);
console.log(`Uptime ${Math.floor(process.uptime())}`);
console.log(`Tools ${Object.keys(allTools).length}`);
try {
await fetch(`${CONFIG.BASE_URL}/`, {
headers: {
Accept: "application/json",
},
timeout: 1000,

Check failure on line 848 in src/index.ts

View workflow job for this annotation

GitHub Actions / build (22.x)

Object literal may only specify known properties, and 'timeout' does not exist in type 'RequestInit'.

Check failure on line 848 in src/index.ts

View workflow job for this annotation

GitHub Actions / build (20.x)

Object literal may only specify known properties, and 'timeout' does not exist in type 'RequestInit'.
});
console.log(`AAP is reachable OK`);
} catch (_error) {
console.log(`AAP is reachable KO`);
}
}

// Web UI routes (only enabled if enable_ui is true)
if (enableUI) {
// Tool list HTML endpoint
Expand Down Expand Up @@ -1547,6 +1567,10 @@

const PORT = process.env.MCP_PORT || 3000;

const _intervalId: NodeJS.Timeout = setInterval(() => {
sendStatusEvent();
}, 2000);

app.listen(PORT, () => {
console.log(`Server ready on port ${PORT}`);
console.log("");
Expand Down
Loading