Repository navigation
MCP_Server_Claude_Code_Desktop
The SDK comes with an optional MCP server, ur-mcp, which exposes the codec to AI agents over stdio. It is side-effect free: its tools only inspect or derive Universal Router data, they never sign or broadcast a transaction.
Claude Code and Claude Desktop both configure their MCP servers with the same mcpServers JSON block, so the same entry works for both.
You can run the server in two ways:
-
With the SDK installed: install the optional
mcpextra, then use theur-mcpcommand.
pip install 'uniswap-universal-router-decoder[mcp]'The quotes around the package name are needed for your shell to not interpret the brackets.
-
Without installing anything: let uv run the server on the fly with
uvx.
The two only differ by the command and args of the server entry:
command |
args |
|
|---|---|---|
| With the SDK installed | ur-mcp |
none |
| Without installing | uvx |
["--from", "uniswap-universal-router-decoder[mcp]", "ur-mcp"] |
The rest of this recipe shows both for each client.
Claude Code adds MCP servers with the claude mcp add command. The -- separates Claude Code's own options from the command that runs the server.
With the SDK installed:
claude mcp add --scope user uniswap-universal-router-decoder -- ur-mcpWithout installing it:
claude mcp add --scope user uniswap-universal-router-decoder -- uvx --from 'uniswap-universal-router-decoder[mcp]' ur-mcpA few notes:
-
--scope usermakes the server available in all your projects. Use--scope projectto share it with your team through a.mcp.jsonfile, or omit it for the defaultlocalscope (current project only). - The
RPC_URLenvironment variable is optional: only thedecode_transactiontool needs it. Add it with--env RPC_URL=https://..., but place another option such as--transport stdiobetween--envand the server name, otherwise Claude Code reads the name as anotherKEY=valuepair.
Claude Code also reads the same mcpServers block from a .mcp.json file at the root of your project (project scope):
{
"mcpServers": {
"uniswap-universal-router-decoder": {
"command": "uvx",
"args": ["--from", "uniswap-universal-router-decoder[mcp]", "ur-mcp"],
"env": {
"RPC_URL": "https://..."
}
}
}
}Claude Desktop reads its MCP servers from claude_desktop_config.json. Open it from Settings → Developer → Edit Config, and add the entry.
With the SDK installed:
{
"mcpServers": {
"uniswap-universal-router-decoder": {
"command": "ur-mcp",
"env": {
"RPC_URL": "https://..."
}
}
}
}Without installing it:
{
"mcpServers": {
"uniswap-universal-router-decoder": {
"command": "uvx",
"args": ["--from", "uniswap-universal-router-decoder[mcp]", "ur-mcp"],
"env": {
"RPC_URL": "https://..."
}
}
}
}The file is located at:
- macOS:
~/Library/Application Support/Claude/claude_desktop_config.json - Windows:
%APPDATA%\Claude\claude_desktop_config.json - Linux:
~/.config/Claude/claude_desktop_config.json
Restart Claude Desktop after saving.
-
Claude Code: run
claude mcp list, or/mcpfrom within a session. - Claude Desktop: open the connectors list (the "Add files, connectors, and more" indicator) and check that the server appears.
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 the client can auto-approve them i/o prompting on every call.
And that's it! Your Claude Code and Claude Desktop agents can now decode and encode Universal Router data for you.
See also How to install and configure the SDK MCP server in Zed ? and in VS Code ?.
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!