Skip to main content
Glama
Canton MCP Server

Canton MCP Server

by JohnLilic

Canton MCP Server

A read-only Model Context Protocol server that gives AI agents the ability to query Canton Network ledger data — active contracts, transactions, parties, and network status.

Works with Claude Code, Claude Desktop, GPT, Cursor, and any MCP-compatible AI agent.

Why read-only?

This is a deliberate security decision. AI agents should not write to financial ledgers without explicit human approval. This server provides read-only access — no contract creation, no choice exercises, no writes of any kind.

Related MCP server: Cartesi Knowledge MCP Server

Install

npm install -g canton-mcp-server

Or run directly:

npx canton-mcp-server

Configuration

The server reads these environment variables:

Variable

Default

Description

CANTON_LEDGER_HOST

localhost

Canton participant node host

CANTON_LEDGER_PORT

6865

Canton Ledger API gRPC port

CANTON_PARTY

Alice::1220abcdef

Default party for queries

CANTON_USE_MOCK

true

Use mock data (true) or connect to a real node (false)

Add to Claude Code

Add to ~/.mcp.json:

{
  "mcpServers": {
    "canton": {
      "command": "canton-mcp-server",
      "env": {
        "CANTON_USE_MOCK": "true"
      }
    }
  }
}

Add to Claude Desktop

Add to claude_desktop_config.json:

{
  "mcpServers": {
    "canton": {
      "command": "npx",
      "args": ["-y", "canton-mcp-server"],
      "env": {
        "CANTON_USE_MOCK": "true"
      }
    }
  }
}

Tools

canton_search_transactions

Search transactions by party, template ID, or time range.

Parameters: party, template_id, start_time, end_time, limit

> Search for all Iou transactions

{
  "source": "mock",
  "count": 2,
  "transactions": [
    {
      "transactionId": "tx-001-abcdef1234",
      "offset": "000000000000000010",
      "effectiveAt": "2025-01-15T10:30:00Z",
      "events": [...]
    }
  ]
}

canton_get_transaction

Get full details of a specific transaction.

Parameters: transaction_id (required)

> Get transaction tx-001-abcdef1234

{
  "source": "mock",
  "transaction": {
    "transactionId": "tx-001-abcdef1234",
    "events": [
      {
        "kind": "created",
        "event": {
          "contractId": "#1:0",
          "templateId": { "moduleName": "Daml.Finance.Iou", "entityName": "Iou" },
          "payload": { "issuer": "Bank::...", "owner": "Alice::...", "amount": "1000000.00" }
        }
      }
    ]
  }
}

canton_list_active_contracts

List active contracts with optional filters.

Parameters: party, template_id, limit

> List all active Account contracts

{
  "source": "mock",
  "count": 1,
  "contracts": [
    {
      "contractId": "#3:0",
      "templateId": { "moduleName": "Daml.Finance.Account", "entityName": "Account" },
      "payload": { "owner": "Alice::...", "accountId": "ACC-001" }
    }
  ]
}

canton_get_contract

Get a specific contract by ID.

Parameters: contract_id (required)

> Get contract #1:0

{
  "source": "mock",
  "contract": {
    "contractId": "#1:0",
    "templateId": { "moduleName": "Daml.Finance.Iou", "entityName": "Iou" },
    "payload": { "currency": "USD", "amount": "1000000.00" },
    "signatories": ["Bank::...", "Alice::..."]
  }
}

canton_list_parties

List all known parties on the ledger.

Parameters: none

> List parties

{
  "source": "mock",
  "count": 3,
  "parties": [
    { "partyId": "Alice::1220abc...", "displayName": "Alice", "isLocal": true },
    { "partyId": "Bob::1220fed...", "displayName": "Bob", "isLocal": true },
    { "partyId": "Bank::1220aab...", "displayName": "Global Bank", "isLocal": false }
  ]
}

canton_network_status

Get network health information.

Parameters: none

> Check network status

{
  "source": "mock",
  "status": {
    "participantId": "participant1::1220aabb",
    "ledgerId": "canton-ledger-mock",
    "healthy": true,
    "activeContractCount": 4,
    "knownPartyCount": 3,
    "latestOffset": "000000000000000012"
  }
}

Connecting to a real Canton node

