avancement planning

This commit is contained in:
2026-05-26 11:58:39 +02:00
parent 619a2b240a
commit 150b97cd2e
4892 changed files with 99214 additions and 429382 deletions
@@ -1,12 +1,32 @@
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
const express_1 = __importDefault(require("express"));
const mcp_js_1 = require("../../server/mcp.js");
const sse_js_1 = require("../../server/sse.js");
const zod_1 = require("zod");
const z = __importStar(require("zod/v4"));
const express_js_1 = require("../../server/express.js");
/**
* This example server demonstrates the deprecated HTTP+SSE transport
* (protocol version 2024-11-05). It mainly used for testing backward compatible clients.
@@ -20,52 +40,48 @@ const zod_1 = require("zod");
const getServer = () => {
const server = new mcp_js_1.McpServer({
name: 'simple-sse-server',
version: '1.0.0',
version: '1.0.0'
}, { capabilities: { logging: {} } });
server.tool('start-notification-stream', 'Starts sending periodic notifications', {
interval: zod_1.z.number().describe('Interval in milliseconds between notifications').default(1000),
count: zod_1.z.number().describe('Number of notifications to send').default(10),
}, async ({ interval, count }, { sendNotification }) => {
server.registerTool('start-notification-stream', {
description: 'Starts sending periodic notifications',
inputSchema: {
interval: z.number().describe('Interval in milliseconds between notifications').default(1000),
count: z.number().describe('Number of notifications to send').default(10)
}
}, async ({ interval, count }, extra) => {
const sleep = (ms) => new Promise(resolve => setTimeout(resolve, ms));
let counter = 0;
// Send the initial notification
await sendNotification({
method: "notifications/message",
params: {
level: "info",
data: `Starting notification stream with ${count} messages every ${interval}ms`
}
});
await server.sendLoggingMessage({
level: 'info',
data: `Starting notification stream with ${count} messages every ${interval}ms`
}, extra.sessionId);
// Send periodic notifications
while (counter < count) {
counter++;
await sleep(interval);
try {
await sendNotification({
method: "notifications/message",
params: {
level: "info",
data: `Notification #${counter} at ${new Date().toISOString()}`
}
});
await server.sendLoggingMessage({
level: 'info',
data: `Notification #${counter} at ${new Date().toISOString()}`
}, extra.sessionId);
}
catch (error) {
console.error("Error sending notification:", error);
console.error('Error sending notification:', error);
}
}
return {
content: [
{
type: 'text',
text: `Completed sending ${count} notifications every ${interval}ms`,
text: `Completed sending ${count} notifications every ${interval}ms`
}
],
]
};
});
return server;
};
const app = (0, express_1.default)();
app.use(express_1.default.json());
const app = (0, express_js_1.createMcpExpressApp)();
// Store transports by session ID
const transports = {};
// SSE endpoint for establishing the stream
@@ -125,7 +141,7 @@ app.post('/messages', async (req, res) => {
});
// Start the server
const PORT = 3000;
app.listen(PORT, (error) => {
app.listen(PORT, error => {
if (error) {
console.error('Failed to start server:', error);
process.exit(1);