Skip to content

feat: add @evolution-sdk/mcp — Model Context Protocol server with 66 tools#207

Open
FractionEstate wants to merge 11 commits intoIntersectMBO:mainfrom
FractionEstate:feat/mcp-server
Open

feat: add @evolution-sdk/mcp — Model Context Protocol server with 66 tools#207
FractionEstate wants to merge 11 commits intoIntersectMBO:mainfrom
FractionEstate:feat/mcp-server

Conversation

@FractionEstate
Copy link

@FractionEstate FractionEstate commented Mar 14, 2026

Summary

Adds @evolution-sdk/mcp, an HTTP-based Model Context Protocol server that exposes the full Evolution SDK surface as 66 callable tools for AI agents (GitHub Copilot, Claude, Cursor, and any MCP-compatible client).

The server starts automatically via postinstall and listens at http://localhost:10000/mcp.

What's Included

New Package: packages/evolution-mcp/

File Purpose
src/server.ts MCP server with 66 tool registrations
src/bin.ts HTTP entrypoint (StreamableHTTPServerTransport)
src/http.ts Express server setup with health endpoint
src/config.ts Environment-based configuration
src/codec.ts Generic CBOR codec helpers
src/sessions.ts Stateful client/tx-builder session management
src/index.ts Public API barrel
scripts/postinstall.mjs Auto-start background process on install
test/server.test.ts Comprehensive test suite (2200+ lines)

Tool Categories (66 tools)

Category Count Description
Meta / Introspection 3 SDK version, exported modules, session handle cleanup
Codecs & Encoding 8 Address, Assets, CBOR, Plutus Data, identifiers, typed-export (40+ modules), Bech32/bytes, CIP-68
Workflow 7 Client sessions, provider/wallet attachment, tx builder, build, sign/submit
Cryptography 5 BIP-39 mnemonics, BIP32-Ed25519, CIP-8/CIP-30 signing, Ed25519 signatures
Governance & Certificates 10 Anchors, certificates, voting, governance actions, proposals, DRep/committee certs, constitution, protocol params
Transaction Primitives 9 Inputs, outputs, body, mint, withdrawals, redeemers, collections, script refs
Value & Assets 5 Value arithmetic, Assets, CIP-67 units, Coin, Plutus Value
Scripts 4 Native scripts, Script union, UPLC inspection, evaluator discovery
Address Types 3 Base/Enterprise/Reward, PointerAddress, Byron
Data & Hashing 2 Plutus Data construction, Blake2b-256 hashing
Blueprints 2 CIP-57 parsing and TypeScript codegen
Network & Time 2 Network name/ID mapping, slot ↔ Unix conversion
Metadata & Credentials 2 Transaction metadata/AuxiliaryData, credential creation
Other 3 UTxO set operations, PoolParams, fee validation
Devnet 1 Docker cluster lifecycle, genesis UTxOs, epochs, exec, config

Documentation

  • New docs page: docs/content/docs/mcp/index.mdx with installation, tool categories, MCP client configuration (Claude, VS Code, Cursor), and usage examples
  • Updated docs/content/docs/meta.json to add MCP to sidebar navigation
  • Updated root README.md with MCP in architecture tree, package table, and core modules section

Token Optimization

Tools have been consolidated from an initial 81 down to 66 to reduce the tools/list payload size that LLM clients must process:

Metric Before After
Tool count 81 66
Payload bytes ~71 KB ~55 KB
Approx. tokens ~17.8K ~13.7K

Key consolidations:

  • client_attach_provider + client_attach_walletclient_attach (type discriminator)
  • sign_result_call + submit_builder_callresult_call (handle-based dispatch)
  • transaction_codec + witness_set_codec + script_codec → absorbed into typed_export_codec
  • bech32_codec + bytes_codecencoding_codec (prefixed actions)
  • cip68_codec tokenLabels → absorbed into plutus_data_codec_tools
  • 9 devnet tools → 1 unified devnet tool with action discriminator
  • All z.describe() annotations removed (Zod v4 schema descriptions used instead)
  • Tool descriptions trimmed to minimally-useful summaries

Package Coverage

Covers all four workspace packages:

  • @evolution-sdk/evolution — core SDK
  • @evolution-sdk/aiken-uplc — Aiken UPLC evaluator
  • @evolution-sdk/scalus-uplc — Scalus UPLC evaluator
  • @evolution-sdk/devnet — local development network

Configuration

Variable Default Description
EVOLUTION_MCP_HOST 127.0.0.1 Bind address
EVOLUTION_MCP_PORT 10000 Bind port
EVOLUTION_MCP_PATH /mcp MCP route
EVOLUTION_MCP_HEALTH_PATH /health Health route
EVOLUTION_MCP_SKIP_POSTINSTALL Skip auto-start

Testing

pnpm --filter @evolution-sdk/mcp build
pnpm --filter @evolution-sdk/mcp test

All tests pass. Build is clean with no TypeScript errors.

