-
Notifications
You must be signed in to change notification settings - Fork 27
/
Copy pathmcp_over_docker_example.ts
40 lines (36 loc) · 1.11 KB
/
mcp_over_docker_example.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
/**
* Filesystem MCP Server with LangGraph Example
*
* This example demonstrates how to use the Filesystem MCP server with LangGraph
* to create a structured workflow for complex file operations.
*
* The graph-based approach allows:
* 1. Clear separation of responsibilities (reasoning vs execution)
* 2. Conditional routing based on file operation types
* 3. Structured handling of complex multi-file operations
*/
/* eslint-disable no-console */
import { MultiServerMCPClient } from "../src/index.js";
import { runExample as runFileSystemExample } from "./filesystem_langgraph_example.js";
async function runExample() {
const client = new MultiServerMCPClient({
filesystem: {
transport: "stdio",
command: "docker",
args: [
"run",
"-i",
"--rm",
"-v",
"mcp-filesystem-data:/projects",
"mcp/filesystem",
"/projects",
],
},
});
await runFileSystemExample(client);
}
const isMainModule = import.meta.url === `file://${process.argv[1]}`;
if (isMainModule) {
runExample().catch((error) => console.error("Setup error:", error));
}