This tool allows you to perform cross-chain token swaps between different blockchains using 1inch Fusion+ and Model Context Protocol (MCP). It provides a seamless way to exchange tokens across networks like Arbitrum, Base, and Polygon, with a built-in monitoring system to track your swap orders.
Dependencies must be installed using pnpm
or yarn
(not npm
):
pnpm install
# or
yarn install
This project must be set up as a CommonJS project as it won't work properly if imported as ESM.
Create a .env
file in the root directory with the following variables:
DEV_PORTAL_KEY=replace_with_developer_portal_api_key
WALLET_ADDRESS=replace_with_wallet_address
WALLET_KEY=replace_with_wallet_private_key
RPC_URL_ETHEREUM=replace_with_ethereum_rpc_url
RPC_URL_BASE=replace_with_base_rpc_url
INCH_API_KEY=replace_with_1inch_api_key
Launch the Model Context Protocol server with:
npm start
This starts the server that provides tools for cross-chain swapping and portfolio management.
The following functions can be used with Claude or other MCP-compatible assistants:
Initiates a cross-chain token swap:
Parameters:
- srcChainId: Source chain ID (default: 8453/Base)
- dstChainId: Destination chain ID (default: 42161/Arbitrum)
- srcTokenAddress: Source token address
- dstTokenAddress: Destination token address
- amount: Amount to swap (in base units or human-readable format)
- invert: Swap direction toggle (default: false)
Checks the status of swap orders:
Parameters:
- orderHash: (Optional) Specific order hash to check
Gets the value of protocols in your portfolio:
Parameters:
- chainId: Blockchain ID (default: 1/Ethereum)
Gets detailed information about tokens in your portfolio:
Parameters:
- chainId: Blockchain ID (default: 1/Ethereum)
- closed: Include closed positions (default: true)
- closedThreshold: Threshold for considering positions closed (default: 1)
Gets the general value of your portfolio:
Parameters:
- chainId: Blockchain ID (default: 1/Ethereum)
Gets chart data for portfolio value over time:
Parameters:
- chainId: Blockchain ID (default: 1/Ethereum)
The application includes a background worker system to monitor and process swap orders:
# Start the monitor daemon
npm run monitor:start
# Check status of all orders
npm run status
# Check status of monitor daemon
npm run monitor:status
# Stop the monitor daemon
npm run monitor:stop
order-status.json
To add this MCP server to Claude Code, run this command in your terminal:
claude mcp add-json "one-inch-cross-chain-swap" '{"command":"npm","args":["start"]}'
See the official Claude Code MCP documentation for more details.
There are two ways to add an MCP server to Cursor. The most common way is to add the server globally in the ~/.cursor/mcp.json
file so that it is available in all of your projects.
If you only need the server in a single project, you can add it to the project instead by creating or adding it to the .cursor/mcp.json
file.
To add a global MCP server go to Cursor Settings > Tools & Integrations and click "New MCP Server".
When you click that button the ~/.cursor/mcp.json
file will be opened and you can add your server like this:
{
"mcpServers": {
"one-inch-cross-chain-swap": {
"command": "npm",
"args": [
"start"
]
}
}
}
To add an MCP server to a project you can create a new .cursor/mcp.json
file or add it to the existing one. This will look exactly the same as the global MCP server example above.
Once the server is installed, you might need to head back to Settings > MCP and click the refresh button.
The Cursor agent will then be able to see the available tools the added MCP server has available and will call them when it needs to.
You can also explicitly ask the agent to use the tool by mentioning the tool name and describing what the function does.
To add this MCP server to Claude Desktop:
1. Find your configuration file:
~/Library/Application Support/Claude/claude_desktop_config.json
%APPDATA%\Claude\claude_desktop_config.json
~/.config/Claude/claude_desktop_config.json
2. Add this to your configuration file:
{
"mcpServers": {
"one-inch-cross-chain-swap": {
"command": "npm",
"args": [
"start"
]
}
}
}
3. Restart Claude Desktop for the changes to take effect