Shodai Agreements
This server manages the full lifecycle of on-chain agreements — from authoring and validation through deployment, input submission, and history inspection.
Read & Query
List agreements: Browse summaries with pagination, filtering by chain ID, lifecycle state, date ranges, and sorting.
Get agreement: Retrieve a full record including authored JSON, participants, observers, owner, and deployment address.
Get agreement document: Fetch the rendered prose document (content type, display name, chain, docUri, record references).
Get agreement state: Check the current lifecycle state of a deployed agreement; useful for polling after input submission.
Get input history: Inspect past inputs with filtering by status (
PENDING,MINED,FAILED) or input ID, with pagination.
Validation & Preflight
Validate agreement structure: Check authored agreement JSON for structural correctness — returns participant variable keys, input IDs, state IDs, and warnings without touching deployment.
Preflight deployment: Verify the agreement JSON, target chain, deployment values, participant wallet mappings, and observer context are ready before signing anything.
Signing Preparation
Prepare deployment typed data: Build the exact EIP-712 payload to authorize deployment; sign externally, then call deploy.
Prepare input typed data: Build the exact EIP-712 payload to authorize submitting an input; sign externally, then call submit.
Write & Execution
Deploy agreement: Deploy an authored agreement on-chain using a pre-signed EIP-712 permit.
Submit input: Submit a signed input to a deployed agreement to advance its on-chain lifecycle state.
This server has a remotely hosted endpoint. Open its connector listing for connection details, authentication requirements, and setup instructions:
Shodai Agreements SDK + MCP
Shodai turns agreement definitions into machine-readable, verifiable coordination workflows for humans, products, and AI agents. Agreements carry readable terms plus participants, valid inputs, states, transitions, and history.
This repository supports builders using the TypeScript SDK, agents or tools using MCP, and the canonical Shodai Reference App built on top of the SDK.
Start Here
Need | Start |
Understand Shodai | |
Get access | |
Build | Choose SDK vs MCP · MCP quickstart · TypeScript SDK quickstart · End-to-end workflow |
Hosted MCP: https://shodai.network/mcp is the Shodai Agreements execution MCP endpoint. OAuth-capable clients connect through browser sign-in and consent for testnet access. The endpoint uses Streamable HTTP, requires an environment tool argument, supports environment-scoped API keys as a fallback, and has no hosted private-key custody.
Packages and apps: @shodai-network/agreements-api-client · @shodai-network/agreements-mcp-server · agreements-api-playground · shodai-reference-app · oauth-connect-cli (shodai-oauth)
Related MCP server: dpay-mcp
Why Builders Use Shodai Agreements
Shared agreement state that humans, applications, and agents can inspect.
Deterministic next actions from authored states, inputs, issuers, and transitions.
Validation and deployment preflight before signatures.
EIP-712 signed authorization for deployment and participant inputs.
State and input history for receipts and monitoring.
Less repeated contract orchestration, indexing, and participant workflow plumbing.
Choose Your Path
Path | Use it when | First success |
MCP / agent tools | An agent or MCP-capable client will work with agreements through hosted Streamable HTTP or local stdio. | Authenticate, read or list where permitted, validate an example, preflight deployment, and prepare deploy typed data. |
TypeScript SDK | You are building a TypeScript application or service. | Authenticate, read or list agreements, validate an example, preflight deployment, and prove local EIP-712 signing readiness. |
Both paths converge on the same agreement lifecycle. After one quickstart works, run the end-to-end workflow.
Hosted MCP Endpoint
Configure Shodai as a remote Streamable HTTP MCP server:
URL:
https://shodai.network/mcp
Required API-calling tool argument:
environment: "testnet"Start the connection in an OAuth-capable client, then complete Shodai browser sign-in and consent. The hosted endpoint advertises the testnet authorization server, so use environment: "testnet" for this OAuth connection.
Clients without OAuth support can send Authorization: Bearer cns_pk_.... API keys only work in the environment where they were created; a production key can use environment: "production". Hosted MCP never receives private keys; write tools use externally signed EIP-712 permits or typed-data preparation.
An ordinary browser GET to /mcp may return 405 because the endpoint expects MCP protocol requests. MCP surfaces on docs.shodai.network are for docs and search only; https://shodai.network/mcp is the Agreements execution endpoint.
MCP quickstart: docs.shodai.network/sdks/quickstart-with-mcp
MCP package docs:
packages/agreements-mcp-server/README.mdExecution server card: shodai.network/.well-known/mcp/server-card.json
MCP catalog: shodai.network/.well-known/mcp/catalog.json
What This Repository Contains
Package or app | Location | Purpose |
| Typed REST client for the Agreements API with | |
| Local MCP server package aligned with the hosted Agreements execution MCP surface. | |
| Reference Vite app for browser API experimentation and SDK workflow examples. | |
| Full-stack React/Nest/Mongo reference implementation for developer platform auth, Agreements API usage, agreement lifecycle UX, signing, persistence, and webhook reconciliation. | |
| CLI that connects a public OAuth app to a user via authorization_code + PKCE, stores a refreshable session, and calls the Agreements API as that user. |
Install the TypeScript SDK
Most TypeScript consumers should install the published npm package rather than this monorepo:
npm install @shodai-network/agreements-api-clientAdd viem if you want the built-in permit-signing helpers for deploy and input submission:
npm install @shodai-network/agreements-api-client viemCreate a client with a named Shodai environment:
const client = new ApiClient({
environment: 'testnet',
apiKey: process.env.AGREEMENTS_API_KEY,
});SDK usage and API lifecycle docs live in packages/agreements-api-client/README.md. For constructor options, methods, signing helpers, diagnostics, and exports, see the TypeScript client reference.
Run MCP Locally
Use the published MCP package for local stdio clients:
{
"mcpServers": {
"shodai-agreements": {
"command": "npx",
"args": ["-y", "@shodai-network/agreements-mcp-server"],
"env": {
"AGREEMENTS_API_KEY": "YOUR_API_KEY",
"AGREEMENTS_API_ENVIRONMENT": "testnet"
}
}
}
}Local stdio mode uses AGREEMENTS_API_ENVIRONMENT; hosted MCP uses the environment tool argument. See packages/agreements-mcp-server/README.md for self-hosting, environment variables, tools, resources, prompts, and Inspector usage.
Agreement Lifecycle
Phase | TypeScript SDK | MCP |
Author agreement JSON | Use complete agreement JSON artifacts and examples. | Read example resources or use the authoring prompt. |
Validate structure |
|
|
Preflight deployment |
|
|
Prepare or sign deployment permit | SDK signing helpers with |
|
Deploy |
|
|
Read state |
|
|
Prepare or sign input permit | SDK input-signing helpers |
|
Submit input |
|
|
Inspect history |
|
|
For a guided run through validation, deployment, signed input submission, state reads, and input history, use the end-to-end workflow.
Agreements API Environments
The SDK prefers a named environment instead of a raw host:
const client = new ApiClient({
environment: 'testnet',
apiKey: process.env.AGREEMENTS_API_KEY,
});Built-in mappings:
testnet->https://test-api.shodai.networkproduction->https://api.shodai.network
API keys are environment-scoped. Use a testnet key with testnet and a production key with production.
The client still supports baseUrl as an advanced override for local proxies, internal gateways, or non-standard deployments. It continues to add /v0/* automatically.
Local Development
# from the repository root
pnpm install
pnpm build
pnpm devThe default dev command starts the Shodai Reference App. Its backend defaults to http://localhost:4199 and its frontend defaults to http://localhost:5184/agreements/.
Stop the reference app dev stack with:
pnpm dev:stopSee apps/shodai-reference-app/README.md for the required local environment files.
Run the API playground explicitly with:
pnpm dev:playgroundThe playground defaults to http://localhost:5176. If that port is already in use, start the playground on another port:
pnpm --filter agreements-api-playground exec vite --host 127.0.0.1 --port 4176For local browser development, the playground is environment-first and defaults to testnet. Use the in-app environment selector to switch between hosted testnet and production API targets.
Optional package-specific validation commands:
pnpm --filter @shodai-network/agreements-api-client run lint
pnpm --filter @shodai-network/agreements-mcp-server testSee apps/agreements-api-playground/README.md for the full environment configuration.
Boundaries
Hosted MCP does not hold private keys. Hosted MCP browser OAuth and direct API delegated OAuth are supported connection paths; x402 payments are not a current setup path. Shodai agreements do not claim legal finality or fully autonomous enforcement. Shodai does not move value without authorized signed inputs.
Open Source Project Notes
API client consumer docs:
packages/agreements-api-client/README.mdAPI client maintainer notes:
packages/agreements-api-client/DEVELOPMENT.mdMCP server docs:
packages/agreements-mcp-server/README.mdPlayground docs:
apps/agreements-api-playground/README.mdRoot license: Apache-2.0
MCP package license: MIT
Available Tools
11 toolsdeploy_agreementDeploy agreementADestructiveInspect
Deploys authored agreement JSON using an EIP-712 permit; the API submits the on-chain transaction and returns the deployed agreement record. Provide a pre-signed permit (signer, deadline, signature), or call prepare_deployment_typed_data first to obtain the payload to sign. Always run preflight_deployment before deploying. Requires the agreements.write scope.
Inputs: agreement (required), displayName (required), docUri, signer, +9 more.
get_agreementGet agreementARead-onlyIdempotentInspect
Returns a single agreement record, including the full authored agreement JSON and hosted record context (participants, observers, owner, deployment address).
Inputs: agreementId (required).
get_agreement_documentGet agreement documentARead-onlyIdempotentInspect
Returns the rendered hosted prose document for an agreement by documentId, including content type, display name, chain, docUri, and agreement record references. Use documentId from list_agreements/get_agreement or from prepare_deployment_typed_data.
Inputs: documentId (required).
get_agreement_stateGet agreement stateARead-onlyIdempotentInspect
Returns the current state of an agreement. For deployed agreements, interpret the state against the states defined in the authored agreement lifecycle (execution.states). Use this to poll for transitions after submitting an input.
Inputs: agreementId (required).
get_input_historyGet input historyARead-onlyIdempotentInspect
Returns recorded input submissions for an agreement, with pagination and filtering. Use this to inspect which events have been submitted and whether each is PENDING, MINED, or FAILED.
Inputs: agreementId (required), limit, cursor, status, +1 more.
list_agreementsList agreementsARead-onlyIdempotentInspect
Lists agreement summaries visible to the current API key. Supports pagination (cursor + limit), filtering by chain and state, and sorting. Returns summaries only; use get_agreement for the full record.
Inputs: limit, state, cursor, sortBy, +6 more.
preflight_deploymentPreflight deployment requestARead-onlyIdempotentInspect
Checks whether authored agreement JSON plus target chain, deployment values, participant wallet mappings, and observer context are ready for deployment. This does not deploy the agreement and does not require a signature. Always run this before signing a deploy permit. Requires the agreements.write scope.
Inputs: agreement (required), chainId, observers, initValues, +1 more.
prepare_deployment_typed_dataPrepare deployment permit typed dataARead-onlyIdempotentInspect
Builds the exact EIP-712 payload that must be signed to authorize deployment of the given agreement JSON. Sign the returned typedData with the deploying wallet (eth_signTypedData_v4 / viem signTypedData), then call deploy_agreement with signer, deadline, and the signature components. No transaction is sent and nothing is stored. Reads the signer nonce from the target chain.
Inputs: chainId (required), agreement (required), signerAddress (required), docUri, +5 more.
prepare_input_typed_dataPrepare input permit typed dataARead-onlyIdempotentInspect
Builds the exact EIP-712 payload that must be signed to authorize submitting an input to a deployed agreement. Sign the returned typedData with a wallet allowed by the input definition, then call submit_input with signer, deadline, and the signature components. No transaction is sent and nothing is stored. Reads the agreement record and signer nonce.
Inputs: values (required), inputId (required), agreementId (required), signerAddress (required), +1 more.
submit_inputSubmit input with permitADestructiveInspect
Submits a signed input to a deployed agreement, advancing its on-chain lifecycle. The input ID and values must match an input defined by the agreement JSON, and the signer must be allowed by that input. Provide a pre-signed permit (signer, deadline, signature), or call prepare_input_typed_data first. Requires the agreements.write scope.
Inputs: values (required), inputId (required), agreementId (required), signer, +4 more.
validate_agreementValidate agreement structureARead-onlyIdempotentInspect
Checks only the authored agreement JSON document and returns participant variable keys, input IDs, state IDs, and warnings. This does not validate deployment values, participant wallet addresses, signer, or permit data — use preflight_deployment for that. Iterate on the agreement JSON until this returns no blocking warnings. Requires the agreements.write scope.
Inputs: agreement (required).
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 11 tools
Each tool targets a distinct action or resource. There is no ambiguity between deploy, get, list, preflight, prepare, submit, validate operations. Even similar-sounding tools like get_agreement and get_agreement_document are clearly differentiated by their descriptions and return types.
All tool names consistently use snake_case with a verb_noun pattern. The verbs are descriptive (deploy, get, list, preflight, prepare, submit, validate) and the nouns accurately reflect the resource or context. Naming is predictable and systematic.
With 11 tools covering the full lifecycle of agreement management—from validation and preflight to deployment, state queries, and input submission—the count is well-scoped. Each tool serves a clear purpose without redundancy or bloat.
The tool set covers the core workflows: validation, deployment preparation/signing, deploying, reading agreements/documents/state, listing, submitting inputs, and inspecting history. Missing are update/amend or delete/terminate operations, but these may be outside the domain's scope given the immutable nature of deployed agreements.
Maintenance
Related MCP Connectors
MCP server for Boson Protocol — on-chain agentic commerce for physical & digital goods.
Self-hosted MCP server: 26 deterministic dev, security, and EVM tools.
MCP server for mandates, delegation, policy-gated execution, credential grants, and audit.
MCP server for the Z1N Protocol - on-chain identity for AI agents on Polygon
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceMCP server for temporal state queries and cryptographic audit trails. Query historical entity state at any point in time, generate Merkle proofs of past state, and anchor contract snapshots for immutable provenance.MIT
- AlicenseAqualityDmaintenanceAn MCP server for creating, settling, disputing, and refunding escrows on EVM chains.84 npmApache 2.0
- AlicenseNot gradedqualityCmaintenanceProvides a sovereign, MIT-licensed MCP server for professional-service workflows, running entirely on your infrastructure with Ed25519 cryptographic signing for every action.MIT
- AlicenseNot gradedqualityCmaintenanceAn MCP server that exposes nine local-first contract-ops CLIs as tools for contract extraction, linting, comparison, conversion, template vaults, and signed-contract vaults, with signing operations strictly human-gated.66 npmMIT