How zandko/mcp-use works
Project type and purpose
• This is a TypeScript/Node.js client library (“Unified MCP Client Library”) for connecting any LLM (via LangChain.js) to any MCP server. It provides abstractions (agents, adapters, connectors, task managers) to let you build custom tool‑enabled agents without closed‑source dependencies.
File structure
• Top‑level entrypoints:
• index.ts – re‑exports public API
• src/client.ts – MCPClient implementation
• src/agents/MCPAgent.ts – agent orchestration
• src/config.ts – configuration loader
• Core folders under src/:
• adapters/ – Adapter pattern to convert between LangChain and MCP
• agents/ – Base agent, prompts, and server manager logic
• connectors/ – Pluggable transports (HTTP, WebSocket, STDIO)
• task_managers/ – Stream managers matching connectors (SSE, WS, STDIO)
• session.ts – Session context and state
• logging.ts – Unified logging interface
• Config, tsconfig, build scripts, and GitHub CI workflows indicate a published npm package.
README for additional insights
• Purpose: “open‑source way to connect any LLM to any MCP server”
• Key features: multi‑server support, tool restrictions, dynamic server selection
• Usage flow: configure MCPClient → wrap an LLM → instantiate MCPAgent → run queries
Final advice
• How configuration, logging, and session wrap around the core flow
• Don’t over‑simplify: detail adapters, connectors, and task managers as first‑class components