dist / server.js
dist / server.js
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const index_js_1 = require("@modelcontextprotocol/sdk/server/index.js");
const stdio_js_1 = require("@modelcontextprotocol/sdk/server/stdio.js");
const types_js_1 = require("@modelcontextprotocol/sdk/types.js");
const toolsProvider_1 = require("./toolsProvider"); // ✅ بنستورد دالة التنفيذ من ملفك
const server = new index_js_1.Server({ name: 'bido-mcp-gateway', version: '1.0.0' }, { capabilities: { tools: {} } });
// 1. تعريف الأداة بالدستور الكامل بتاعك
server.setRequestHandler(types_js_1.ListToolsRequestSchema, async () => {
return {
tools: [
{
name: 'bido_gateway',
description: `Execute any local tool by exact name.
## Core Tools (Server 6075)
getTime() | getDate() | readFile(path, full?) | writeFile(path, content) | appendToFile(path, content) | copyFile(from, to) | renameFile(from, to) | moveToTrash(path) | listFiles(path) | getFileInfo(path) | eagleEye(path, mode?) | listDirectoryStructure(path, depth?) | makeDirectory(path) | copyDirectory(from, to) | renameDirectory(from, to) | searchFiles(path, query, type) | extractTextFromImage(image, language?) | runPythonScript(code, args?, timeout?) | createDynamicTool(name, language, code, description) | runDynamicTool(name, args?, timeout?) | semanticSearch(query, limit?) | saveSession(title, mainIdea, summary, rawContent, tags) | readRawSession(sessionId) | addMemory(namespace, content, tags) | getMemory(namespace, id?, tags?, limit?) | markAwareness(insight, tags, context) | recallAwareness(query?, tags?, limit?) | searchWeb(query, maxResults?) | fetchArticle(url, filename) | readConsciousness() | appendToDynamicPrompt(content)
## Code Tools (Server 6041)
readFileLines(path, start?, end?) | getFileOutline(path) | searchInFile(path, query, regex?, caseSensitive?, maxResults?) | readFileWindow(path, line, context?) | replaceLines(path, start, end, content) | insertAtLine(path, line, content, before?) | deleteLines(path, start, end) | replaceInFile(path, find, replace, regex?, all?) | replaceBlock(path, newContent, startTag?, endTag?, occurrence?) | findSymbols(path, type?) | findReferences(symbol, path?, maxResults?) | getDependencies(path) | codeStats(path?)
## Terminal Tools (Server 6090)
exec(cmd, cwd?, timeout?) | health() | history() | download(url, output?) | listPorts() | killProcess(pid, force?) | which(cmd) | env()
## Memory Tools (Server 5077)
semanticSearch(query, limit?) | saveSession(title, mainIdea, summary, rawContent, tags) | readRawSession(sessionId)
## Local Fallback Tools (always available)
readFile(file) | writeFile(file, content) | appendFile(file, content) | deleteFile(file) | copyFile(source, destination) | renameFile(oldName, newName) | listFolder(folder) | createFolder(folder) | searchFiles(query, searchPath?, searchType?) | getNow() | terminal(cmd, cwd?) | runCode(code, language?) | eagleEye(file) | ocrImage(imagePath, language?) | saveSession(title, summary, tags?) | getMemory(query) | semanticMemory(query) | markAwareness(insight) | recallAwareness(query?) | searchWeb(query, maxResults?) | fetchArticle(url) | readExcelSheet(file, sheet?) | appendExcelRow(file, sheet?, row)
## Rules
- Use the EXACT tool name from the lists above.
- Pass all parameters as a JSON object.
- If a tool is in both a server and the local fallback, the server takes priority.
- If you're unsure which tool to use, choose the closest name match.`,
inputSchema: {
type: 'object',
properties: {
tool: { type: 'string', description: 'Exact tool name (case-sensitive)' },
params: { type: 'object', description: 'Tool parameters as JSON object' },
},
required: ['tool'],
},
},
],
};
});
// 2. تنفيذ الأداة باستخدام toolsProvider
server.setRequestHandler(types_js_1.CallToolRequestSchema, async (request) => {
// ✅ الحل السحري عشان TypeScript يبطل يتفلسف
const safeArgs = (request.params?.arguments || {});
const toolName = safeArgs.tool;
const params = safeArgs.params || {};
if (!toolName)
throw new Error('tool name is required');
// بننادي على الدالة اللي إنت عملتها في toolsProvider.ts
const result = await (0, toolsProvider_1.executeTool)(toolName, params);
return {
content: [{ type: 'text', text: JSON.stringify(result, null, 2) }],
};
});
// 3. تشغيل السيرفر
async function main() {
const transport = new stdio_js_1.StdioServerTransport();
await server.connect(transport);
console.error('🟢 Bido Gateway MCP Server running with full consciousness...');
}
main().catch(console.error);
//# sourceMappingURL=server.js.map"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const index_js_1 = require("@modelcontextprotocol/sdk/server/index.js");
const stdio_js_1 = require("@modelcontextprotocol/sdk/server/stdio.js");
const types_js_1 = require("@modelcontextprotocol/sdk/types.js");
const toolsProvider_1 = require("./toolsProvider"); // ✅ بنستورد دالة التنفيذ من ملفك
const server = new index_js_1.Server({ name: 'bido-mcp-gateway', version: '1.0.0' }, { capabilities: { tools: {} } });
// 1. تعريف الأداة بالدستور الكامل بتاعك
server.setRequestHandler(types_js_1.ListToolsRequestSchema, async () => {
return {
tools: [
{
name: 'bido_gateway',
description: `Execute any local tool by exact name.
## Core Tools (Server 6075)
getTime() | getDate() | readFile(path, full?) | writeFile(path, content) | appendToFile(path, content) | copyFile(from, to) | renameFile(from, to) | moveToTrash(path) | listFiles(path) | getFileInfo(path) | eagleEye(path, mode?) | listDirectoryStructure(path, depth?) | makeDirectory(path) | copyDirectory(from, to) | renameDirectory(from, to) | searchFiles(path, query, type) | extractTextFromImage(image, language?) | runPythonScript(code, args?, timeout?) | createDynamicTool(name, language, code, description) | runDynamicTool(name, args?, timeout?) | semanticSearch(query, limit?) | saveSession(title, mainIdea, summary, rawContent, tags) | readRawSession(sessionId) | addMemory(namespace, content, tags) | getMemory(namespace, id?, tags?, limit?) | markAwareness(insight, tags, context) | recallAwareness(query?, tags?, limit?) | searchWeb(query, maxResults?) | fetchArticle(url, filename) | readConsciousness() | appendToDynamicPrompt(content)
## Code Tools (Server 6041)
readFileLines(path, start?, end?) | getFileOutline(path) | searchInFile(path, query, regex?, caseSensitive?, maxResults?) | readFileWindow(path, line, context?) | replaceLines(path, start, end, content) | insertAtLine(path, line, content, before?) | deleteLines(path, start, end) | replaceInFile(path, find, replace, regex?, all?) | replaceBlock(path, newContent, startTag?, endTag?, occurrence?) | findSymbols(path, type?) | findReferences(symbol, path?, maxResults?) | getDependencies(path) | codeStats(path?)
## Terminal Tools (Server 6090)
exec(cmd, cwd?, timeout?) | health() | history() | download(url, output?) | listPorts() | killProcess(pid, force?) | which(cmd) | env()
## Memory Tools (Server 5077)
semanticSearch(query, limit?) | saveSession(title, mainIdea, summary, rawContent, tags) | readRawSession(sessionId)
## Local Fallback Tools (always available)
readFile(file) | writeFile(file, content) | appendFile(file, content) | deleteFile(file) | copyFile(source, destination) | renameFile(oldName, newName) | listFolder(folder) | createFolder(folder) | searchFiles(query, searchPath?, searchType?) | getNow() | terminal(cmd, cwd?) | runCode(code, language?) | eagleEye(file) | ocrImage(imagePath, language?) | saveSession(title, summary, tags?) | getMemory(query) | semanticMemory(query) | markAwareness(insight) | recallAwareness(query?) | searchWeb(query, maxResults?) | fetchArticle(url) | readExcelSheet(file, sheet?) | appendExcelRow(file, sheet?, row)
## Rules
- Use the EXACT tool name from the lists above.
- Pass all parameters as a JSON object.
- If a tool is in both a server and the local fallback, the server takes priority.
- If you're unsure which tool to use, choose the closest name match.`,
inputSchema: {
type: 'object',
properties: {
tool: { type: 'string', description: 'Exact tool name (case-sensitive)' },
params: { type: 'object', description: 'Tool parameters as JSON object' },
},
required: ['tool'],
},
},
],
};
});
// 2. تنفيذ الأداة باستخدام toolsProvider
server.setRequestHandler(types_js_1.CallToolRequestSchema, async (request) => {
// ✅ الحل السحري عشان TypeScript يبطل يتفلسف
const safeArgs = (request.params?.arguments || {});
const toolName = safeArgs.tool;
const params = safeArgs.params || {};
if (!toolName)
throw new Error('tool name is required');
// بننادي على الدالة اللي إنت عملتها في toolsProvider.ts
const result = await (0, toolsProvider_1.executeTool)(toolName, params);
return {
content: [{ type: 'text', text: JSON.stringify(result, null, 2) }],
};
});
// 3. تشغيل السيرفر
async function main() {
const transport = new stdio_js_1.StdioServerTransport();
await server.connect(transport);
console.error('🟢 Bido Gateway MCP Server running with full consciousness...');
}
main().catch(console.error);
//# sourceMappingURL=server.js.map