TypeScript MCP with Filesystem Server and Ollama Integration
@ausboss
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.
Overview
What is TypeScript MCP with Filesystem Server and Ollama Integration?
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.
How to use TypeScript MCP with Filesystem Server and Ollama Integration?
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.
Key features of TypeScript MCP with Filesystem Server and Ollama Integration
- MCP client implementation using the official TypeScript SDK.
- Filesystem interaction like listing directories and reading files.
- Ollama integration for an AI agent with tool calling.
- Interactive command‑line chat interface.
- Configuration‑driven setup via
mcp-config.json.
Use cases of TypeScript MCP with Filesystem Server and Ollama Integration
- Exploring directory contents through natural language prompts.
- Reading file contents using an AI‑powered agent.
- Automating file system tasks with local LLM tool calling.
- Prototyping MCP server interactions in a TypeScript project.
FAQ from TypeScript MCP with Filesystem Server and Ollama Integration
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.
How do I configure filesystem access?
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.
Does the Ollama model need to support tool calling?
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.
How do I run the interactive agent?
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.
Can I contribute to this project?
Yes. Submit pull requests with improvements or bug fixes. For major changes, open an issue first to discuss the proposed change.