1. Set Environment Variables
    • Required environment variables:
      • API_TOKEN: your-api-token
  2. Install Meshagent CLI
    pip install "meshagent[all]"
    
  3. Authenticate with Meshagent
  4. Start the Test Handwriting OCR MCP Server in a Meshagent Room
    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-test
    
    • This command starts a Meshagent Room with the test MCP server running as an agent.
    • Note: Rooms will automatically close if they go inactive; tools and the chatbot are removed.
  5. Start a Chatbot in the Room
    meshagent chatbot join \
      --room=test \
      --agent-name=mcp-handwriting-ocr \
      --name=mcp-handwriting-ocr \
      --toolkit=mcp-handwriting-ocr
    
    • This launches a chatbot in the same room, using the Handwriting OCR toolkit.
    • Multiple toolkits can be added to the same agent or room.
    • The room URL will be displayed in the output.
  6. Interact
    • Visit the room link in your browser and send a message to the agent to access the MCP server tools.

Project-Level Deployment (Persistent Services)

For production or recurring use, deploy the MCP server and chatbot as project-level services. These will be automatically available in every new Meshagent room within your project, removing the need to start/stop agents manually.
  1. Create Persistent MCP Server Service
    meshagent service create \
      --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
    
  2. Create Persistent Chatbot Service
    meshagent service create \
      --image="meshagent/cli:latest" \
      --port="num=9001 path=/agent liveness=/ type=meshagent.callable participant_name=mcp-handwriting-ocr-chatbot" \
      --env="MESHAGENT_PORT=9001" \
      --name="mcp-handwriting-ocr-chatbot-service" \
      --command="meshagent chatbot service --agent-name=mcp-handwriting-ocr-chatbot --toolkit=mcp-handwriting-ocr"
    
These services will always join each new room created in your project, with the required tools available for instant use.

Tools Available

This MCP Server provides the following tools:
ToolShort Description
check_statusCheck the status of a document
get_textRetrieve the transcribed text from a document
upload_documentUpload a document to Handwriting OCR API for transcription

Tool 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 Handwriting OCR API for transcription
ParameterTypeDescription
filestringPath to the document (PDF, JPG, PNG, etc.)
delete_afterinteger (optional)Seconds until auto-deletion (optional)
extractor_idstring (optional)Extractor ID (required if action is extractor, will be ignored)
prompt_idstring (optional)Prompt ID (requires Enterprise subscription, will be ignored)