Run Handwriting OCR MCP Agent and Tool in a Meshagent Room

These instructions will help you deploy the Handwriting OCR MCP server as a tool, and connect an agent in a Meshagent Room to use this tool.

Environment Variables Needed

  • API_TOKEN: your-api-token
    (Token for authenticating with the MCP server)

Step-by-Step

  1. Install Meshagent (and all dependencies):

    pip install "meshagent[all]"
    
  2. Sign up and authenticate with Meshagent:

  3. Start the MCP Handwriting OCR server in a Meshagent Room (cloud):

    meshagent service test \
      --room=test \
      --role=agent \
      --image=meshagent/mcp-handwriting-ocr:latest \
      --env MESHAGENT_PORT=8001 \
      --env API_TOKEN=your-api-token \
      --port="num=8001 path=/webhook liveness=/ type=meshagent.callable" \
      --name=mcp-handwriting-ocr-service
    
    • This command will start a Meshagent room with the MCP server accessible as a toolkit. Rooms are ephemeral and may close if inactive.
  4. Connect a chatbot to the Meshagent Room, loading the MCP tool:

    meshagent chatbot join \
      --room=test \
      --agent-name=sample \
      --name=sample \
      --toolkit=mcp-handwriting-ocr
    
    • This starts a chatbot in your Meshagent room, letting you interact with the Handwriting OCR API via the agent.
    • Multiple MCP toolkits can be loaded into one room by the same or different agents.
    • The output will include a URL link to the room—use it to interact with the agent and tools via the Meshagent UI.

Tools Available

Below are the tools exposed by the MCP Handwriting OCR server when integrated with Meshagent:

Tools Summary

ToolShort Description
check_statusCheck the status of a document
get_textRetrieve the transcribed text
upload_documentUpload a document for transcription

Tools Details

check_status

Check the status of a document.

ParameterTypeDescription
idstringDocument ID

get_text

Retrieve the transcribed text from a document.

ParameterTypeDescription
idstringDocument ID

upload_document

Upload a document to the Handwriting OCR API for transcription.

ParameterTypeDescription
filestringPath to the document (PDF, JPG, PNG, etc.)
delete_afterinteger*(Optional) Seconds until auto-deletion
extractor_idstring*(Optional) Extractor ID (required if action is extractor, will be ignored)
prompt_idstring*(Optional) Prompt ID (requires Enterprise subscription, will be ignored)

Meshagent Resources


For more about MCP Servers:
What is an MCP Server?

Why is it safer to run MCP Servers with Docker?
Read the Docker blog