Repository navigation
MCP_Server_Zed
The SDK comes with an optional MCP server, ur-mcp, which exposes the codec to AI agents (like the Zed agent) over stdio. It is side-effect free: its tools only inspect or derive Universal Router data, they never sign or broadcast a transaction.
The MCP server is an optional extra of the SDK:
pip install 'uniswap-universal-router-decoder[mcp]'This installs the ur-mcp command in your environment. The quotes around the package name are needed for your shell to not interpret the brackets.
Zed reads its MCP servers from the context_servers section of its settings file. Open it with the zed: open settings file action (or from Settings → AI → MCP Servers), and add the following entry:
{
"context_servers": {
"uniswap-universal-router-decoder": {
"command": "ur-mcp",
"env": {
"RPC_URL": "https://..."
}
}
}
}A few notes:
-
commandcan beur-mcpif it is on yourPATH, or the absolute path tour-mcpin your virtual environment (ex:/path/to/venv/bin/ur-mcp). -
RPC_URLis optional: only thedecode_transactiontool needs it. It can also be provided asETH_RPC_URL, or per call through therpc_urltool argument.
If you don't want to install the SDK in your environment, you can let uv run the server on the fly:
{
"context_servers": {
"uniswap-universal-router-decoder": {
"command": "uvx",
"args": ["--from", "uniswap-universal-router-decoder[mcp]", "ur-mcp"],
"env": {
"RPC_URL": "https://..."
}
}
}
}Open Settings → AI → MCP Servers and look at the indicator dot next to the server name: green means it is running properly.
The server provides eight tools:
-
list_commands/describe_command: discover the decoded call format and the commands -
decode_transaction: fetch and decode a transaction sent to the UR (needs an RPC endpoint) -
decode_calldata,encode_calldata,decode_error,decode_v3_path,encode_v3_path: decode or encode data without an RPC endpoint
encode_calldata is the mirror of decode_calldata: it rebuilds the calldata from a decoded call, so an agent can decode a route, edit it and re-encode it.
The tools are annotated as read-only, so Zed can auto-approve them i/o prompting on every call.
And that's it! Your Zed agent can now decode and encode Universal Router data for you.
See also How to get started with the Python Uniswap Universal Router SDK ? for the Python API.
If you find this library useful, consider a donation and be part of the Supporter Community! :)
- ☕️☕️☕️ https://www.buymeacoffee.com/elnaril ☕️☕️☕️
- Ethereum compatible: 0xe32A121C89121bF8B829D6d88BBEA89e5d88f002
- Sponsoring: https://github.com/sponsors/Elnaril
Thank you to all supporters!! 🙏
Also, consider ⭐ starring ⭐ the repository and following the GitHub account and/or 𝕏 to get the next lib updates!