Skip to content

Wondermongering/Claude-LaTeX-MCP-Integration

Repository files navigation

Claude-LaTeX-MCP-Integration

Claude-LaTeX MCP Integration

License: MIT MCP: Compatible Version: 0.1.0

A powerful integration between Claude AI and LaTeX editors using Anthropic's Model Context Protocol (MCP). Enhance your academic writing, equation generation, document formatting, speculative fiction, and philosophical works with AI assistance directly in your LaTeX editor.

🚀 Overview

The Claude-LaTeX MCP Integration connects Claude's AI capabilities with LaTeX document preparation systems, creating a seamless workflow for researchers, students, creative writers, and academic authors. This project implements an MCP server that exposes LaTeX-specific tools and editor plugins that bring Claude's assistance directly into popular LaTeX editors.

✨ Key Features

Core Features

  • AI-Powered Equation Generation: Convert natural language descriptions to properly formatted LaTeX equations
  • Document Structure Assistance: Get help organizing your academic papers with section suggestions and templates
  • Intelligent Formatting: Automatically format LaTeX code according to best practices
  • Citation Management: Generate and format BibTeX entries from paper references
  • Academic Writing Support: Receive suggestions to improve clarity and adhere to academic writing standards

Specialized Features for Speculative Fiction

  • Worldbuilding Documentation: Create structured LaTeX documents for developing fictional worlds with detailed sections for history, geography, magic systems, technology, and more
  • Character Development Profiles: Generate comprehensive character profiles with customizable detail levels
  • Dialogue Formatting: Format dialogue in various styles (novel, script, play) with special handling for non-human speech and thought text
  • Timeline Visualization: Create sophisticated timelines in linear, branching, parallel, or circular formats

Specialized Features for Philosophical Writing

  • Argument Structure Templates: Generate properly structured philosophical arguments of various types (deductive, inductive, thought experiments, etc.)
  • Concept Mapping: Create visual diagrams of philosophical concepts and their relationships
  • Citation Formatting: Format citations according to philosophical traditions and academic standards
  • Dialectical Structures: Support for thesis-antithesis-synthesis and other dialectical writing patterns

🏗️ Architecture

The integration consists of several components:

  1. LaTeX MCP Server: Core component that handles communication between Claude and LaTeX editors
  2. Editor Plugins: Interface components for popular LaTeX editors (Overleaf, TeXStudio, VS Code)
  3. Claude MCP Client: Leverages Claude's capabilities through the Model Context Protocol
  4. LaTeX Tools: Specialized tools for equation generation, document formatting, and more
  5. Extensions: Specialized modules for creative writing and philosophical content

Architecture Diagram

📂 Project Structure

The structure below shows the intended layout of the project. Several of the listed directories are not yet implemented in this repository and represent future work.

claude-latex-mcp/
├── config/                     # Configuration files
│   ├── default.json            # Default configuration
│   └── test.json               # Test configuration
├── dist/                       # Compiled JavaScript files
├── docs/                       # Documentation
│   ├── images/                 # Diagrams and screenshots
│   ├── api/                    # API documentation
│   └── guides/                 # User guides
├── examples/                   # Example usage and templates
│   ├── academic/               # Academic writing examples
│   ├── creative/               # Speculative fiction examples
│   └── philosophy/             # Philosophical writing examples
├── scripts/                    # Utility scripts
├── src/                        # Source code
│   ├── core/                   # Core MCP server implementation
│   │   ├── server.ts           # Main server implementation
│   │   ├── client.ts           # Client implementation
│   │   └── protocols/          # MCP protocol implementation
│   ├── extensions/             # Specialized extensions
│   │   ├── speculative/        # Speculative fiction extension
│   │   └── philosophy/         # Philosophical writing extension
│   ├── plugins/                # Editor plugins
│   │   ├── overleaf/           # Overleaf plugin
│   │   ├── texstudio/          # TeXStudio plugin
│   │   └── vscode/             # VS Code extension
│   ├── tools/                  # Tool implementations
│   │   ├── equation/           # Equation generation tool
│   │   ├── document/           # Document structure tool
│   │   ├── format/             # LaTeX formatting tool
│   │   ├── worldbuilding/      # Worldbuilding tools
│   │   ├── character/          # Character development tools
│   │   ├── argument/           # Philosophical argument tools
│   │   └── citation/           # Citation tools
│   └── utils/                  # Utility functions
├── tests/                      # Tests
│   ├── unit/                   # Unit tests
│   ├── integration/            # Integration tests
│   └── fixtures/               # Test fixtures
├── .env.example                # Example environment variables
├── .gitignore                  # Git ignore file
├── package.json                # NPM package config
├── tsconfig.json               # TypeScript configuration
└── README.md                   # This file

📋 Requirements

  • Node.js 16+
  • Python 3.10+ (optional, for some tools)
  • Anthropic API key
  • LaTeX distribution (TeX Live, MiKTeX, etc.)

🔧 Installation

Server Installation

# Clone the repository
git clone https://github.com/yourusername/claude-latex-mcp.git
cd claude-latex-mcp

# Install dependencies
npm install

# Configure your environment
cp .env.example .env
# Edit .env to add your Anthropic API key
# See `src/ENVIRONMENT.md` for details on the required variables

# Start the MCP server
npm run server

Editor Plugin Installation

Overleaf

The Overleaf plugin can be installed as a browser extension:

  1. Go to Chrome/Firefox extension store
  2. Search for "Claude LaTeX Assistant"
  3. Install the extension
  4. Configure the MCP server URL in the extension settings

