mesa-mcp
tercet
기계 결제의 기록 원장. 모든 에이전트의 구매는 발생하는 즉시 기록되고(요청 → 견적 → 서명된 승인), 온체인 정산과 대조됩니다. 그리고 모든 차이에는 이름이 있습니다 — 전달되었으나 수집되지 않음, 지급되었으나 전달되지 않음, 재전송, 체인 고아. tercet은 키, 잔액, 결제 경로를 절대 건드리지 않습니다. 단지 관찰하고 증거를 생산합니다.
tercet은 함께 속한 세 줄로 이루어진 연입니다. 여기서 모든 구매는 하나의 tercet입니다. 요청, 승인, 정산. 단테는 자신의 tercet들을 연결해 그중 하나만 빼도 시가 무너지도록 만들었습니다. 이 원장도 항목을 같은 방식으로 연결합니다.
Python 패키지는 여전히 mesa(작업 이름)로 불리며, 첫 번째 PyPI 배포에서 tercet으로 이름이 바뀝니다. docs/ 아래의 프로젝트 문서는 포르투갈어로 작성되어 있습니다. 빌드 일지와 단계별 설계 문서이며, 코드, 스키마, 이 README는 영어입니다.
앱 — 실시간 원장, 여섯 개 화면
uv run mesa-app # -> http://127.0.0.1:840001 블로터 (에이전트가 구매한 것, 도출된 상태와 각 구매의 이벤트 체인) · 02 TCA (낭비, 에이전트 간 중복 제거, 전달된 결과당 비용) · 03 리스크 (작업 트리별 예산, 사람의 승인, 지급자 패스포트) · 04 랩 (특정 시점의 지출 정책 백테스트, 정직한 신뢰 구간) · 05 장부 (세 가지 대사, 두 제3자 타임스탬프로 봉인된 기간, 거래처별 명세서, BR 세무 뷰) · 06 운영 (검증된 엔진을 화면에서 실행 — 데모, 수집기, 내보내기 — testnet 전용).
이 앱은 구조적으로 읽기 전용입니다. Postgres 세션은 default_transaction_read_only=on으로 열리므로, 앱이 아무리 원해도 원장에 쓸 수 없습니다 — tests/test_app.py가 이를 증명합니다. 항상 실제 데이터만 표시되며, 테스트넷/합성 행은 화면에 직접 라벨로 표시됩니다. 어떤 pill을 눌러도 그 범례가 표시됩니다.
Related MCP server: ACA PoC MCP Tools Server
MCP 서버 — 에이전트를 위한 도구인 원장
claude mcp add tercet -- uv run mesa-mcp # then ask: "how much did my agents spend?"일곱 가지로 정해진 읽기 전용 도구(폐쇄 목록, 테스트로 증명됨): status_do_livro, gasto, compras (필터 가능), compra (하나의 구매 + 이벤트 체인), vereditos, passaportes, fiscal. 앱과 동일한 보장: 세션은 구조적으로 읽기 전용입니다 — MCP 서버에는 쓰기 경로가 없으며 tests/test_source_livro.py가 이것을 증명합니다. 전송: stdio, 로컬.
내보내기 — 범용 회계 + OECD CARF 뷰
uv run python scripts/fase13/contabil_build.py # -> contabil/<yyyy-mm>/ (universal CSV, QuickBooks, Xero + per-tx audit detail)
uv run python scripts/fase13/carf_build.py # -> fiscal/carf/<year>/ (OECD CARF view, born as OECD11 test data)기간별 복식부기 일지(차변 == 대변 증명, 소액 결제를 정직하게 요약하며, 모든 법적 센트를 tx 해시에 연결하는 6자리 소수 감사 브리지)와 CARF 뷰 — 즉, 신고 의무가 있는 암호자산 서비스 제공자가 OECD 프레임워크(공식 2025년 7월 가이드)에 따라 이 거래들에 대해 신고할 내용을 보여줍니다 — 데모 라벨, 합성 신성, 실제 숫자. 자세한 내용과 주의점: docs/fase13-export.md.
처음부터, 이 README만으로
전제 조건: uv, Docker, Python 3.11+.
# 1. dependencies + database (Postgres 17 on 127.0.0.1:5433 — your machine only)
uv sync
docker run -d --name mesa-pg -e POSTGRES_USER=mesa -e POSTGRES_PASSWORD=mesa `
-e POSTGRES_DB=mesa -p 127.0.0.1:5433:5432 `
-v mesa-pgdata:/var/lib/postgresql/data postgres:17
uv run python scripts/check_db.py # migrations + hash-chain genesis, idempotent
# 2. TEST wallets (written to a local .env; never committed) + faucet USDC
uv run python scripts/setup_wallets.py
# -> paste the buyer address into https://faucet.circle.com (USDC / Base Sepolia)
uv run python scripts/check_balance.py # balance read on-chain
# 3. a toy seller + 10 REAL x402 payments on testnet
uv run uvicorn mesa.http.seller:app --port 8402 # terminal 1
uv run python scripts/fase1/buyer.py 10 # terminal 2 (writes the ledger)
# 4. the chain is the source of truth: collect and reconcile
uv run python -m mesa.collector # matches (authorizer, nonce) with the ledger
uv run python -m mesa.cli # the verdict table, orphans in red
# 5. the product
uv run mesa-app # -> http://127.0.0.1:8400비용은 실제 금액 기준 0원입니다: faucet USDC를 사용하며, exact 스킴에서는 파시시 미터가 가스를 지불합니다.
무슨 일이 있었고, 무엇을 증명했으며, 다음에는 무엇인가: docs/DIARIO.md (포르투갈어) — 작업 항목별 빌드 일지; 단계별 설계 문서는
docs/faseN.md에 있습니다.보안 값 (
setup_wallets.py가 생성하는 개인 키)은 로컬.env파일에 저장합니다(git에서 제외, 커밋 금지). 다른 위치에 저장하려면MESA_ENV_FILE을 해당 파일을 가리키게 하세요 — 그리고 항상 동기화 폴더(OneDrive/Dropbox) 밖에 두세요. 동기화 폴더 속 키는 곧 클라우드 속 키입니다.
저장소 지도
경로 | 용도 |
| 상수(USDC, 네트워크, 체인 ID) + |
| 원장 액세스 — 구조상 삽입 전용 |
| 핵심: 세방향 대사(three-way reconciliation), 순수 함수 |
| 온체인 수집기: txHash당 |
|
|
| HTTP 레일: 테스트 판매자(혼동 모드 포함) + 계측 방식 구매자 |
| MCP : 유료 도구 레일(판매자/구매자) + |
| 지불자 패스포트: 동작 가능한, 자체 서명된 정산 이력 |
| 내보내기 렌더러(회계 / OECD CARF / 브라질) |
| 번호가 매겨진 순수 SQL — 레일과 전송에 무관한 스키마 |
| 환경 유틸리티 + |
| pytest 게이트: 오염된 데이터 입력 → 기대 분류 출력 |
| 빌드 일지 + 단계별 설계 문서(포르투갈어) |
| 독립 검증기 — 이 저장소를 신뢰하지 않고 원장과 패스포트를 확인합니다 |
환경
uv sync
docker run -d --name mesa-pg -e POSTGRES_USER=mesa -e POSTGRES_PASSWORD=mesa `
-e POSTGRES_DB=mesa -p 127.0.0.1:5433:5432 `
-v mesa-pgdata:/var/lib/postgresql/data postgres:17
# 127.0.0.1 is mandatory: without it the ledger is open to any machine on the same
# Wi-Fi (docs/seguranca.md, hole #1). scripts/saude.py checks this, always.
uv run python scripts/setup_wallets.py # generates the EOAs -> .env (NEVER committed)
uv run python scripts/check_db.py # Postgres up + migrations + genesis
uv run python scripts/check_balance.py # USDC balance read on-chain
uv run python scripts/saude.py # ONE command: ruff+mypy+pytest+verifier+ports+secret scan
uv run python scripts/backup_db.py # ledger dump -> backups/ (routine, ~5s)Faucet: https://faucet.circle.com → USDC → Base Sepolia (주소당 20 USDC / 2시간). Anthropic 키(운이없는 인보이스 레일 에이전트 데모에만): ANTHROPIC_API_KEY=... 를 시크릿 환경 파일에 입력하세요.
각 단계의 증명 실행
# Phase 1 — the ledger closes on dirty data
uv run uvicorn mesa.http.seller:app --port 8402 # terminal 1: HTTP seller
uv run python scripts/fase1/chaos_run.py # terminal 2: chaos + reconciliation + asserts
# Phase 2 — x402 over MCP
uv run python -m mesa.mcp.seller # terminal 1: MCP seller (port 8403)
uv run python scripts/fase2/mcp_once.py # terminal 2: 1 paid tool call + ledger
# Phase 10 — the payer passport (emits, verifies, gates a seller)
uv run python scripts/fase10/gate10_demo.py
# Any time: sweep the chain and reconcile
uv run python -m mesa.collector # testnet (seller payTo)
uv run python -m mesa.collector --pagador # mainnet (payer-side)
uv run python -m mesa.cli품질(“완료”에는 정의가 있습니다)
uv run python scripts/saude.py # ONE command: ruff+mypy+pytest+verifier+ports+secret scan발사 모델과 범위 밖 것은 여기 이름으로 정확히 명시합니다: docs/seguranca.md.
Available Tools
7 toolscompraB
Uma compra específica (por rid, vindo de 'compras') com a cadeia de eventos dela — a gaveta do blotter.
Inputs: rid (required). Returns: object
comprasC
As compras do livro, mais recentes primeiro, com filtros: estado (um de liquidado, pago-sem-entrega, entregue-sem-cobrar, cobranca-pendente, expirou-sem-uso, autorizado-pendente, sem-pagamento, fatura-conciliada, fatura-pendente, ingerido), rede (CAIP-2), trilho (x402/invoice/mpp/ap2), agente, contem (texto no domínio) e limite (1-100, padrão 20).
Inputs: rede, agente, contem, estado, +2 more. Returns: object
fiscalB
A competência fiscal BR (DeCripto, F11): nº de saídas mainnet, total em R$ pela PTAX persistida e o veredito do limiar de obrigação PF. Sem ano/mes usa a competência atual (data de SP).
Inputs: ano, mes. Returns: object
gastoB
Resumo do gasto no livro inteiro: real (mainnet) vs testnet vs invoice, por trilho, por agente, por dia, e o desperdício (mesmo recurso, mesmo byte, comprado de novo).
Inputs: no named parameters. Returns: object
passaportesB
Os passaportes de pagador (F10) emitidos neste checkout, RE-VERIFICADOS offline nesta chamada: íntegro?, aceito pela política?, motivos nomeados, métricas assinadas.
Inputs: no named parameters. Returns: object
status_do_livroA
Até onde o livro está atualizado: cursores do coletor (bloco por rede) e a corrente de hash (seq/elos). Chame antes de confiar em qualquer número — o livro nunca finge tempo real.
Inputs: no named parameters. Returns: object
vereditosC
A reconciliação de três pontas (pedido × autorização × chain) feita AGORA: contagem por veredito nomeado, com a explicação de cada um. Uma diferença nunca é um gap silencioso.
Inputs: no named parameters. Returns: object
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 7 tools
Each tool targets a distinct aspect of the financial domain: status check, spending summary, purchase listing, purchase detail, reconciliation verdicts, payer verification, and tax calculation. No two tools have overlapping purposes, and even the singular/plural pair (compra/compras) is clearly differentiated.
All tool names are lowercase Portuguese nouns (e.g., gasto, compras, vereditos). The only deviation is status_do_livro, which uses underscores and is more descriptive. While the pattern is consistent in being noun-based, the mixed style (underscore vs. single-word) is a minor inconsistency.
With 7 tools, the server is well-scoped for a financial reporting and reconciliation service. Each tool covers a necessary function without being overly granular or bloaty, fitting comfortably in the optimal 3-15 tool range.
The tool set covers the full read-only lifecycle for the domain: status checking, spending summaries, purchase listing and detail retrieval, three-way reconciliation, passport verification, and tax computation. There are no obvious gaps for the server's apparent purpose of audit and analysis.
Maintenance
Related MCP Connectors
Read your Golem fleet's ledger from any MCP client: agents' sessions, live activity, signed record.
Read-only gateway for durable agent identity, consent, recognized work, and signed receipts.
Ledger of AI-agent money on Base: payments, detections, Gate, signed Pass, Agent Books, free checks
Read-only discovery for exact-commit Agent Skill validation, x402 payment, and signed receipts.
Related MCP Servers
- AlicenseNot gradedqualityCmaintenanceEnables agents to perform financial operations including categorization, reconciliation, and reporting on a tamper-evident, self-hosted ledger.AGPL 3.0
- AlicenseNot gradedqualityDmaintenanceProvides financial audit reporting and ledger query tools for AI agents, enabling generation of compliance, risk, and transaction reports and querying of transaction data, balances, and summaries from an in-memory SQLite database via MCP.MIT
- FlicenseNot gradedqualityDmaintenanceProvides a stateless Agent Chat Protocol bridge that lets agents inspect proposed payments against policy, retrieve public signed receipts, and verify their cryptographic proofs without wallet or payment capabilities.-
- AlicenseAqualityBmaintenanceEnables read-only, keyless queries of timestamped, definition-backed data about AI agent payments and activity on Base, including rankings, agent records, detections, metric histories, and evidence-pack pricing, from MCP clients or the terminal.29333 npmApache 2.0