Gatana Documentation

Hosted Servers

Hosted servers is source-code that Gatana runs for you and exposes as tools

Introduction

Hosted servers similar to local servers, the difference is that instead of starting a downloaded application, Gatana runs provided the source-code. Currently supported runtimes are:

  • Node.js 24

Writing Source Code

There are three methods to upload your source code:

  • Directly in the editor: You can edit files directly in the embedded code editor above. Changes are saved and deployed when you click the "Deploy" button.
  • Upload ZIP archive: Prepare a ZIP file containing your source code and upload it using the "Upload Archive" button. This will replace the existing code with the contents of the ZIP file.
  • Gatana CLI: Use our command line tool to upload and manage your function's source code. See the GitHub repository for the CLI tool for details.
    npm install -g gatana
    gatana hosted deploy --id FUNCTION_ID .

Javascript Quick Start

Below is an example for a simple server which exposes two tools.

import z from 'zod';

export const schema = {
    whoami: {
        description: 'returns HTTP headers',
    },
    add: {
        description: 'adds two numbers',
        input: z.object({
            a: z.number(),
            b: z.number(),
        })
    },
};
export function whoami(args, credentials) {
    return JSON.stringify(credentials)
}
export function add({ a, b } = params) {
    return String(a + b + 10)
}

Structure

Your source-code package needs this basic structure:

index.js: This file must exist in the root of your source-code package and must contain at least the following:

export const schema = {} // This is the minimum required

To add tools, expand the schema object:

export const schema = {
    helloworld: {
        description: 'returns hello world',
    },
};
export function helloworld(args, credentials) {
    return 'Hello World'
}

Each tool will be provided with two arguments:

The args argument is an object containing the arguments passed to the tool.

The credentials argument is an object containing the credentials information. If OAuth authorization method is configured, this is the structure:

{
  headers: {
    authorization: 'Bearer OAUTH_ACCESS_TOKEN'
  }
}

Environment Variables

The environment variables you configure in the Server Settings will be available in the process.env object.

Credentials accessed using these expressions:

  • API Keys: {{ credentials.keys.MY_API_KEY }}

Package Management (npm)

You can use npm to manage your packages. Run npm install to install dependencies and make sure your node_modules folder is part of the code package.

Deployment and Output Logs

When you create, update a server, or upload a new source-package, Gatana will automatically deploy the server. You can click on Deployment logs in the Gatana App to see the status of the current revision deployment.

The output logs can be viewed in the server details view, under the Server Logs section. In the dropdown, select a revision, and the browser will begin stream the logs to your browser.

Environment and Isolation

The operating system is Debian Bookworm. Each hosted server is being executed in an containerized environment using containerd and gVisor, which provides a strong layer of security and isolation.