- Home
- MCP servers
- Polygon
Polygon
- javascript
5
GitHub Stars
javascript
Language
6 months ago
First Indexed
2 months ago
Catalog Refreshed
Documentation & install
Readme and setup notes from the catalogue, plus a client-ready config you can copy for your MCP host.
Installation
Add the following to your MCP client configuration file.
Configuration
View docs{
"mcpServers": {
"dbillionaer-polygon-mcp": {
"command": "node",
"args": [
"path/to/polygon-mcp.js"
],
"env": {
"PRIVATE_KEY": "your_private_key_here",
"DEFAULT_NETWORK": "amoy",
"DEFAULT_SLIPPAGE": "0.5",
"ETHEREUM_RPC_URL": "https://eth-sepolia.g.alchemy.com/v2/YOUR_ALCHEMY_KEY",
"POLYGON_AMOY_RPC": "https://rpc-amoy.polygon.technology",
"POLYGONSCAN_API_KEY": "YOUR_EXPLORER_API_KEY",
"POLYGON_MAINNET_RPC": "https://polygon-rpc.com",
"DEFAULT_DEADLINE_MINUTES": "20"
}
}
}
}You can run a Polygon MCP Server to interact with the Polygon network via a standardized API. This server handles wallet operations, contract deployment, L2 bridging, DeFi actions, and transaction simulations, making it easier to build AI-assisted workflows that work with Polygon.
How to use
You will run the MCP server locally or as part of your MCP ecosystem and connect to it through an MCP client. The server exposes tools for wallet management, contract operations, bridge activities, DeFi interactions, and transaction simulation. Start the server with your configured environment, then call the available tools to perform actions such as checking balances, deploying contracts, bridging assets, swapping tokens, or simulating transactions before you execute them.
Key usage patterns include: setting up your wallet, listing balances, deploying contracts from templates, performing Layer 2 bridge operations, interacting with DeFi protocols, and running transaction simulations to estimate gas and outcomes before actual execution.
How to install
Prerequisites you need on your machine:
-
Node.js 18 or higher
-
npm
-
yarn
-
A Polygon wallet private key for signing transactions
-
RPC endpoints for Polygon Mainnet and Amoy Testnet
Install and run the server using the following steps.
npm install
npm start
For development with auto-restart use:
npm run dev
Additional setup and configuration
Create a .env file with the necessary network endpoints, API keys, and wallet details to enable the server to connect to Polygon and sign transactions.
# Network RPC endpoints
POLYGON_MAINNET_RPC=https://polygon-rpc.com
POLYGON_AMOY_RPC=https://rpc-amoy.polygon.technology
ETHEREUM_RPC_URL=https://eth-sepolia.g.alchemy.com/v2/YOUR_ALCHEMY_KEY
# API Keys
POLYGONSCAN_API_KEY=YOUR_EXPLORER_API_KEY
# Wallet (use secure key management in production)
PRIVATE_KEY=your_private_key_here
DEFAULT_NETWORK=amoy
# DeFi Configuration (Optional)
DEFAULT_SLIPPAGE=0.5
DEFAULT_DEADLINE_MINUTES=20
MCP server integration (config example)
To integrate this server with an MCP client, provide a local stdio command that starts the server process. The following example shows how to run the server directly from a Node.js script.
{
"mcpServers": {
"polygon": {
"command": "node",
"args": ["path/to/polygon-mcp.js"],
"env": {
"POLYGON_MAINNET_RPC": "https://polygon-rpc.com",
"POLYGON_AMOY_RPC": "https://rpc-amoy.polygon.technology",
"ETHEREUM_RPC_URL": "https://eth-sepolia.g.alchemy.com/v2/YOUR_ALCHEMY_KEY",
"POLYGONSCAN_API_KEY": "YOUR_EXPLORER_API_KEY",
"PRIVATE_KEY": "your_private_key_here",
"DEFAULT_NETWORK": "amoy",
"DEFAULT_SLIPPAGE": "0.5",
"DEFAULT_DEADLINE_MINUTES": "20"
},
"disabled": false,
"autoApprove": []
}
}
}
Available tools
get-address
Retrieve the address of the connected wallet.
get-testnet-pol
Request testnet POL from a faucet (Amoy testnet only).
list-balances
List native and known token balances for the connected wallet.
transfer-funds
Transfer native POL or ERC20 tokens to another address.
deploy-contract
Deploy a smart contract to Polygon from a template.
verify-contract
Verify a deployed contract on Polygonscan.
list-contract-templates
List available contract templates.
deposit-eth
Deposit ETH from Ethereum to Polygon.
withdraw-eth
Withdraw POL from Polygon back to Ethereum.
deposit-token
Deposit an ERC20 token from Ethereum to Polygon.
withdraw-token
Withdraw an ERC20 token from Polygon to Ethereum.
swap-tokens
Swap tokens using a DEX (e.g., QuickSwap).
get-swap-quote
Get a price quote for a token swap.
add-liquidity
Add liquidity to a QuickSwap pool.
uniswapV3SwapSingle
Execute a single-hop swap on Uniswap V3.
uniswapV3SwapMulti
Execute a multi-hop swap on Uniswap V3.
getUniswapV3QuoteSingle
Get quotes for single-hop Uniswap V3 swaps.
getUniswapV3QuoteMulti
Get quotes for multi-hop Uniswap V3 swaps.
getPolymarketInfo
Get information about a Polymarket market.
placePolymarketBet
Place a bet on a Polymarket market.
getPolymarketPositions
Get user positions for a Polymarket market.
simulate-transaction
Simulate a transaction to preview its effects.
estimate-gas
Estimate gas for a transaction.
get-gas-price
Get current gas prices on Polygon.
switch-network
Switch between Polygon Mainnet and Amoy Testnet.