Files
cobble/src/harness/mcp/grab-mcp-dir.ts
T
tbenandClaude Opus 5.5 c6ec7d77a2 Add MCP servers and custom tools for bots
Two new settings pages, MCPs and Tools. Super admins define them; super
admins and admins attach them to bots, to workspaces (every bot there),
or to every bot. Bots get them in chat replies and tasks.

- Custom tools: a JSON-schema of arguments plus an HTTP request, a script
  on the bot's computer, or a prompt, templated with {{args.x}} and
  {{env.KEY}}, secrets redacted from results.
- MCP servers: remote (URL and headers) or stdio commands run on the host
  with a setup command and an isolated env, in a per-process pool. Tools
  are listed into a cache and connect on first call.
- Add, edit, access and try open in modals.
- Markdown, JSON and command fields use twui's AceEditor (CodeEditor),
  its scripts loaded on demand.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-19 15:01:39 +01:00

23 lines
661 B
TypeScript

import { mkdir } from "fs/promises";
import path from "path";
import { AppData } from "@/src/data/app-data";
import grabDirNames from "@/src/utils/grab-dir-names";
type Params = {
server_id: number | string;
};
/**
* Where a stdio MCP server runs and its setup installs:
* `DATA_DIR/<AppData.McpDataDir>/<id>`, created when missing. On the data
* volume in production, so installs survive app updates.
*/
export default async function grabMcpDir({ server_id }: Params) {
const { DATA_DIR } = grabDirNames();
const dir = path.join(DATA_DIR, AppData.McpDataDir, String(server_id));
await mkdir(dir, { recursive: true });
return dir;
}