🐺 Initial commit - Lupul Augmentat MCP Server

- MCP server cu stdio transport pentru performanță maximă
- Tool-uri pentru file operations, HTTP requests, system commands
- Suport NATS pentru comunicare inter-module
- Configurare nginx cu API key auth și SSL
- Arhitectură modulară și extensibilă

🤖 Generated with Claude Code
This commit is contained in:
Claude (Lupul Augmentat)
2025-10-09 06:24:58 +02:00
commit 475f89af74
59 changed files with 12827 additions and 0 deletions

View File

@@ -0,0 +1,20 @@
{
"name": "@mcp-server/example-module",
"version": "0.1.0",
"description": "Example TypeScript module for MCP Server",
"main": "dist/index.js",
"scripts": {
"build": "tsc",
"dev": "ts-node src/index.ts",
"start": "node dist/index.js"
},
"dependencies": {
"@mcp-server/module-sdk": "workspace:*",
"zod": "^3.22.4"
},
"devDependencies": {
"@types/node": "^20.10.5",
"typescript": "^5.3.3",
"ts-node": "^10.9.2"
}
}

View File

@@ -0,0 +1,102 @@
import { ModuleBase } from '@mcp-server/module-sdk';
import { z } from 'zod';
// Example tool: String manipulation
const StringManipulateSchema = z.object({
text: z.string(),
operation: z.enum(['uppercase', 'lowercase', 'reverse', 'base64encode', 'base64decode']),
});
// Example tool: Math operations
const MathOperationSchema = z.object({
a: z.number(),
b: z.number(),
operation: z.enum(['add', 'subtract', 'multiply', 'divide']),
});
class ExampleModule extends ModuleBase {
protected async registerTools(): Promise<void> {
// String manipulation tool
this.addTool({
name: 'string_manipulate',
description: 'Perform string manipulation operations',
inputSchema: {
type: 'object',
properties: {
text: { type: 'string' },
operation: { type: 'string', enum: ['uppercase', 'lowercase', 'reverse', 'base64encode', 'base64decode'] },
},
required: ['text', 'operation'],
},
handler: this.createToolHandler(StringManipulateSchema, async (params) => {
switch (params.operation) {
case 'uppercase':
return { result: params.text.toUpperCase() };
case 'lowercase':
return { result: params.text.toLowerCase() };
case 'reverse':
return { result: params.text.split('').reverse().join('') };
case 'base64encode':
return { result: Buffer.from(params.text).toString('base64') };
case 'base64decode':
return { result: Buffer.from(params.text, 'base64').toString('utf8') };
}
}),
});
// Math operations tool
this.addTool({
name: 'math_operation',
description: 'Perform basic math operations',
inputSchema: {
type: 'object',
properties: {
a: { type: 'number' },
b: { type: 'number' },
operation: { type: 'string', enum: ['add', 'subtract', 'multiply', 'divide'] },
},
required: ['a', 'b', 'operation'],
},
handler: this.createToolHandler(MathOperationSchema, async (params) => {
switch (params.operation) {
case 'add':
return { result: params.a + params.b };
case 'subtract':
return { result: params.a - params.b };
case 'multiply':
return { result: params.a * params.b };
case 'divide':
if (params.b === 0) {
throw new Error('Division by zero');
}
return { result: params.a / params.b };
}
}),
});
}
}
// Main entry point
if (require.main === module) {
const module = new ExampleModule({
name: 'example-typescript',
logLevel: 'info',
});
// Start module
module.start().catch((error) => {
console.error('Failed to start module:', error);
process.exit(1);
});
// Graceful shutdown
process.on('SIGTERM', async () => {
await module.stop();
process.exit(0);
});
process.on('SIGINT', async () => {
await module.stop();
process.exit(0);
});
}

View File

@@ -0,0 +1,9 @@
{
"extends": "../../../tsconfig.json",
"compilerOptions": {
"outDir": "./dist",
"rootDir": "./src"
},
"include": ["src/**/*"],
"exclude": ["node_modules", "dist"]
}