Skip to main content
Glama
Kong

Kong Konnect MCP Server

Official
by Kong

list_services

Retrieve and display all services configured within a specified Kong Konnect control plane, including details like host, port, protocol, and status.

Instructions

List all services associated with a control plane.

INPUT:

  • controlPlaneId: String - ID of the control plane

  • size: Number - Number of services to return (1-1000, default: 100)

  • offset: String (optional) - Pagination offset token from previous response

OUTPUT:

  • metadata: Object - Contains controlPlaneId, size, offset, nextOffset, totalCount

  • services: Array - List of services with details for each including:

    • serviceId: String - Unique identifier for the service

    • name: String - Display name of the service

    • host: String - Target host for the service

    • port: Number - Target port for the service

    • protocol: String - Protocol used (http, https, grpc, etc.)

    • path: String - Path prefix for the service

    • retries: Number - Number of retries on failure

    • connectTimeout: Number - Connection timeout in milliseconds

    • writeTimeout: Number - Write timeout in milliseconds

    • readTimeout: Number - Read timeout in milliseconds

    • tags: Array - Tags associated with the service

    • enabled: Boolean - Whether the service is enabled

    • metadata: Object - Creation and update timestamps

  • relatedTools: Array - List of related tools for further analysis

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
controlPlaneIdYesControl Plane ID (obtainable from list-control-planes tool)
sizeNoNumber of services to return
offsetNoOffset token for pagination (from previous response)

Implementation Reference

  • The main handler function that executes the list_services tool: calls the Kong API, transforms service data into a consistent format with metadata, and includes related tool suggestions.
    export async function listServices(
      api: KongApi,
      controlPlaneId: string,
      size = 100,
      offset?: string
    ) {
      try {
        const result = await api.listServices(controlPlaneId, size, offset);
    
        // Transform the response to have consistent field names
        return {
          metadata: {
            controlPlaneId: controlPlaneId,
            size: size,
            offset: offset || null,
            nextOffset: result.offset,
            totalCount: result.total
          },
          services: result.data.map((service: any) => ({
            serviceId: service.id,
            name: service.name,
            host: service.host,
            port: service.port,
            protocol: service.protocol,
            path: service.path,
            retries: service.retries,
            connectTimeout: service.connect_timeout,
            writeTimeout: service.write_timeout,
            readTimeout: service.read_timeout,
            tags: service.tags,
            clientCertificate: service.client_certificate,
            tlsVerify: service.tls_verify,
            tlsVerifyDepth: service.tls_verify_depth,
            caCertificates: service.ca_certificates,
            enabled: service.enabled,
            metadata: {
              createdAt: service.created_at,
              updatedAt: service.updated_at
            }
          })),
          relatedTools: [
            "Use list-routes to find routes that point to these services",
            "Use list-plugins to see plugins configured for these services"
          ]
        };
      } catch (error) {
        throw error;
      }
    }
  • Zod schema defining the input parameters for the list_services tool: controlPlaneId (required), size (default 100), offset (optional).
    export const listServicesParameters = () => z.object({
      controlPlaneId: z.string()
        .describe("Control Plane ID (obtainable from list-control-planes tool)"),
      size: z.number().int()
        .min(1).max(1000)
        .default(100)
        .describe("Number of services to return"),
      offset: z.string()
        .optional()
        .describe("Offset token for pagination (from previous response)"),
    });
  • src/tools.ts:35-41 (registration)
    Tool definition object in the tools() array that provides the metadata (method, name, description, parameters schema, category) used for MCP tool registration.
    {
      method: "list_services",
      name: "List Services",
      description: prompts.listServicesPrompt(),
      parameters: parameters.listServicesParameters(),
      category: "configuration"
    },
  • src/index.ts:74-81 (registration)
    Dispatch logic in the MCP tool handler switch statement that routes 'list_services' calls to the configuration.listServices handler with the API instance and parsed arguments.
    case "list_services":
      result = await configuration.listServices(
        this.api,
        args.controlPlaneId,
        args.size,
        args.offset
      );
      break;

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/Kong/mcp-konnect'

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