Skip to content

Commit

Permalink
feat: add custom runtime type with command and args fields
Browse files Browse the repository at this point in the history
- Add 'custom' as valid runtime type
- Add required command and args fields for custom runtime
- Update validation in pr-check.js
- Add custom runtime support in ConfigManager
- Update type definitions and interfaces

Co-Authored-By: Michael Latman <[email protected]>
  • Loading branch information
devin-ai-integration[bot] and michaellatman committed Dec 12, 2024
1 parent b0acc35 commit 5779774
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 3 deletions.
6 changes: 5 additions & 1 deletion src/scripts/pr-check.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const octokit = new Octokit({
});

const REQUIRED_FIELDS = ['name', 'description', 'vendor', 'sourceUrl', 'homepage', 'license', 'runtime'];
const VALID_RUNTIMES = ['node', 'python'];
const VALID_RUNTIMES = ['node', 'python', 'custom'];

async function validatePackages() {
const packageListPath = path.join(__dirname, '../../packages/package-list.json');
Expand Down Expand Up @@ -110,6 +110,10 @@ export function validateRuntime(pkg) {
if (!VALID_RUNTIMES.includes(pkg.runtime)) {
throw new Error(`Package ${pkg.name} has invalid runtime: ${pkg.runtime}. Must be one of: ${VALID_RUNTIMES.join(', ')}`);
}

if (pkg.runtime === 'custom' && (!pkg.command || !pkg.args)) {
throw new Error(`Package ${pkg.name} with custom runtime must include both 'command' and 'args' fields`);
}
}

async function validatePackagePublication(pkg) {
Expand Down
4 changes: 3 additions & 1 deletion src/types/package.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
export interface Package {
name: string;
description: string;
runtime: 'node' | 'python';
runtime: 'node' | 'python' | 'custom';
vendor: string;
sourceUrl: string;
homepage: string;
license: string;
command?: string; // Required when runtime is 'custom'
args?: string[]; // Required when runtime is 'custom'
}

export interface ResolvedPackage extends Package {
Expand Down
8 changes: 7 additions & 1 deletion src/utils/config-manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import os from 'os';
import { Package } from '../types/package.js';

export interface MCPServer {
runtime: 'node' | 'python';
runtime: 'node' | 'python' | 'custom';
command?: string;
args?: string[];
env?: Record<string, string>;
Expand Down Expand Up @@ -119,6 +119,12 @@ export class ConfigManager {
} else if (pkg.runtime === 'python') {
serverConfig.command = 'uvx';
serverConfig.args = [pkg.name];
} else if (pkg.runtime === 'custom') {
if (!pkg.command || !pkg.args) {
throw new Error('Custom runtime requires both command and args fields');
}
serverConfig.command = pkg.command;
serverConfig.args = pkg.args;
}

config.mcpServers[serverName] = serverConfig;
Expand Down

0 comments on commit 5779774

Please sign in to comment.