VS Code

  1. Open VS Code
  2. Go to Extensions marketplace
  3. Search for "Claude LaTeX Assistant"
  4. Install and reload VS Code
  5. Configure the MCP server URL in extension settings

🔍 Usage Examples

Core Features

Generating Equations

In your LaTeX editor, highlight text describing an equation and use the context menu:

I need an equation for the normal distribution probability density function

Claude will generate:

\begin{equation}
f(x | \mu, \sigma^2) = \frac{1}{\sqrt{2\pi\sigma^2}} e^{-\frac{(x-\mu)^2}{2\sigma^2}}
\end{equation}

Creating Document Structure

Ask Claude to help structure your document:

Help me organize a research paper on quantum computing algorithms

Claude will generate a document structure with appropriate sections.

Speculative Fiction Features

Worldbuilding Documentation

Generate a comprehensive worldbuilding document for your speculative fiction setting:

Tool: create-worldbuilding-document
Parameters:
  worldName: "Eldoria"
  worldType: "fantasy"
  keyElements: ["Magic System", "Political Factions", "Religions", "Ancient History"]
  description: "A high fantasy world where magic is tied to celestial cycles and ancient ruins hold forgotten technologies."

Character Development

Generate a detailed character profile for a speculative fiction character:

Tool: create-character-profile
Parameters:
  characterName: "Admiral Zara Vex"
  characterType: "antagonist"
  basicDescription: "A brilliant military strategist who believes the only path to galactic peace is through unified authoritarian control."
  worldContext: "In a space opera setting where multiple species vie for control of wormhole networks."
  detailLevel: "comprehensive"

Philosophical Writing Features

Philosophical Argument Structure

Create a structured philosophical argument or thought experiment:

Tool: create-philosophical-argument
Parameters:
  argumentType: "thought-experiment"
  title: "The Ship of Theseus in Digital Consciousness"
  premise: "If a human mind is uploaded to a digital substrate and then gradually replaced neuron by neuron, at what point does it cease to be the original consciousness?"
  tradition: "analytic"
  includeCounterarguments: true

Concept Mapping

Create a visual map of philosophical concepts and their relationships:

Tool: create-concept-map
Parameters:
  centralConcept: "Existential Freedom"
  relatedConcepts: ["Responsibility", "Anxiety", "Authenticity", "Bad Faith", "Choice"]
  relationships: [
    { "from": "Existential Freedom", "to": "Responsibility", "type": "derives_from", "description": "Freedom necessitates responsibility" },
    { "from": "Existential Freedom", "to": "Anxiety", "type": "generates", "description": "The burden of choice creates anxiety" }
  ]
  diagramType: "tikz-mindmap"

🛣️ Roadmap

Phase 1: Core Functionality (Q2 2025)

  • Basic MCP server implementation
  • Equation generation tool
  • Document structure tool
  • LaTeX formatting tool
  • Speculative fiction extension (basic)
  • Philosophical writing extension (basic)
  • Initial Overleaf plugin
  • Basic testing and validation

Phase 2: Enhanced Capabilities (Q3 2025)

  • Citation management tool
  • Academic writing assistance
  • Advanced equation generation with multi-line support
  • Enhanced speculative fiction tools (narrative structure, worldbuilding)
  • Advanced philosophical argument templates and analysis
  • VS Code and TeXStudio plugins
  • User preference management

Phase 3: Advanced Features (Q4 2025)

  • Collaborative writing support
  • Document review and feedback
  • Interactive equation editing
  • Integration with reference managers
  • Advanced styling options for different journals/conferences
  • Specialized visualization tools for epistemological frameworks
  • Narrative structure analysis for fiction
  • Performance optimizations and caching

Phase 4: Ecosystem Expansion (Q1 2026)

  • Discipline-specific extensions
  • Integration with academic databases
  • Journal/conference submission preparation
  • Custom package development assistance
  • Template sharing community
  • Cloud-hosted version with enterprise features
  • Support for non-Western philosophical traditions

📝 Next Steps

  1. Setup Development Environment

    • Install MCP SDK and development tools
    • Configure development servers and test environments
    • Setup continuous integration pipeline
  2. Core Server Implementation

    • Implement basic MCP server with essential tools
    • Develop equation generation with Claude integration
    • Create document structure analysis capabilities
    • Build LaTeX formatting and validation
  3. Editor Integration

    • Develop browser extension for Overleaf
    • Create user interface components
    • Implement communication with MCP server
    • Test with various LaTeX document types
  4. Extension Development

    • Implement speculative fiction tools
    • Develop philosophical writing assistants
    • Create specialized templates for different genres and traditions
    • Build concept visualization tools
  5. Testing and Validation

    • Create test suite for MCP server
    • Validate equation generation with complex examples
    • Test integration with various LaTeX editors
    • Perform user testing with academic writers, fiction authors, and philosophers

🤝 Contributing

Contributions are welcome! We especially need help with:

  1. Editor integrations for different LaTeX environments
  2. Additional templates for specialized documents
  3. Support for non-Western philosophical traditions
  4. Enhanced visualization options for worldbuilding
  5. Testing with different LaTeX editors and environments

Please see CONTRIBUTING.md for guidelines.

📄 License

This project is licensed under the MIT License - see the LICENSE file for details.

🙏 Acknowledgements

  • Anthropic for developing Claude and the Model Context Protocol
  • The LaTeX community for their tools and resources
  • All contributors to this project

About

Building a integration between Claude AI and LaTeX editors using Anthropic's Model Context Protocol (MCP)

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published