Skip to main content
Glama
AaroYazilim

AARO ERP MCP Server

by AaroYazilim

erp_stok_olustur

Create new stock items in the ERP system through the MCP server. Input required details like stock code and name to generate stock records and provide a direct link for user access.

Instructions

ERP sisteminde yeni stok kartı oluşturur. oluşturduktan sonra https://erp.aaro.com.tr/Stok/Kalem?id={id} kullanıcıya bu linki sunabilir

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
Brm1IDNoBirim ID (varsayılan: 1 - Adet)
DurumNoAktif/Pasif durumu (varsayılan: true)
SirketIDNoŞirket ID (varsayılan: 1)
StokAdiYesStok adı (zorunlu)
StokKisaAdiNoStok kısa adı
StokKisaKoduNoStok kısa kodu
StokKoduYesStok kodu (zorunlu)
StokMuhasebeIDNoMuhasebe ID
SubeIDNoŞube ID (varsayılan: 1)
TipIDNoStok tipi (varsayılan: 105001)

Implementation Reference

  • The core handler function `createStok` that implements the logic for creating a new stock (stok olustur) in the ERP system. It validates required fields, prepares the stock data object with defaults, and calls the ERP API `/api/Stok` POST endpoint to create the record. This is dispatched for the tool named 'erp_stok_olustur' via its config handler mapping.
    private async createStok(args: any) { const { StokKodu, StokAdi, StokKisaKodu, StokKisaAdi, TipID, SubeID, SirketID, Brm1ID, StokMuhasebeID, Durum, ...otherParams } = args; if (!StokKodu || !StokAdi) { throw new Error('StokKodu ve StokAdi gerekli'); } const stokData = { StokID: -1, // Yeni kayıt için -1 StokKodu, StokAdi, StokKisaKodu: StokKisaKodu || StokKodu, StokKisaAdi: StokKisaAdi || StokAdi, TipID: TipID || '105001', // Varsayılan stok tipi SubeID: SubeID || '1', SirketID: SirketID || '1', Brm1ID: Brm1ID || '1', // Varsayılan birim: Adet StokMuhasebeID: StokMuhasebeID || '201', Durum: Durum !== undefined ? Durum : true, ...otherParams }; return await this.callErpApi('/api/Stok', 'POST', { KayitTipi: '1', // Yeni kayıt body: stokData }); }
  • src/index.ts:176-216 (registration)
    The MCP tool call request handler registration. Dynamically handles calls to any tool by name from toolsConfig (config/tools.json). For 'erp_stok_olustur', it looks up config, sees handler:'createStok', and dispatches to callSpecialHandler.
    this.server.setRequestHandler(CallToolRequestSchema, async (request) => { const { name, arguments: args } = request.params; try { const toolConfig = this.toolsConfig[name]; if (!toolConfig) { throw new McpError(ErrorCode.MethodNotFound, `Bilinmeyen araç: ${name}`); } // Request bilgilerini logla this.log(`Tool çağrısı: ${name}`, 'info', { tool: name, params: args }); // Özel handler varsa onu kullan if (toolConfig.handler) { return await this.callSpecialHandler(toolConfig.handler, args); } // Normal API çağrısı if (toolConfig.endpoint && toolConfig.method) { return await this.callErpApi(toolConfig.endpoint, toolConfig.method as 'GET' | 'POST', args); } throw new McpError(ErrorCode.InternalError, `Tool konfigürasyonu eksik: ${name}`); } catch (error) { this.log(`Tool hatası: ${name}`, 'error', error); return { content: [ { type: 'text', text: `Hata: ${error instanceof Error ? error.message : 'Bilinmeyen hata'}`, }, ], isError: true, }; } }); }
  • The special handler dispatcher that routes to specific implementations based on handlerName from tool config. Includes the case for 'createStok' which calls the stok creation logic.
    private async callSpecialHandler(handlerName: string, args: any) { switch (handlerName) { case 'getErpToken': if (!isValidErpTokenArgs(args)) { throw new McpError(ErrorCode.InvalidParams, 'Geçersiz ERP token parametreleri'); } const token = await this.getErpToken(args.password); return { content: [{ type: 'text', text: `ERP Token başarıyla alındı: ${token}` }], }; case 'deleteToken': return await this.deleteToken(); case 'addManualToken': return await this.addManualToken(args); case 'createStok': return await this.createStok(args); case 'createCari': return await this.createCari(args); case 'createDekont': return await this.createDekont(args); case 'addDekontKalem': return await this.addDekontKalem(args); case 'updateDekont': return await this.updateDekont(args); case 'testWebhook': return await this.testWebhook(args); case 'callErpApi': if (!isValidErpApiArgs(args)) { throw new McpError(ErrorCode.InvalidParams, 'Geçersiz API çağrı parametreleri'); } return await this.callErpApi(args.endpoint!, args.method || 'GET', args); default: throw new McpError(ErrorCode.MethodNotFound, `Bilinmeyen handler: ${handlerName}`); } }
  • src/index.ts:166-174 (registration)
    Registers the list tools handler which dynamically exposes all tools from toolsConfig including 'erp_stok_olustur' with its schema and description.
    this.server.setRequestHandler(ListToolsRequestSchema, async () => { const tools = Object.entries(this.toolsConfig).map(([name, config]) => ({ name, description: config.description, inputSchema: config.inputSchema, })); return { tools }; });
  • Uses the generic ERP API caller within the createStok handler to POST to /api/Stok for stock creation.
    return await this.callErpApi('/api/Stok', 'POST', { KayitTipi: '1', // Yeni kayıt body: stokData }); }

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/AaroYazilim/aaro-erp-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server