Module: Mathpix

Defined in:
lib/mathpix.rb,
lib/mathpix/client.rb,
lib/mathpix/errors.rb,
lib/mathpix/result.rb,
lib/mathpix/version.rb,
lib/mathpix/document.rb,
lib/mathpix/mcp/server.rb,
lib/mathpix/mcp/http_app.rb,
lib/mathpix/configuration.rb,
lib/mathpix/mcp/base_tool.rb,
lib/mathpix/mcp/tools/get_usage_tool.rb,
lib/mathpix/mcp/tools/list_formats_tool.rb,
lib/mathpix/mcp/tools/batch_convert_tool.rb,
lib/mathpix/mcp/tools/convert_image_tool.rb,
lib/mathpix/mcp/tools/search_results_tool.rb,
lib/mathpix/mcp/tools/convert_strokes_tool.rb,
lib/mathpix/mcp/tools/convert_document_tool.rb,
lib/mathpix/mcp/tools/get_account_info_tool.rb,
lib/mathpix/mcp/tools/check_document_status_tool.rb

Overview

Mathpix OCR engine for the MCP server.

The classes under Mathpix

are the engine the MCP tools delegate to

(see lib/mathpix/mcp). Only configuration and the shared client instance are exposed at the top level — there is no general-purpose client API.

Defined Under Namespace

Modules: MCP Classes: APIError, Client, Configuration, ConfigurationError, ConversionError, Document, DocumentConversion, DocumentResult, Error, InvalidImageError, InvalidRequestError, LowConfidenceError, NetworkError, RateLimitError, Result, ServerError, TimeoutError

Constant Summary collapse

VERSION =
'1.0.0'
PDF =

Alias PDF class to Document for backward compatibility

Document
PDFResult =
DocumentResult

Class Method Summary collapse

Class Method Details

.clientClient

Shared client instance used by the MCP tools.

Returns:



42
43
44
# File 'lib/mathpix.rb', line 42

def client
  @client ||= Client.new(configuration)
end

.configurationConfiguration

Current configuration.

Returns:



36
37
38
# File 'lib/mathpix.rb', line 36

def configuration
  @configuration ||= Configuration.new
end

.configure {|Configuration| ... } ⇒ Object

Configure the Mathpix client.

Examples:

Mathpix.configure do |config|
  config.app_id = ENV['MATHPIX_APP_ID']
  config.app_key = ENV['MATHPIX_APP_KEY']
end

Yields:



30
31
32
# File 'lib/mathpix.rb', line 30

def configure
  yield configuration
end

.reset!Object

Reset configuration and client (mainly for tests).



47
48
49
50
# File 'lib/mathpix.rb', line 47

def reset!
  @configuration = Configuration.new
  @client = nil
end