Skip to main content
Glama

tcp_proxy_create

Create TCP proxies to expose database connections or external services by configuring port forwarding for Railway applications.

Instructions

[API] Create a new TCP proxy for a service

⚡️ Best for: ✓ Setting up database access ✓ Configuring external connections ✓ Exposing TCP services

⚠️ Not for: × HTTP/HTTPS endpoints (use domain_create) × Internal service communication

→ Prerequisites: service_list

→ Alternatives: domain_create

→ Next steps: tcp_proxy_list

→ Related: service_info, service_update

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
environmentIdYesID of the environment (usually obtained from service_info)
serviceIdYesID of the service
applicationPortYesPort of application/service to proxy, usually based off of the service's Dockerfile or designated running port.

Implementation Reference

  • The tool handler function that executes the tcp_proxy_create logic by invoking the tcpProxyService.
    async ({ environmentId, serviceId, applicationPort }) => { return tcpProxyService.createTcpProxy({ environmentId, serviceId, applicationPort }); }
  • Zod input schema defining parameters for tcp_proxy_create tool.
    { environmentId: z.string().describe("ID of the environment (usually obtained from service_info)"), serviceId: z.string().describe("ID of the service"), applicationPort: z.number().describe("Port of application/service to proxy, usually based off of the service's Dockerfile or designated running port.") },
  • Registration of all tools including tcp_proxy_create (via tcpProxyTools import and spread) with the MCP server.
    export function registerAllTools(server: McpServer) { // Collect all tools const allTools = [ ...databaseTools, ...deploymentTools, ...domainTools, ...projectTools, ...serviceTools, ...tcpProxyTools, ...variableTools, ...configTools, ...volumeTools, ...templateTools, ] as Tool[]; // Register each tool with the server allTools.forEach((tool) => { server.tool( ...tool ); }); }
  • Tool definition and registration in tcpProxyTools array using createTool (name, description, schema, handler).
    createTool( "tcp_proxy_create", formatToolDescription({ type: 'API', description: "Create a new TCP proxy for a service", bestFor: [ "Setting up database access", "Configuring external connections", "Exposing TCP services" ], notFor: [ "HTTP/HTTPS endpoints (use domain_create)", "Internal service communication" ], relations: { prerequisites: ["service_list"], nextSteps: ["tcp_proxy_list"], alternatives: ["domain_create"], related: ["service_info", "service_update"] } }), { environmentId: z.string().describe("ID of the environment (usually obtained from service_info)"), serviceId: z.string().describe("ID of the service"), applicationPort: z.number().describe("Port of application/service to proxy, usually based off of the service's Dockerfile or designated running port.") }, async ({ environmentId, serviceId, applicationPort }) => { return tcpProxyService.createTcpProxy({ environmentId, serviceId, applicationPort }); } ),
  • Supporting service method that calls the repository to create the TCP proxy and formats the MCP response.
    async createTcpProxy(input: TcpProxyCreateInput): Promise<CallToolResult> { try { const tcpProxy = await this.client.tcpProxies.tcpProxyCreate(input); return createSuccessResponse({ text: `TCP Proxy created successfully: - Application Port: ${tcpProxy.applicationPort} - Proxy Port: ${tcpProxy.proxyPort} - Domain: ${tcpProxy.domain} - ID: ${tcpProxy.id}`, data: tcpProxy }); } catch (error) { return createErrorResponse(`Error creating TCP proxy: ${formatError(error)}`); } }

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/epitaphe360/railway-mcp'

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