MCP Server

MCP Server

An MCP server that provides document management capabilities including reading, editing, and summarizing documents through a CLI chat interface powered by Claude AI.

Category
访问服务器

README

MCP Server

A Model Context Protocol (MCP) server implementation that provides document management capabilities through a CLI interface powered by Claude AI.

Overview

This project implements an MCP server that allows you to:

  • Read and edit documents
  • List available documents
  • Format documents using Markdown
  • Summarize document contents
  • Interact with documents through a CLI chat interface powered by Claude AI

Features

  • Document Management: Read, edit, and manage various document types
  • MCP Protocol: Implements the Model Context Protocol for AI tool integration
  • Claude AI Integration: Uses Anthropic's Claude for intelligent document processing
  • CLI Interface: Command-line chat interface for document interactions
  • Multiple Document Formats: Support for various document types (MD, PDF, DOCX, TXT)

Prerequisites

  • Python 3.8+
  • UV package manager (recommended) or pip
  • Anthropic API key

Installation

  1. Clone the repository:
git clone <repository-url>
cd mcp-server
  1. Create and activate a virtual environment:
# Using UV (recommended)
uv venv
source .venv/bin/activate  # On Windows: .venv\Scripts\activate

# Or using standard Python
python -m venv .venv
source .venv/bin/activate  # On Windows: .venv\Scripts\activate
  1. Install dependencies:
# Using UV
uv pip install -r requirements.txt

# Or using pip
pip install -r requirements.txt
  1. Set up environment variables: Create a .env file in the project root:
CLAUDE_MODEL=claude-3-sonnet-20240229
ANTHROPIC_API_KEY=your_anthropic_api_key_here
USE_UV=1  # Set to 0 if not using UV

Usage

Basic Usage

Run the main application:

python main.py

Or with UV:

uv run main.py

Running the MCP Server

The MCP server can be run independently:

python mcp_server.py

Or with UV:

uv run mcp_server.py

CLI Chat Interface

The application provides a CLI chat interface where you can:

  • Ask questions about documents
  • Request document summaries
  • Format documents
  • Edit document contents

Project Structure

mcp-server/
├── core/                   # Core application modules
│   ├── chat.py            # Chat functionality
│   ├── claude.py          # Claude AI service integration
│   ├── cli.py             # CLI application logic
│   ├── cli_chat.py        # CLI chat interface
│   └── tools.py           # Utility tools
├── mcp_server.py          # MCP server implementation
├── mcp_client.py          # MCP client implementation
├── main.py                # Main application entry point
└── README.md              # This file

MCP Server Features

The MCP server provides the following tools and resources:

Tools

  • read_document: Read contents of a document
  • edit_document: Edit document content by replacing text

Resources

  • docs://documents: List all available documents
  • docs://documents/{doc_id}: Get specific document content

Prompts

  • format: Rewrite document in Markdown format
  • summarize: Summarize document contents

Available Documents

The server comes with sample documents:

  • deposition.md - Testimony documentation
  • report.pdf - Technical report
  • financials.docx - Financial information
  • outlook.pdf - Performance projections
  • plan.md - Implementation plan
  • spec.txt - Technical specifications

Configuration

Environment Variables

  • CLAUDE_MODEL: The Claude model to use (default: claude-3-sonnet-20240229)
  • ANTHROPIC_API_KEY: Your Anthropic API key
  • USE_UV: Set to "1" to use UV, "0" to use standard Python

UV vs Python

The application can use either UV or standard Python. Set USE_UV=1 in your .env file to use UV, or USE_UV=0 to use standard Python.

Development

Running Tests

# Using UV
uv run pytest

# Using Python
python -m pytest

Code Style

The project follows Python best practices and uses type hints throughout.

Troubleshooting

Common Issues

  1. API Key Error: Ensure your ANTHROPIC_API_KEY is set correctly in the .env file
  2. Model Error: Verify the CLAUDE_MODEL is a valid model name
  3. UV Not Found: Install UV or set USE_UV=0 to use standard Python

Debug Mode

The MCP server runs in DEBUG mode by default. Check the console output for detailed logging information.

Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Add tests if applicable
  5. Submit a pull request

License

[Add your license information here]

Support

For issues and questions, please open an issue on the repository.

推荐服务器

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 模型以安全和受控的方式获取实时的网络信息。

官方
精选