
Security News
Ruby's Bundler 4.0.18 Extends Cooldown to bundle lock and bundle cache
The supply chain control that delays freshly published gems now covers lockfile generation and gem vendoring in Ruby projects.
@swapapi/mcp
Advanced tools
MCP server for SwapAPI - get executable token swap calldata for EVM chains
MCP (Model Context Protocol) server for SwapAPI. Enables AI agents to get executable token swap calldata for any EVM chain.
npm install -g @swapapi/mcp
Or use directly with npx:
npx @swapapi/mcp
Add to your Claude Desktop config:
{
"mcpServers": {
"swapapi": {
"command": "npx",
"args": ["@swapapi/mcp"]
}
}
}
Or with a local install:
{
"mcpServers": {
"swapapi": {
"command": "npx",
"args": ["tsx", "/path/to/swap-api/mcp/mcp-server.ts"]
}
}
}
Add to your Cursor settings (Settings → MCP):
{
"mcpServers": {
"swapapi": {
"command": "npx",
"args": ["@swapapi/mcp"]
}
}
}
Any MCP-compatible client can use the same configuration format. Check your client's documentation for where to add MCP server settings.
swap_tokensGet executable transaction data to swap tokens on EVM chains.
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
chainId | number | Yes | Chain ID (1=Ethereum, 8453=Base, 42161=Arbitrum, etc.) |
tokenIn | string | Yes | Input token address. Use 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE for native token (ETH, MATIC, etc.) |
tokenOut | string | Yes | Output token address |
amountIn | string | Yes | Amount in smallest unit (wei for 18-decimal tokens, micro-units for 6-decimal tokens) |
sender | string | Yes | Wallet address that will sign and send the transaction |
maxSlippage | number | No | Max slippage tolerance 0-1 (default: 0.005 = 0.5%) |
Returns:
{
"to": "0x...", // Router contract address to call
"data": "0x...", // ABI-encoded swap calldata
"value": "1000000000000000000", // Native token value (if swapping from native)
"gas": "150000", // Estimated gas limit
"guaranteedOut": "..." // Minimum output amount after slippage
}
{
"chainId": 8453,
"tokenIn": "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",
"tokenOut": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
"amountIn": "1000000000000000",
"sender": "0xYourAddress"
}
{
"chainId": 42161,
"tokenIn": "0xaf88d065e77c8cC2239327C5EDb3A432268e5831",
"tokenOut": "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",
"amountIn": "10000000",
"sender": "0xYourAddress",
"maxSlippage": 0.01
}
Before submitting any swap transaction:
tokenIn is not native token, ensure sender has approved the router for at least amountInamountIn (plus value if native token)eth_estimateGas on the transaction and add 20% buffereth_call to verify the transaction won't revertSee the main README.md for full API documentation.
cd mcp
npm install
npm start
Run the test suite:
npm test
Or use the MCP Inspector:
npx @modelcontextprotocol/inspector tsx mcp-server.ts
MIT
FAQs
MCP server for SwapAPI - get executable token swap calldata for EVM chains
The npm package @swapapi/mcp receives a total of 36 weekly downloads. As such, @swapapi/mcp popularity was classified as not popular.
We found that @swapapi/mcp demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
The supply chain control that delays freshly published gems now covers lockfile generation and gem vendoring in Ruby projects.

Security News
During a UK cyber test, a Mythos 5 agent used sockpuppets, social engineering, and prompt injection to try to get a maintainer to merge malware.

Company News
Socket is now in the AWS Security Hub Extended plan. Adopt it through AWS, apply committed spend, and block malicious open source packages.