What runtime and dependencies are required?
Node.js (version 18 or higher), npm or yarn, and the globally installed package `@modelcontextprotocol/server-filesystem` are required. Ollama must be installed and running.
@ausboss
Basic information
A TypeScript example showcasing the integration of Ollama with the Model Context Protocol (MCP), specifically the Filesystem MCP Server. This project provides an interactive command-line interface for an AI agent that can utilize filesystem tools.
Add this server to your MCP-compatible client using the configuration below.
{
"mcpServers": {
"filesystem": {
"command": "npx",
"args": [
"@modelcontextprotocol/server-filesystem",
"./"
]
}
}
}Read the complete contents of a file as text. DEPRECATED: Use read_text_file instead.
Read the complete contents of a file from the file system as text. Handles various text encodings and provides detailed error messages if the file cannot be read. Use this tool when you need to examine the contents of a single file. Use the 'head' parameter to read only the first N lines of a file, or the 'tail' parameter to read only the last N lines of a file. Operates on the file as text regardless of extension. Only works within allowed directories.
Read a file and return it as a base64-encoded content block with its MIME type. Image and audio files are returned as image/audio content; any other file type is returned as an embedded resource. Only works within allowed directories.
Read the contents of multiple files simultaneously. This is more efficient than reading files one by one when you need to analyze or compare multiple files. Each file's content is returned with its path as a reference. Failed reads for individual files won't stop the entire operation. Only works within allowed directories.
Create a new file or completely overwrite an existing file with new content. Use with caution as it will overwrite existing files without warning. Handles text content with proper encoding. Only works within allowed directories.
Make line-based edits to a text file. Each edit replaces exact line sequences with new content. Returns a git-style diff showing the changes made. Only works within allowed directories.
Create a new directory or ensure a directory exists. Can create multiple nested directories in one operation. If the directory already exists, this operation will succeed silently. Perfect for setting up directory structures for projects or ensuring required paths exist. Only works within allowed directories.
Get a detailed listing of all files and directories in a specified path. Results clearly distinguish between files and directories with [FILE] and [DIR] prefixes. This tool is essential for understanding directory structure and finding specific files within a directory. Only works within allowed directories.
Get a detailed listing of all files and directories in a specified path, including sizes. Results clearly distinguish between files and directories with [FILE] and [DIR] prefixes. This tool is useful for understanding directory structure and finding specific files within a directory. Only works within allowed directories.
Get a recursive tree view of files and directories as a JSON structure. Each entry includes 'name', 'type' (file/directory), and 'children' for directories. Files have no children array, while directories always have a children array (which may be empty). The output is formatted with 2-space indentation for readability. Only works within allowed directories.
Move or rename files and directories. Can move files between directories and rename them in a single operation. If the destination exists, the operation will fail. Works across different directories and can be used for simple renaming within the same directory. Both source and destination must be within allowed directories.
Recursively search for files and directories matching a pattern. The patterns should be glob-style patterns that match paths relative to the working directory. Use pattern like '*.ext' to match files in current directory, and '**/*.ext' to match files in all subdirectories. Returns full paths to all matching items. Great for finding files when you don't know their exact location. Only searches within allowed directories.
Retrieve detailed metadata about a file or directory. Returns comprehensive information including size, creation time, last modified time, permissions, and type. This tool is perfect for understanding file characteristics without reading the actual content. Only works within allowed directories.
Returns the list of directories that this server is allowed to access. Subdirectories within these allowed directories are also accessible. Use this to understand which directories and their nested paths are available before trying to access files.
This project demonstrates how to interact with a Model Context Protocol (MCP) server using TypeScript, focusing on the Filesystem MCP Server. It provides an example of integrating this setup with Ollama to create an AI agent capable of interacting with your local file system.
Install Node.js (≥18), Ollama, and globally install the Filesystem MCP Server. Clone the repository, run npm install, configure mcp-config.json with server and model details, then execute npm run start to start an interactive chat session.
mcp-config.json.Node.js (version 18 or higher), npm or yarn, and the globally installed package `@modelcontextprotocol/server-filesystem` are required. Ollama must be installed and running.
Edit the `mcp-config.json` file; the `args` field for the filesystem server specifies the root directory the agent can access (e.g., `"./"`). Adjust this path carefully to limit access.
Yes. The specified Ollama model must support the concept of “tools” or “functions” in its API. Models like `qwen2.5:latest` often have this capability.
Run `npm run start` or `yarn start`. This starts the Filesystem MCP Server, connects to it, fetches tools, initializes the Ollama agent, and opens a chat session.
Yes. Submit pull requests with improvements or bug fixes. For major changes, open an issue first to discuss the proposed change.

MCP server for the Pocket Network agentic marketplace: search our catalog of data services and utilities and call them, paying per request in USDC on Base with x402. No account or API key. Search and describe are free; p
MCP-native LLM councils for debates, juries, blind panels, voting, refinement, and custom multi-model deliberation.

Guideline-cited lab-results analysis for people managing type 2 diabetes, kidney disease, lupus and cancer survivorship. Flags tests that are missing or overdue (ADA, KDIGO, NCCN — each cited) and returns questions to br

Extract, search and tag any document — invoices, receipts, contracts, forms, or your own templates. 13 tools, one sign-in (OAuth 2.1) or API key, free FileTag tier, data residency in the EU, US, Israel or Asia.
28-tool MCP server for web scraping, crawling, deep research & autonomous extraction — clean Markdown & structured JSON for Claude, Cursor & any MCP client. 1,000 free one-time credits, local-Ollama LLM support.
Comments