- Implemented session management with ClientSession, BuilderSession, ResultSession, SubmitSession, and ClusterSession types.
- Created SessionStore class for managing session records, including methods for creating, retrieving, updating, and deleting sessions.
- Added comprehensive tests for the HTTP server, covering various tools and functionalities, including client creation, transaction building, encoding/decoding, and more.
- Introduced TypeScript configuration files for building and testing, ensuring proper type checking and output management.
- Configured Vitest for testing with appropriate timeouts and exclusions.
- Implement tests for address building (enterprise, base, reward)
- Add tests for metadata tools (build, parse, buildAuxiliaryData)
- Include credential tools tests (makeKeyHash, makeScriptHash, fromCbor)
- Introduce DRep tools tests (fromKeyHash, fromBech32, alwaysAbstain, alwaysNoConfidence)
- Add value tools tests (onlyCoin, add, geq, getAda, isAdaOnly)
- Implement assets tools tests (fromRecord, lovelaceOf, getUnits, hasMultiAsset, merge, fromCbor)
- Include unit tools tests (fromUnit, toLabel, fromLabel)
- Add coin tools tests (add, subtract, compare, validate, maxCoinValue)
- Implement network tools tests (toId, fromId, validate)
- Add data construction tools tests (int, bytes, constr, list, match, isInt, isConstr)
- Include hash tools test (hashTransactionRaw)
- Verify all tools are listed in the client
- Implement tests for mint_tools including singleton, insert, getByHex, and policyCount actions.
- Add tests for withdrawals_tools covering singleton, size, entries, and isEmpty actions.
- Introduce tests for anchor_tools, certificate_tools, redeemer_tools, voting_tools, script_ref_tools, governance_action_tools, proposal_tools, tx_output_tools, and plutus_data_codec_tools.
- Ensure all tools are verified to be listed in the client.
…tificates, constitution, and protocol parameter updates
…ver functionality

- Implemented tests for transaction input, body, pointer address, plutus value, script, BIP32 key, and signature tools.
- Added documentation for the MCP server, detailing installation, usage, tool categories, and example interactions.
Copilot AI review requested due to automatic review settings March 14, 2026 17:21
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds @evolution-sdk/mcp, an HTTP-based Model Context Protocol server that exposes 81 callable tools from the Evolution SDK for AI agents. It includes the server implementation, session management, configuration, a postinstall bootstrap script, comprehensive tests, and documentation.

Changes:

  • New packages/evolution-mcp/ package with MCP server, HTTP entrypoint, session management, codec helpers, and a Linux-first postinstall auto-start script
  • Documentation page (docs/content/docs/mcp/index.mdx) and sidebar navigation update for MCP server usage
  • Updated root README.md with MCP package in architecture tree and package table

Reviewed changes

Copilot reviewed 17 out of 19 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
packages/evolution-mcp/package.json Package manifest with dependencies, scripts, and exports
packages/evolution-mcp/src/server.ts MCP server with 81 tool registrations (not in diff, referenced)
packages/evolution-mcp/src/http.ts HTTP server setup with health and MCP endpoints
packages/evolution-mcp/src/config.ts Environment-based configuration resolution
packages/evolution-mcp/src/codec.ts CBOR codec helpers for assets, addresses, UTxOs, transactions
packages/evolution-mcp/src/sessions.ts Stateful session management for clients, builders, results
packages/evolution-mcp/src/bin.ts CLI entrypoint for serving the MCP server
packages/evolution-mcp/src/index.ts Public API barrel export
packages/evolution-mcp/scripts/postinstall.mjs Linux-first auto-start bootstrap script
packages/evolution-mcp/test/server.test.ts Comprehensive integration test (2200+ lines)
packages/evolution-mcp/README.md Package documentation
docs/content/docs/mcp/index.mdx Documentation page for MCP server
docs/content/docs/meta.json Sidebar navigation update
README.md Root README updated with MCP references
pnpm-lock.yaml Lock file updated with new dependencies
packages/evolution-mcp/tsconfig*.json TypeScript configuration files
packages/evolution-mcp/vitest.config.ts Vitest test configuration
Files not reviewed (1)
  • pnpm-lock.yaml: Language not supported

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

FractionEstate and others added 5 commits March 14, 2026 18:26
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
- Add StdioServerTransport via 'evolution-mcp stdio' command
- Export startStdioServer from package index
- Update bin.ts with stdio command and updated usage text
- Update package README and docs page with stdio configuration
- Remove 207 z.describe() calls from parameter schemas (~10K chars saved)
- Trim all tool descriptions to ≤60 chars (~3.2K chars saved)
- Consolidate 9 devnet tools into 1 with action enum (81→73 tools)
- Reuse single McpServer instance across HTTP requests
- Add request queue to serialize concurrent MCP requests
- Update tests for devnet tool consolidation
…onBody, TransactionMetadatum, TransactionWitnessSet, and SDK builders

- Added PlutusData schema and interface to TSchema documentation.
- Expanded Transaction documentation with encoding and parsing sections, including new methods for handling CBOR bytes and hex.
- Updated TransactionBody documentation to include new methods for CBOR conversion with format.
- Introduced equality check for TransactionMetadatum in the documentation.
- Enhanced TransactionWitnessSet documentation with new methods for CBOR conversion with format.
- Updated SDK builders documentation to reflect changes in transaction fee calculations and deprecated options.
- Added measure-tools script for analyzing tool sizes in the evolution MCP.
Merge related tools to cut tools/list payload from 57,914 to 54,937 bytes (~13.7K tokens):

- client_attach_provider + client_attach_wallet → client_attach (type discriminator)
- sign_result_call + submit_builder_call → result_call (handle-based dispatch)
- transaction_codec + witness_set_codec + script_codec → absorbed into typed_export_codec
- bech32_codec + bytes_codec → encoding_codec (prefixed actions)
- cip68_codec tokenLabels → absorbed into plutus_data_codec_tools
- Add hasSubmit() to session store for result_call routing
- Update tests for all renamed/merged tools
- Delete temporary measure-tools.ts
@FractionEstate FractionEstate changed the title feat: add @evolution-sdk/mcp — Model Context Protocol server with 81 tools feat: add @evolution-sdk/mcp — Model Context Protocol server with 66 tools Mar 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants