mirror of
https://github.com/rowboatlabs/rowboat.git
synced 2026-04-26 00:46:23 +02:00
First version copilot:
- basic llm call that can perform CRUD actions over dummy workflow json files
This commit is contained in:
parent
055dda35b9
commit
4310b1d45d
11 changed files with 327 additions and 4 deletions
24
apps/cli/src/application/assistant/mcp/service.ts
Normal file
24
apps/cli/src/application/assistant/mcp/service.ts
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
import fs from "fs";
|
||||
import path from "path";
|
||||
import { z } from "zod";
|
||||
import { McpServerConfig } from "../../entities/mcp.js";
|
||||
import { ensureBaseDirs, getStoragePaths } from "../services/storage.js";
|
||||
|
||||
export function mcpConfigPath(): string {
|
||||
const base = getStoragePaths();
|
||||
ensureBaseDirs(base);
|
||||
return path.join(base.workDir, "mcp", "servers.json");
|
||||
}
|
||||
|
||||
export function readMcpConfig(): z.infer<typeof McpServerConfig> {
|
||||
const p = mcpConfigPath();
|
||||
if (!fs.existsSync(p)) return { mcpServers: [] };
|
||||
const raw = fs.readFileSync(p, "utf8");
|
||||
return McpServerConfig.parse(JSON.parse(raw));
|
||||
}
|
||||
|
||||
export function writeMcpConfig(value: z.infer<typeof McpServerConfig>): void {
|
||||
const p = mcpConfigPath();
|
||||
const parsed = McpServerConfig.parse(value);
|
||||
fs.writeFileSync(p, JSON.stringify(parsed, null, 2) + "\n", "utf8");
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue