Filesystem MCP server in LangChain local files, loaded as agent tools.
Give a LangChain agent read, write, and search access to local files through the mcp-server-filesystem MCP server. There's no config file to edit — you wire it up in a few lines of Python with langchain-mcp-adapters.
mcp-server-filesystem is an npm-distributed MCP server that lets an agent read, write, and search files on the local machine. It ships from the ByteDance UI-TARS repo (github.com/bytedance/ui-tars-desktop, 36.3k stars) and runs over stdio, which makes it a natural fit for a LangChain agent running on the same box.
LangChain doesn't use a JSON config file the way desktop clients do. MCP servers are declared in code: you install langchain-mcp-adapters, describe the server's launch command to MultiServerMCPClient, and the client converts every MCP tool into a LangChain tool your agent can call.
What the agent gets
Once connected, your agent can list directories, read file contents, write or edit files, and search across the directories you expose. That turns common LangChain patterns — summarize this folder of reports, refactor these configs, build an index of project docs — into single tool calls instead of custom glue code.
Because the server runs as a subprocess of your Python process, file access happens with your local user's permissions. Scope it deliberately: pass only the directories the agent should touch.
Declare the server in code
Install the adapter package with pip install langchain-mcp-adapters, then instantiate MultiServerMCPClient with the npx launch command. The trailing path argument is the directory the server is allowed to operate in — replace it with your own, and check the README in the UI-TARS repo for the full flag list.
# pip install langchain-mcp-adapters langgraph
from langchain_mcp_adapters.client import MultiServerMCPClient
from langgraph.prebuilt import create_react_agent
client = MultiServerMCPClient({
"filesystem": {
"transport": "stdio",
"command": "npx",
"args": ["-y", "mcp-server-filesystem", "/Users/you/projects"],
}
})
tools = await client.get_tools()
agent = create_react_agent("anthropic:claude-sonnet-4-5", tools)Verify the tools loaded
Print the result of get_tools() before handing it to an agent. You should see the filesystem operations listed with their schemas. If the list is empty, the subprocess almost certainly failed to start — the adapter surfaces stderr from the server process, so run your script in a terminal where you can see it.
Troubleshooting in LangChain
There's no app to restart here — every run launches the server fresh, so most failures are environmental. The usual suspects: Node.js isn't installed or npx isn't on the PATH of the environment running Python (a common surprise inside Docker or a systemd service); the -y flag is missing, so npx blocks waiting for an install prompt that never gets answered; or the directory argument doesn't exist, so the server exits immediately.
Transport mismatches bite too. mcp-server-filesystem speaks stdio — if you set transport to streamable_http or sse, the client will try to reach a URL that isn't there. And remember get_tools() is a coroutine: call it with await inside an async function, not at module top level.
The live listing
mcp-server-filesystem has a live listing on the Loomal marketplace at https://loomal.ai/marketplace/mcp-server-filesystem, where you can see its probed tool list before wiring it into an agent. If you maintain a server like this one, claiming the listing lets you publish its tool list and, if you choose, price calls for paying agents.
FAQ
How do I install the Filesystem server in LangChain?
Install langchain-mcp-adapters with pip, then create a MultiServerMCPClient that launches npx -y mcp-server-filesystem with a directory argument over stdio transport. Call get_tools() and pass the result to your agent — the MCP tools become ordinary LangChain tools.
Where is LangChain's MCP config file?
There isn't one. Unlike Claude Desktop or Cursor, LangChain declares MCP servers in Python or JS code via the langchain-mcp-adapters package, so your server definitions live next to your agent code and version-control cleanly.
Why does get_tools() return nothing?
The server subprocess failed to launch. Check that Node.js is installed in the environment running your script, that the args include -y so npx doesn't block on a prompt, and that the directory you passed actually exists. The server's stderr is your best diagnostic.
Can I restrict which directories the agent can touch?
Yes — the directory paths you pass as arguments define the server's reachable scope. Pass only what the agent needs, and check the project README on GitHub for the exact flags the current version supports.
Browse more MCP servers for LangChain.
Every listing on Loomal shows a live-probed tool list.