Skip to main content
Glama
jdlar1

Siigo MCP Server

by jdlar1

siigo_create_invoice

Generate invoices in Siigo accounting software by providing customer details, items, payments, and required documentation.

Instructions

Create a new invoice

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
invoiceYesInvoice data

Implementation Reference

  • Core handler implementation for creating an invoice via POST to Siigo API /v1/invoices endpoint.
    async createInvoice(invoice: SiigoInvoice): Promise<SiigoApiResponse<SiigoInvoice>> {
      return this.makeRequest<SiigoInvoice>('POST', '/v1/invoices', invoice);
    }
  • MCP server handler that receives tool call params and delegates to SiigoClient.createInvoice, formats response.
    private async handleCreateInvoice(args: any) {
      const result = await this.siigoClient.createInvoice(args.invoice);
      return {
        content: [
          {
            type: 'text',
            text: JSON.stringify(result, null, 2),
          },
        ],
      };
  • src/index.ts:374-396 (registration)
    Tool registration in MCP server's getTools() method, including name, description, and detailed input schema.
    {
      name: 'siigo_create_invoice',
      description: 'Create a new invoice',
      inputSchema: {
        type: 'object',
        properties: {
          invoice: {
            type: 'object',
            description: 'Invoice data',
            properties: {
              document: { type: 'object', properties: { id: { type: 'number' } }, required: ['id'] },
              date: { type: 'string', description: 'Invoice date (YYYY-MM-DD)' },
              customer: { type: 'object', description: 'Customer information' },
              seller: { type: 'number', description: 'Seller ID' },
              items: { type: 'array', items: { type: 'object' }, description: 'Invoice items' },
              payments: { type: 'array', items: { type: 'object' }, description: 'Payment methods' },
            },
            required: ['document', 'date', 'customer', 'seller', 'items', 'payments'],
          },
        },
        required: ['invoice'],
      },
    },
  • TypeScript interface defining the structure of SiigoInvoice used for input validation and API calls.
    export interface SiigoInvoice {
      id?: string;
      document: {
        id: number;
        number?: number;
      };
      date: string;
      customer: {
        person_type?: string;
        id_type?: string;
        identification: string;
        branch_office?: number;
        name?: string[];
        address?: any;
        phones?: any[];
        contacts?: any[];
      };
      cost_center?: number;
      currency?: {
        code: string;
        exchange_rate: number;
      };
      seller: number;
      observations?: string;
      items: Array<{
        code: string;
        description?: string;
        quantity: number;
        price: number;
        discount?: number;
        taxes?: Array<{ id: number }>;
      }>;
      payments: Array<{
        id: number;
        value: number;
        due_date?: string;
      }>;
      stamp?: {
        send: boolean;
      };
      mail?: {
        send: boolean;
      };
      global_discounts?: Array<{
        id: number;
        percentage?: number;
        value?: number;
      }>;
      additional_fields?: any;
    }
  • Helper method for making authenticated HTTP requests to Siigo API, used by createInvoice and all other endpoints.
    private async makeRequest<T>(method: string, endpoint: string, data?: any, params?: any): Promise<SiigoApiResponse<T>> {
      await this.authenticate();
    
      try {
        const response: AxiosResponse<SiigoApiResponse<T>> = await this.httpClient.request({
          method,
          url: endpoint,
          data,
          params,
        });
    
        return response.data;
      } catch (error: any) {
        if (error.response?.data) {
          return error.response.data;
        }
        throw new Error(`API request failed: ${error.message}`);
      }
    }

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/jdlar1/siigo-mcp'

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