PactFi MCP
Provides tools for interacting with the PactFi AMM DEX on the Algorand blockchain, enabling pool discovery, quote computation, and building unsigned swap/liquidity transactions.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@PactFi MCP swap 100 ALGO for USDC"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
pactfi-mcp
MCP (Model Context Protocol) server for the PactFi AMM DEX on Algorand. Part of the UluOS agent ecosystem.
Architecture
┌──────────────┐ ┌──────────────┐ ┌──────────────────┐
│ PactFi MCP │────▶│ UluWalletMCP │────▶│ UluBroadcastMCP │
│ (this repo) │ │ (signing) │ │ (submit to net) │
└──────┬───────┘ └──────────────┘ └──────────────────┘
│
├── PactFi REST API (api.pact.fi) ── pool discovery & metadata
└── Algorand algod (algonode.cloud) ── on-chain state & tx paramsNo PactFi SDK dependency — pools are queried via the PactFi REST API, quotes are computed locally using constant-product AMM math, and transactions are built directly with algosdk.
Related MCP server: Tapp Exchange MCP Server
Tools
Tool | Description |
| List PactFi pools with optional filters (symbol, verified, pool type) |
| Get detailed pool info by app ID (on-chain reserves + API metadata) |
| Compute swap quote with expected output, fee, price impact, and slippage |
| Build unsigned swap transaction group |
| Build unsigned add-liquidity transaction group |
| Build unsigned remove-liquidity transaction group |
Tool Details
get_pools
List PactFi liquidity pools. Supports filtering by token symbol, verification status, pool type (CONST or STABLE), and result limit.
get_pool
Fetch on-chain pool state (reserves A/B, LP supply, fee configuration) merged with API metadata (token names, prices, TVL, APR).
get_quote
Simulate a swap without building transactions. Provide fromToken/toToken symbols and an amount. Optionally specify poolAppId to target a specific pool, or let it auto-discover the highest-TVL pool for the pair.
swap_txn
Build a 2-transaction atomic group:
Deposit (payment or asset transfer) to pool escrow
Application call with
SWAP+ minimum received
add_liquidity_txn
Build a 3-transaction atomic group:
Deposit primary asset to pool escrow
Deposit secondary asset to pool escrow
Application call with
ADDLIQ+ minimum LP tokens
remove_liquidity_txn
Build a 2-transaction atomic group:
Deposit LP tokens to pool escrow
Application call with
REMLIQ+ minimum primary + minimum secondary
Agent Flow Example
Agent: get_quote(fromToken="ALGO", toToken="USDC", amount="100")
→ { expectedOutput: "8.52", minimumReceived: "8.47", poolAppId: 1073557308, ... }
Agent: swap_txn(fromToken="ALGO", toToken="USDC", amount="100", sender="ABC...")
→ { transactions: ["base64...", "base64..."], details: { ... } }
Agent: UluWalletMCP.sign_transactions(signerId="my-signer", transactions=["base64..."])
→ { signedTransactions: ["base64..."] }
Agent: UluBroadcastMCP.broadcast_transactions(network="algorand-mainnet", txns=["base64..."])
→ { txIds: ["TXID..."] }Setup
npm installUsage
node index.jsAdding to a Client
{
"mcpServers": {
"pactfi-mcp": {
"command": "node",
"args": ["/absolute/path/to/pactfi-mcp/index.js"]
}
}
}Data Sources
PactFi REST API (
api.pact.fi): pool listing, token metadata, TVL, volume, APRAlgorand algod (
mainnet-api.algonode.cloud): on-chain pool state, transaction parameters
Supported Pool Types
Constant Product (
CONST): Standard x·y=k AMM pools — fully supported for quotes and transactionsNFT Constant Product: Same AMM math as constant product — fully supported
Stableswap (
STABLE): Curve-style stable pools —get_quotereturns an approximate result (with warning);swap_txnrejects stableswap pools since the constant-product math cannot produce correct minimum-received values for on-chain execution
Known Limitations
Stableswap transactions: Building swap/liquidity transactions for stableswap pools is not supported. The on-chain contract uses the StableSwap (Curve) invariant which requires different math than constant-product.
get_quoteprovides an approximation with a warning.Pool discovery: The PactFi API is used for token metadata (symbols, decimals, prices). For specific pools, use the
appIdparameter directly.
License
MIT
Available Tools
6 toolsadd_liquidity_txnB
Build unsigned transactions to add liquidity to a PactFi pool. Returns base64-encoded transaction group for signing via UluWalletMCP.
Inputs: sender (required), poolAppId (required), primaryAmount (required), secondaryAmount (required), +1 more.
get_poolA
Get detailed PactFi pool information by application ID. Returns on-chain reserves, fee configuration, LP supply, and API metadata.
Inputs: appId (required).
get_poolsA
List PactFi AMM liquidity pools on Algorand with optional filters. Returns pool metadata, TVL, volume, and APR.
Inputs: limit, symbol, pool_type, is_verified.
get_quoteA
Get a swap quote from PactFi using constant-product AMM math. Computes expected output, fee, price impact, and minimum received after slippage. Provide either a poolAppId or fromToken+toToken symbols to auto-discover the best pool.
Inputs: amount (required), toToken (required), fromToken (required), slippage, +1 more.
remove_liquidity_txnA
Build unsigned transactions to remove liquidity from a PactFi pool. Returns base64-encoded transaction group for signing via UluWalletMCP.
Inputs: sender (required), lpAmount (required), poolAppId (required), slippage.
swap_txnA
Build unsigned transactions to swap tokens on PactFi. Returns base64-encoded transaction group for signing via UluWalletMCP. Finds the best pool automatically if poolAppId is not specified.
Inputs: amount (required), sender (required), toToken (required), fromToken (required), +2 more.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 6 tools
Each tool has a clearly distinct purpose: get_pools vs. get_pool differentiate list vs. detail, get_quote is a read-only calculation, swap_txn builds a swap transaction, and add/remove_liquidity_txn are separate liquidity actions. Descriptions reinforce these boundaries, leaving no realistic chance of misselection.
All tools follow a consistent snake_case verb_noun convention (get_pools, get_pool, get_quote, swap_txn, add_liquidity_txn, remove_liquidity_txn). The '_txn' suffix consistently marks transaction-building tools, and the singular/plural distinction in get_pool vs. get_pools is natural.
Six tools cleanly cover the core AMM operations: pool discovery, pool detail, quoting, swapping, and adding/removing liquidity. There is no redundancy or filler; each tool earns its place.
The surface covers the essential swap and liquidity lifecycle, but there are minor gaps such as querying a user's existing LP positions or accrued fees. These are plausible additions that agents could lack, though core workflows are fully supported.
Related MCP Connectors
Pay any Algorand x402 invoice with any asset, plus DEX swap quotes and unsigned builds.
Non-custodial DeFi for AI agents: swaps, concentrated liquidity (V3/V4) zaps + ranges, 5 EVM chains
Token and pool data, swap quotes, and unsigned transaction plans for Ekubo and other DeFi protocols.
Cross-network DeFi API data, AMM analytics, and SDK docs for 17+ networks.
Related MCP Servers
- AlicenseBqualityDmaintenanceEnables interaction with the Algorand blockchain network including account management, payments, asset creation and transfers, along with general utility tools. Provides secure mnemonic encryption and supports both testnet and mainnet environments.14ISC
- AlicenseBqualityDmaintenanceEnables AI agents to interact with Tapp Exchange, a decentralized exchange on Aptos blockchain. Supports pool management, trading operations across AMM/CLMM/Stable pools, liquidity provision, and position tracking through natural language.2111 npmMIT
- AlicenseNot gradedqualityDmaintenanceEnables interaction with the Algorand blockchain through 25+ specialized tools for account management, payments, asset creation, NFT operations, and network monitoring. Supports both mainnet and testnet with instant finality and low fees.1MIT
- AlicenseNot gradedqualityDmaintenanceEnables interaction with Tinyman AMM protocol on Algorand blockchain, supporting pool management, token swaps, liquidity operations, and analytics for both v1.1 and v2 protocols.1MIT