The server ships with a GrpcCantonClient stub in src/canton-client.ts. To connect to a real Canton participant node:

  1. Install gRPC dependencies:

    npm install @grpc/grpc-js @grpc/proto-loader
  2. Obtain Canton proto files from the Canton repository under canton/community/ledger-api/src/main/protobuf/.

  3. Generate TypeScript bindings:

    npx proto-loader-gen-types \
      --longs=String --enums=String --defaults --oneofs \
      --grpcLib=@grpc/grpc-js \
      -O ./src/generated \
      proto/com/daml/ledger/api/v2/*.proto
  4. Implement the methods in GrpcCantonClient (see the class JSDoc for which Canton API services map to each method).

  5. Run with mock disabled:

    CANTON_USE_MOCK=false CANTON_LEDGER_HOST=your-node CANTON_LEDGER_PORT=6865 canton-mcp-server

Data source indicator

Every response includes a source field:

  • "source": "mock" — data is from the built-in mock client

  • "source": "live" — data is from a real Canton participant node

AI agents can use this to indicate confidence in their answers.

Development

npm install
npm run build
npm test

Roadmap

This server is read-only by design. Planned additions:

  • Implement GrpcCantonClient against a real Canton testnet

  • Add write tools (canton_create_contract, canton_exercise_choice) behind an explicit opt-in flag, after testing against real nodes

  • Add streaming support for real-time transaction feeds

  • Publish to npm registry

License

BSD-0-Clause

Available Tools

6 tools
canton_get_contractA

Get a specific active contract by contract ID. Returns the full payload, signatories, observers, and metadata.

Inputs: contract_id (required).

canton_get_transactionB

Get details of a specific Canton transaction by ID. Returns the full event tree including created and archived events.

Inputs: transaction_id (required).

canton_list_active_contractsA

List active contracts on the Canton ledger, optionally filtered by template ID and/or party. Returns contract ID, template, payload, signatories, and observers.

Inputs: limit, party, template_id.

canton_list_partiesA

List known parties on the Canton ledger. Returns party ID, display name, and whether the party is local.

Inputs: no named parameters.

canton_network_statusA

Get Canton network health and status information. Returns participant ID, ledger ID, health status, counts, and latest offset.

Inputs: no named parameters.

canton_search_transactionsA

Search Canton ledger transactions by party, template ID, or time range. Returns transaction ID, offset, effective time, and events.

Inputs: limit, party, end_time, start_time, +1 more.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A3.7/5.0

    Scored across 6 tools

    Disambiguation5/5

    Each tool targets a distinct resource and action: searching transactions vs getting one transaction, listing contracts vs getting one contract, listing parties, and fetching network status. The boundaries are clear, and the descriptions reinforce the distinctions.

    Naming Consistency4/5

    All tools use a consistent snake_case convention with the canton_ prefix. Most follow verb_noun, but canton_network_status is a noun phrase rather than a verb-led name, which is a minor deviation.

    Tool Count5/5

    Six tools are well-scoped for a Canton ledger inspection server. Each tool earns its place by covering a distinct query or inspection need without obvious redundancy.

    Completeness3/5

    The server covers read-side inspection of transactions, contracts, parties, and network status. However, it lacks any mutation or lifecycle operations such as submitting commands, creating or exercising contracts, or party management, which are notable gaps for a Canton ledger server.

    Maintenance

    ActivityInactive
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • F
      license
      A
      quality
      C
      maintenance
      A server that exposes blockchain data (balances, tokens, NFTs, contract metadata) via the Model Context Protocol, enabling AI agents and tools to access and analyze blockchain information contextually.
      18
      47
      -
    • F
      license
      Not graded
      quality
      D
      maintenance
      Enables AI agents to query curated Cartesi developer resources, documentation, and repository metadata through the Model Context Protocol. Provides read-only knowledge access and host-side workflow guidance for building Cartesi blockchain applications via streamable HTTP.
      -
    • A
      license
      A
      quality
      D
      maintenance
      Enables AI agents to query Fangorn subgraph schemas and conformant data from published data sources via the Model Context Protocol.
      13
      2
      ISC
    • A
      license
      Not graded
      quality
      D
      maintenance
      Enables natural language queries to a company database through the Model Context Protocol, with read-only enforcement and agentic error recovery.
      MIT