file_analysis_mcp
The File Analysis MCP Server is a custom lightweight server designed for text file analysis, offering tools for text analysis and directory management. It integrates seamlessly with Claude Desktop to enhance AI interactions with external tools.
File Analysis MCP Server
A custom-built MCP (Model Context Protocol) server for text file analysis, also published as a package to PyPI.
Table of Contents
- Introduction
- Features
- Installation and Setup from GitHub
- Claude Desktop Integration
- Installation from Package
Introduction
What is MCP?
Model Context Protocol (MCP) is an open protocol that standardizes how applications provide context to Large Language Models (LLMs). It creates a consistent interface for AI models like Claude to interact with external tools, data sources, and services.
MCP follows a client-server architecture:
- MCP Hosts: Programs like Claude Desktop that initiate connections
- MCP Clients: Protocol clients inside the host application
- MCP Servers: Lightweight programs (like this one) that expose capabilities
- Local Data Sources: Your computer's files, databases, and services
Why MCP?
MCP helps you build agents and complex workflows with LLMs by providing:
- Standardized interfaces to connect AI models to different data sources
- The flexibility to switch between LLM providers
- Best practices for secure data access
Features
This File Analysis MCP Server provides:
- Text analysis tools (word count, character frequency, etc.)
- File reading capabilities
- Directory listing
- File content access via MCP resources
Text Analysis Tool (analyze_text
)
File Reader Tool (read_file
)
Directory Browsing Tool (list_files
)
Installation and Setup from GitHub
Step 1: Clone the Repository
Start by cloning the repository to your local machine:
git clone https://github.com/yourusername/file-analysis-mcp.git
cd file-analysis-mcp
Step 2: Set Up UV Package Manager
This project uses UV, a fast Python package manager. If you don't have it installed:
For MacOS/Linux:
curl -LsSf https://astral.sh/uv/install.sh | sh
For Windows:
powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"
Remember to restart your terminal after installing UV.
Step 3: Create a Virtual Environment
# Create and activate a virtual environment
uv venv
For MacOS/Linux:
source .venv/bin/activate
For Windows:
.venv\Scripts\activate
Step 4: Install Dependencies
# Install the required dependencies
uv pip install "mcp[cli]"
Testing and Debugging
Running with the MCP Inspector:
uv run mcp dev path/to/your/server/file
Claude Desktop Integration
The real power of your File Analysis server comes when you connect it to Claude Desktop!
Setting Up with Claude Desktop
-
Make sure Claude Desktop is installed
- Download from Claude.ai if you don't have it
-
Locate the configuration file:
- MacOS:
~/Library/Application Support/Claude/claude_desktop_config.json
- Windows:
%AppData%\Claude\claude_desktop_config.json
If the file doesn't exist, create it.
- MacOS:
-
Add your server configuration:
For MacOS/Linux:
{ "mcpServers": { "file-analysis": { "command": "uv", "args": [ "--directory", "/ABSOLUTE/PATH/TO/file-analysis-mcp", "run", "server.py" ] } } }
For Windows:
{ "mcpServers": { "file-analysis": { "command": "uv", "args": [ "--directory", "C:\\ABSOLUTE\\PATH\\TO\\file-analysis-mcp", "run", "server.py" ] } } }
Important: Replace the path with the actual absolute path to where you cloned the repository. Do not use relative paths.
-
Restart Claude Desktop
- Close and reopen the application completely
-
Verify the connection
- Look for the tools icon (hammer) in the Claude interface
- Your tools should appear in the list when clicking this icon
Tips for Using Your Server
- File Paths: Always provide absolute file paths for best results
- Large Files: Break up analysis of very large files into smaller chunks
- Permissions: Ensure Claude has permission to access the files/directories you're analyzing
Installation from Package
From PyPI (Recommended)
The simplest way to install File Analysis MCP Server is from PyPI:
pip install file-analysis-mcp
Or using UV (recommended):
uv pip install file-analysis-mcp
Add your server configuration
{
"mcpServers": {
"mcp-server": {
"command": "uv",
"args": [
"run",
"mcp-server"
]
}
}
}