@crazyrabbitltc/railway-mcp
Version:
Railway MCP Server - 146+ tools with 100% Railway API coverage, comprehensive MCP testing framework, and real infrastructure management through AI assistants. Enhanced version with enterprise features, based on original work by Jason Tan.
128 lines (127 loc) • 4.48 kB
JavaScript
import { z } from "zod";
/**
* NOTE: ALL NON-METAL RAILWAY REGIONS -- TODO: Update when they've fully migrated to metal 🔄
*/
export const RegionCodeSchema = z.enum([
"asia-southeast1",
"asia-southeast1-eqsg3a",
"europe-west4",
"europe-west4-drams3a",
"us-east4",
"us-east4-eqdc4a",
"us-west1",
"us-west2"
]);
export const ServiceInstanceSchema = z.object({
id: z.string(),
serviceId: z.string(),
serviceName: z.string(),
environmentId: z.string(),
buildCommand: z.string().optional(),
startCommand: z.string().optional(),
rootDirectory: z.string().optional(),
region: RegionCodeSchema.optional(),
healthcheckPath: z.string().optional(),
sleepApplication: z.boolean().optional(),
numReplicas: z.number().optional(),
domains: z.object({
serviceDomains: z.array(z.object({
domain: z.string(),
})),
}),
source: z.object({
image: z.string().optional(),
repo: z.string().optional(),
branch: z.string().optional(),
}).optional(),
upstreamUrl: z.string().optional(),
});
// All supported database types
export const DatabaseType = {
PostgreSQL: 'postgresql',
MySQL: 'mysql',
Redis: 'redis',
MongoDB: 'mongodb',
// MariaDB: 'mariadb',
// SQLite: 'sqlite',
// ElasticSearch: 'elasticsearch',
// CockroachDB: 'cockroachdb',
// Cassandra: 'cassandra',
// Neo4j: 'neo4j',
// InfluxDB: 'influxdb',
// Prometheus: 'prometheus',
// Grafana: 'grafana',
// RabbitMQ: 'rabbitmq',
// Kafka: 'kafka',
// Memcached: 'memcached',
// Etcd: 'etcd',
// Consul: 'consul',
// Vault: 'vault'
};
export const DATABASE_CONFIGS = {
[]: {
name: 'PostgreSQL',
type: DatabaseType.PostgreSQL,
category: 'TRADITIONAL',
description: 'Advanced open-source relational database with JSON support',
connectionStringPattern: 'postgresql://${{PGUSER}}:${{PGPASSWORD}}@${{PGHOST}}:${{PGPORT}}/${{PGDATABASE}}',
defaultPort: 5432,
variables: ['PGUSER', 'PGPASSWORD', 'PGHOST', 'PGPORT', 'PGDATABASE', 'DATABASE_URL', 'POSTGRES_USER', 'POSTGRES_PASSWORD', 'POSTGRES_DB'],
defaultUser: 'postgres',
defaultDatabase: 'railway',
requiresPassword: true,
imageName: 'postgres',
volumePath: '/var/lib/postgresql/data',
port: 5432,
defaultName: 'postgres',
source: 'postgresql'
},
[]: {
name: 'MySQL',
type: DatabaseType.MySQL,
category: 'TRADITIONAL',
description: 'Popular open-source relational database',
connectionStringPattern: 'mysql://${{MYSQL_USER}}:${{MYSQL_PASSWORD}}@${{MYSQL_HOST}}:${{MYSQL_PORT}}/${{MYSQL_DATABASE}}',
defaultPort: 3306,
variables: ['MYSQL_USER', 'MYSQL_PASSWORD', 'MYSQL_HOST', 'MYSQL_PORT', 'MYSQL_DATABASE', 'MYSQL_ROOT_PASSWORD'],
defaultUser: 'root',
defaultDatabase: 'railway',
requiresPassword: true,
imageName: 'mysql',
volumePath: '/var/lib/mysql',
port: 3306,
defaultName: 'mysql',
source: 'mysql'
},
[]: {
name: 'Redis',
type: DatabaseType.Redis,
category: 'CACHE',
description: 'In-memory data structure store and cache',
connectionStringPattern: 'redis://:${{REDIS_PASSWORD}}@${{REDIS_HOST}}:${{REDIS_PORT}}',
defaultPort: 6379,
variables: ['REDIS_URL', 'REDIS_HOST', 'REDIS_PORT', 'REDIS_PASSWORD'],
requiresPassword: true,
imageName: 'redis',
startCommand: 'redis-server --requirepass ${{REDIS_PASSWORD}}',
port: 6379,
defaultName: 'redis',
source: 'redis'
},
[]: {
name: 'MongoDB',
type: DatabaseType.MongoDB,
category: 'MODERN',
description: 'Document-oriented NoSQL database',
connectionStringPattern: 'mongodb://${{MONGO_INITDB_ROOT_USERNAME}}:${{MONGO_INITDB_ROOT_PASSWORD}}@${{MONGO_HOST}}:${{MONGO_PORT}}',
defaultPort: 27017,
variables: ['MONGO_URL', 'MONGO_HOST', 'MONGO_PORT', 'MONGO_INITDB_ROOT_USERNAME', 'MONGO_INITDB_ROOT_PASSWORD'],
defaultUser: 'root',
requiresPassword: true,
imageName: 'mongo',
volumePath: '/data/db',
port: 27017,
defaultName: 'mongo',
source: 'mongodb'
}
};