files-mcp-ts
Integrates with Windsurf IDE (by Codeium) to provide file system operations to AI assistants within the IDE.
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@files-mcp-tslist files in the current directory"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
files-mcp-ts
A lightweight Model Context Protocol (MCP) server implemented in TypeScript for performing basic file operations. This server provides secure file system access through the MCP interface, allowing AI assistants and other MCP clients to read, write, and list files in a controlled manner.
Overview
This MCP server implements the Model Context Protocol specification to provide file system operations. The main FilesMcpTs class in src/index.ts creates an MCP server that:
Tools: Exposes three file operation tools (
read_file,list_files,write_file)Resources: Provides a
file://current-directoryresource for directory listingsTransport: Uses stdio transport for communication with MCP clients
Architecture: Clean TypeScript implementation with proper error handling and type safety
The server is designed to be spawned by MCP clients and communicates via standard input/output streams.
Related MCP server: Filesys
Project Structure
files-mcp-ts/
├── src/
│ └── index.ts # Main MCP server implementation
├── dist/ # Compiled JavaScript output (generated)
├── node_modules/ # Dependencies (generated)
├── .gitignore # Git ignore rules
├── package.json # Package configuration and dependencies
├── pnpm-lock.yaml # Dependency lock file
├── tsconfig.json # TypeScript compiler configuration
└── README.md # This documentationFeatures
Tools
read_file– Read the contents of any text file by providing its pathlist_files– List all files and directories within a specified directorywrite_file– Write or overwrite text content to a file (creates directories if needed)
Resources
file://current-directory– Provides a real-time listing of files in the server's working directory
Technical Features
Type Safety – Full TypeScript implementation with strict type checking
Error Handling – Comprehensive error handling with proper MCP error codes
Async Operations – Non-blocking file operations using Node.js fs/promises
Input Validation – Parameter validation for all tool calls
Prerequisites
Node.js 18.x or newer – Required for ES2022 features and MCP SDK compatibility
pnpm – Recommended package manager (or npm/yarn as alternatives)
TypeScript knowledge – For development and customization
Installation & Setup
Install dependencies:
pnpm installBuild the project:
pnpm buildThis compiles TypeScript sources from
src/to JavaScript indist/.Verify installation:
pnpm startYou should see:
Simple Files MCP Server running on stdio
Usage
Development Mode
pnpm devRuns the server directly from TypeScript source with hot reloading via tsx.
Production Mode
pnpm start
# or
npx files-mcp-tsRuns the compiled JavaScript version from dist/.
Integration with MCP Clients
The server communicates via stdio and is designed to be spawned by MCP clients. It's not meant to be run interactively but rather integrated into MCP-compatible applications.
MCP Client Integration
Claude Desktop Configuration
Add this server to your Claude Desktop configuration file:
Location: ~/Library/Application Support/Claude/claude_desktop_config.json (macOS) or %APPDATA%\Claude\claude_desktop_config.json (Windows)
{
"mcpServers": {
"files-mcp-ts": {
"command": "node",
"args": ["/path/to/files-mcp-ts/dist/index.js"],
"workingDirectory": "/desired/working/directory"
}
}
}Alternative: Using pnpm
{
"mcpServers": {
"files-mcp-ts": {
"command": "pnpm",
"args": ["exec", "files-mcp-ts"],
"workingDirectory": "/path/to/files-mcp-ts"
}
}
}Configuration Notes
The
workingDirectorydetermines where thefile://current-directoryresource pointsEnsure the path to the compiled
dist/index.jsis correctRestart Claude Desktop after configuration changes
Windsurf IDE Configuration
Add this server to your Windsurf MCP configuration file:
Location: %APPDATA%\Codeium\Windsurf\mcp_config.json (Windows) or ~/.codeium/windsurf/mcp_config.json (macOS/Linux)
{
"mcpServers": {
"files-mcp-ts": {
"command": "node",
"args": [
"/path/to/files-mcp-ts/dist/index.js"
]
}
}
}Note: Use absolute paths and proper Windows path escaping (double backslashes) for the args parameter.
Windsurf IDE Integration
Once configured, this MCP server integrates seamlessly with Windsurf IDE. You'll see:
Server Status Panel - Shows
files-mcp-tsas enabled with a green status indicatorAvailable Tools Display - Lists all 3 tools (
read_file,list_files,write_file) with descriptionsAutomatic Tool Discovery - Windsurf automatically detects and registers your server's capabilities
Ready-to-Use Integration - AI assistants in Windsurf can immediately use your file operations
Configuration in Windsurf: The server appears in the MCP configuration panel where you can:
Toggle the server on/off with the "Enabled" switch
View all available tools and their descriptions
Access configuration options via the "Configure" button
Monitor connection status in real-time
API Reference
Tools
read_file
Reads and returns the contents of a text file.
Parameters:
path(string, required) – File path to read
Returns: File contents as text
Example:
{
"name": "read_file",
"arguments": {
"path": "./example.txt"
}
}list_files
Lists all files and directories in the specified directory.
Parameters:
directory(string, required) – Directory path to list
Returns: Newline-separated list of file/directory names
Example:
{
"name": "list_files",
"arguments": {
"directory": "./src"
}
}write_file
Writes text content to a file, creating or overwriting as needed.
Parameters:
path(string, required) – File path to write tocontent(string, required) – Text content to write
Returns: Success confirmation message
Example:
{
"name": "write_file",
"arguments": {
"path": "./output.txt",
"content": "Hello, World!"
}
}Resources
Understanding Resources vs Tools
Resources are static or dynamic content that MCP clients can access directly, while Tools are functions that clients can call with parameters.
Aspect | Tools | Resources |
Usage | Call with parameters | Request by URI |
Flexibility | Can target any file/directory | Fixed to server's working directory |
Parameters | Required | None |
Purpose | Perform actions | Provide information |
Example |
|
|
Tool Examples:
// read_file - REQUIRES path parameter
{"name": "read_file", "arguments": {"path": "./example.txt"}}
// list_files - REQUIRES directory parameter
{"name": "list_files", "arguments": {"directory": "./src"}}
// write_file - REQUIRES path AND content parameters
{"name": "write_file", "arguments": {"path": "./new.txt", "content": "Hello!"}}Resource Example:
URI: "file://current-directory"
Returns: "src\ndist\npackage.json\nREADME.md"
No parameters needed - just request the URIfile://current-directory
Provides a real-time listing of files in the server's working directory.
URI: file://current-directory
MIME Type: text/plain
Content: Newline-separated list of files and directories
How it works:
// In src/index.ts - when a client requests the resource
if (uri === 'file://current-directory') {
const files = await fs.readdir('.'); // Read current directory
return {
contents: [{
uri,
mimeType: 'text/plain',
text: files.join('\n') // Return as newline-separated list
}]
};
}Example Output:
If the server runs in a directory containing src/, dist/, package.json, README.md, the resource returns:
src
dist
package.json
README.mdKey Benefits:
Always current - Reflects real-time directory state
Efficient - No function call needed, just request the URI
Cacheable - MCP clients can cache and refresh as needed
Different from
list_filestool - This resource shows the server's working directory, while the tool can list any specified directory
How to Access Resources
❌ Common Misconception:
You cannot access resources by simply typing the URI like file://current-directory in a chat or browser. Resources are MCP protocol endpoints, not web URLs.
✅ Correct Usage: Resources must be accessed through MCP clients:
In Windsurf IDE or Claude Desktop:
Ask the AI: "Show me the current directory resource from the MCP server"The AI assistant will use the MCP interface to fetch the resource for you.
In Your Own MCP Client Code:
// Example client implementation
const response = await mcpClient.readResource({
uri: "file://current-directory"
});
console.log(response.contents[0].text);Key Concept:
Resource URI = The "address" of the content (
file://current-directory)MCP Client = The "postal service" that fetches it (Windsurf, Claude Desktop, etc.)
You = The person requesting the content
Think of resources like internal API endpoints that only work through the MCP protocol, not as direct web URLs you can visit in a browser.
Development
Extending the Server
Adding new tools: Register additional handlers in the
setupToolHandlers()methodAdding new resources: Register additional handlers in the
setupResourceHandlers()methodModifying existing functionality: Edit the respective handler functions in
src/index.ts
Development Workflow
Make changes to
src/index.tsTest with
pnpm devfor immediate feedbackBuild with
pnpm buildfor productionTest the built version with
pnpm start
Code Quality
The project uses TypeScript strict mode for type safety
All file operations use async/await patterns
Proper error handling with MCP-specific error codes
Input validation for all tool parameters
Security Considerations
File paths are not sanitized by default – consider adding path validation for production use
The server has access to the entire file system – run in a sandboxed environment if needed
No authentication or authorization is implemented – suitable for trusted environments only
Security & Access Control
MCP Protocol Isolation
Important: MCP resources are NOT accessible from outside the MCP server ecosystem. This isolation is intentional and provides security benefits.
What MCP Resources Are NOT:
❌ Not web URLs - Cannot access via HTTP/HTTPS requests
❌ Not REST API endpoints - No direct HTTP access
❌ Not file system paths - Cannot browse to them like files
❌ Not network services - No TCP/UDP ports exposed
What MCP Resources ARE:
✅ Internal protocol endpoints - Only work within MCP ecosystem
✅ Client-server communication - Require MCP client to access
✅ Stdio-based - Communication over standard input/output
✅ Process-to-process - Server spawned by MCP client
Security Architecture:
┌─────────────────┐ ┌──────────────────┐ ┌─────────────────┐
│ Outside │ │ MCP Client │ │ MCP Server │
│ World │───▶│ (Windsurf/ │◄──▶│ (files-mcp-ts) │
│ │ │ Claude) │ │ │
└─────────────────┘ └──────────────────┘ └─────────────────┘
❌ ✅ ✅
Cannot access Can access Provides
resources directly via MCP protocol resourcesSecurity Benefits:
No network exposure - Server doesn't listen on network ports
Controlled access - Only authorized MCP clients can connect
Process isolation - Server runs as subprocess of client
No direct file system exposure - Resources mediated through MCP protocol
Client-level authentication - Access control handled by MCP client
Sandboxing possible - Client can restrict server capabilities
External Access Considerations:
If external access is needed, you would need to build a separate HTTP bridge service, but this would defeat the security purpose of MCP's isolated design. The file://current-directory URI only has meaning within the MCP context - it's not a universal resource locator like HTTP URLs.
Contributing
Contributions are welcome! Please feel free to submit issues, feature requests, or pull requests.
Development Setup
Fork the repository
Clone your fork:
git clone <your-fork-url>Install dependencies:
pnpm installMake your changes
Test thoroughly with
pnpm devBuild and verify:
pnpm build && pnpm startSubmit a pull request
Related Resources
Available Tools
3 toolslist_filesC
List files in a directory
| Name | Required | Description | Default |
|---|---|---|---|
| directory | Yes | Directory path to list files from |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
No annotations exist, so the description must disclose behavioral traits. It only states 'list files' without specifying recursion, hidden files, error handling, or output format, leaving significant gaps.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is a single sentence with no wasted words. However, it is overly concise and lacks structure to address key details.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given no output schema and low complexity, the description is incomplete. It fails to mention what is returned (file names? full paths?), or any behavioral details like sorting, recursion, or error cases.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema coverage is 100%, and the schema already describes the 'directory' parameter. The tool description adds no extra meaning beyond the schema, so baseline of 3 is appropriate.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the tool lists files in a directory, which is a specific verb and resource. It distinguishes from sibling tools (read_file, write_file) which deal with file contents, not listing.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
No guidance is provided on when to use this tool vs alternatives. The description does not mention any prerequisites, limitations, or when not to use it.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
read_fileB
Read the contents of a text file
| Name | Required | Description | Default |
|---|---|---|---|
| path | Yes | Path to the file to read |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations provided, the description carries full burden for behavioral disclosure. It does not address file size limits, encoding assumptions, how binary files are handled, error states (e.g., missing file), or whether the output includes line numbers. The description is minimal and lacks important behavioral context.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is a single, concise sentence with no wasted words. However, conciseness comes at the cost of omitting useful details like return format or usage notes. It is well-structured but slightly too brief.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given the simplicity of the tool (one parameter, no output schema) and the existence of sibling tools, the description is minimally adequate. It identifies the action and resource but fails to mention that the tool only works on text files (implying binary might fail) or that it returns the entire file contents. Some context is missing.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema coverage is 100% because the single required parameter 'path' has a description ('Path to the file to read') that fully captures its meaning. The tool description adds no additional context, so the baseline score of 3 (adequate) is appropriate.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states 'Read the contents of a text file', specifying the verb (read) and resource (text file). It distinguishes itself from sibling tools 'list_files' (which lists files) and 'write_file' (which writes files), making the tool's purpose unambiguous.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description provides no guidance on when to use this tool relative to its siblings (e.g., list_files for browsing, write_file for creating). There is no mention of prerequisites or typical scenarios, leaving the agent without contextual constraints.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
write_fileC
Write content to a file
| Name | Required | Description | Default |
|---|---|---|---|
| path | Yes | Path to the file to write | |
| content | Yes | Content to write to the file |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
The description does not disclose important behavioral details such as whether the file is overwritten or appended, whether it creates parent directories, or encoding expectations, and no annotations are provided.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is extremely concise (5 words), which is efficient but lacks necessary details that could be included without being verbose.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given the simple schema and lack of annotations, the description is insufficiently complete. It fails to address file creation overwrite behavior, error conditions, or output expectations.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema coverage is 100% with clear descriptions for both parameters. The tool description adds no extra semantic value beyond what the schema already provides.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description 'Write content to a file' uses a clear verb and resource, and it distinguishes itself from sibling tools 'list_files' and 'read_file' which have different purposes.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description provides no guidance on when to use this tool versus alternatives, nor does it specify prerequisites or context.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections. Dates show when Glama detected each change.
3 tool updates
v0.1.0- First observed
list_files - First observed
read_file - First observed
write_file
TDQS
Each tool has a clear, distinct purpose: listing directory contents, reading a file, and writing to a file. There is no overlap or ambiguity.
All tool names follow a consistent verb_noun pattern with underscores: list_files, read_file, write_file. The pattern is uniform and predictable.
With 3 tools, the set is minimal but still covers basic file operations. It is slightly thin but not unreasonable for a focused file server.
The toolset provides list, read, and write operations, but misses common file operations like delete, create directory, or rename. This leaves notable gaps for typical file management tasks.
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Connectors
Browse and manage files in your Moxt AI workspace from any MCP client.
An MCP server that provides read access to your cloud storage providers, bank accounts and more.
Agent-native MCP server over the public saagarpatel.dev corpus. Read-only, stateless.
A comprehensive Model Context Protocol (MCP) server that enables AI assistants to interact with yo…
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceA Model Context Protocol (MCP) server that allows AI models to safely access and interact with local file systems, enabling reading file contents, listing directories, and retrieving file metadata.1910MIT
- -licenseNot gradedqualityNot gradedmaintenanceA Filesystem MCP server that allows an LLM to read and list files from a specified directory on your local machine through the Model Context Protocol.2-
- AlicenseCqualityDmaintenanceA server implementing the Model Context Protocol that provides filesystem operations (read/write, directory management, file movement) through a standardized interface with security controls for allowed directories.94MIT
- FlicenseAqualityDmaintenanceA Model Context Protocol (MCP) server that enables AI assistants to perform comprehensive file operations including finding, reading, writing, editing, searching, moving, and copying files with security validations.71-
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/LiviuBirjega/files-mcp-ts'
If you have feedback or need assistance with the MCP directory API, please join our Discord server