CSV MCP Server

CSV MCP Server

Enables comprehensive CSV file management including creating, editing, analyzing, and transforming CSV data anywhere in the filesystem. Provides statistical analysis, data validation, filtering, and grouping capabilities through MCP protocol over stdio transport.

Category
访问服务器

README

CSV MCP Server

A Model Context Protocol (MCP) server for comprehensive CSV file management using stdio transport exclusively. This server provides tools for creating, editing, analyzing, and managing CSV files using the MCP protocol over standard input/output.

Features

  • File Management: Create, read, update, and delete CSV files
  • Absolute Path Support: Work with CSV files anywhere in the filesystem using absolute paths
  • Data Analysis: Basic statistical analysis and data exploration
  • Data Transformation: Filter, sort, group, and transform data
  • Data Validation: Check data integrity and format validation
  • Import/Export: Support for various CSV formats and encodings
  • Stdio Transport: Uses JSON-RPC 2.0 over standard input/output for communication

Installation

uv add csv-mcp-server

Usage

Running the Server

# Using stdio transport (default and only option)
uv run csv-mcp-server

# With custom log level
uv run csv-mcp-server --log-level DEBUG

# Development mode
uv run mcp dev csv_mcp_server/server.py

Available Tools

  • create_csv: Create a new CSV file with headers and initial data
  • create_csv_at_path: Create a CSV file at a specific absolute or relative path
  • read_csv: Read and display CSV file contents
  • update_csv: Update specific cells or rows in a CSV file
  • delete_csv: Delete a CSV file
  • add_row: Add new rows to an existing CSV file
  • remove_row: Remove specific rows from a CSV file
  • get_info: Get basic information about a CSV file
  • get_statistics: Get statistical summary of numeric columns
  • filter_data: Filter CSV data based on conditions
  • sort_data: Sort CSV data by specified columns
  • group_data: Group and aggregate CSV data
  • validate_data: Validate CSV data integrity and format
  • get_path_info: Get detailed information about a file path (supports absolute paths)

Available Resources

  • csv://{filename}: Access CSV file contents as a resource
  • csv-info://{filename}: Get metadata about a CSV file

Available Prompts

  • analyze_csv: Generate analysis prompts for CSV data
  • transform_csv: Generate transformation suggestions

Configuration

The server can be configured with environment variables:

  • CSV_STORAGE_PATH: Base path for CSV file storage (default: current directory)
  • CSV_MAX_FILE_SIZE: Maximum file size in MB (default: 50)
  • CSV_BACKUP_ENABLED: Enable automatic backups (default: true)
  • CSV_SUPPORT_ABSOLUTE_PATHS: Enable absolute path support (default: true)

Absolute Path Support

The CSV MCP server now supports working with CSV files anywhere in the filesystem using absolute paths. This feature allows you to:

  • Create CSV files in any accessible directory
  • Read and modify existing CSV files from anywhere on the system
  • Work with files outside the default storage directory
  • Maintain backward compatibility with relative paths

Security Features

  • Path Validation: Automatically validates absolute paths for safety
  • System Directory Protection: Prevents access to critical system directories
  • Permission Checking: Verifies directory and file access permissions
  • Symlink Resolution: Safely resolves symbolic links to prevent path traversal attacks

Usage Examples

# Create a CSV file at an absolute path
create_csv_at_path(
    filepath="/path/to/your/data/sales.csv",
    headers=["Date", "Product", "Sales"],
    data=[["2024-01-01", "Laptop", 1200]]
)

# Get information about any file path
get_path_info(filepath="/path/to/your/file.csv")

# All existing tools work with absolute paths
read_csv("/path/to/your/data/analysis.csv")
update_csv("/path/to/your/data/analysis.csv", row_index=0, column="Sales", value=1500)

Transport

This server exclusively uses stdio transport with JSON-RPC 2.0 protocol, making it ideal for:

  • Integration with MCP clients that support stdio transport
  • Command-line tools and scripts
  • Development and testing environments
  • Containerized deployments

Examples

See the examples/ directory for usage examples with various MCP clients:

  • demo_client.py: Basic MCP client demonstration
  • sales_analysis.py: Sales data analysis example
  • absolute_path_demo.py: Demonstration of absolute path functionality

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选