Document MCP Server

1

Add it to Claude Code

Run this in a terminal.

Run in terminal
claude mcp add document-mcp -- uv run mcp_server.py
README.md

A simple MCP server and client for managing documents using FastMCP.

Document MCP Server

A simple MCP (Model Context Protocol) server and MCP client for managing documents using FastMCP.

Features

  • Tools:

    • read_doc_contents: Read the contents of a document.
    • edit_document: Edit a document by replacing text.
    • return all the docs: List all document IDs.
  • Resources:

    • docs://documents: JSON list of document IDs.
    • docs://documents/{doc_id}: Plain text content of a specific document.
  • Prompts:

    • format_to_md: Prompt template for formatting documents to Markdown.

Prerequisites

  • Python 3.12 or higher
  • uv (Python package manager and project manager)

Installation

  1. Ensure you have Python 3.12+ installed.

  2. Install uv if not already installed:

    pip install uv
    
  3. Clone or download this project to your local machine.

  4. Navigate to the project directory:

    cd "path/to/mcp server"
    
  5. Create a virtual environment and install dependencies:

    uv sync
    

Running the Server

To run the MCP server in development mode:

uv run mcp dev mcp_server.py

The server runs on stdio transport, suitable for MCP clients.

Testing the Functionality

Test client is provided in mcp_client.py to verify the server works.

To test:

  1. In one terminal, start the server:

    uv run python mcp_server.py
    
  2. In another terminal, run the test client:

    uv run mcp_client.py
    

This will connect to the server and list the available tools, printing them to the console.

For more advanced testing, you can modify mcp_client.py to call specific tools, read resources, or get prompts.

Example: To read a document content, you could add code like:

# Inside the async main function
doc_content = await client.call_tool("read_doc_contents", {"doc_id": "deposition.md"})
print(doc_content)

Project Structure

  • mcp_server.py: The main MCP server implementation.
  • mcp_client.py: A test client for interacting with the server.
  • pyproject.toml: Project configuration and dependencies.

Notes

  • The server uses an in-memory dictionary for documents. Changes are not persisted.
  • Ensure the virtual environment is activated when running Python commands.

Tools (3)

read_doc_contentsRead the contents of a document.
edit_documentEdit a document by replacing text.
return all the docsList all document IDs.

Configuration

claude_desktop_config.json
{"mcpServers": {"document-mcp": {"command": "uv", "args": ["run", "mcp_server.py"]}}}

Try it

List all available documents currently in memory.
Read the contents of the document with ID 'deposition.md'.
Update the content of 'notes.txt' to include the new meeting summary.
Format the current document content into Markdown.

Frequently Asked Questions

What are the key features of Document MCP Server?

Read contents of specific documents via tool calls. Edit document text content directly. List all available document IDs. Expose documents as MCP resources for direct access. Provide prompt templates for Markdown formatting.

What can I use Document MCP Server for?

Managing temporary text notes during an AI-assisted coding session. Testing MCP client-server communication protocols. Quickly editing and retrieving in-memory document snippets. Formatting raw text data into structured Markdown documents.

How do I install Document MCP Server?

Install Document MCP Server by running: uv sync

What MCP clients work with Document MCP Server?

Document MCP Server works with any MCP-compatible client including Claude Desktop, Claude Code, Cursor, and other editors with MCP support.

Turn this server into reusable context

Keep Document MCP Server docs, env vars, and workflow notes in Conare so your agent carries them across sessions.

Need the old visual installer? Open Conare IDE.
Open Conare