Skip to content

MCP_Server_VSCode

Elnaril edited this page Nov 4, 2026 · 1 revision

How to install and configure the SDK MCP server in VS Code ?

The SDK comes with an optional MCP server, ur-mcp, which exposes the codec to AI agents (like GitHub Copilot in VS Code) over stdio. It is side-effect free: its tools only inspect or derive Universal Router data, they never sign or broadcast a transaction.

Installation

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.

Configuration in VS Code

VS Code reads its MCP servers from a mcp.json file, either in your workspace (.vscode/mcp.json) or in your user profile. Open the workspace one with the MCP: Open Workspace Folder MCP Configuration command, and add the following entry:

{
  "servers": {
    "uniswap-universal-router-decoder": {
      "type": "stdio",
      "command": "ur-mcp",
      "env": {
        "RPC_URL": "https://..."
      }
    }
  }
}

A few notes:

  • command can be ur-mcp if it is on your PATH, or the absolute path to ur-mcp in your virtual environment (ex: /path/to/venv/bin/ur-mcp).
  • RPC_URL is optional: only the decode_transaction tool needs it. It can also be provided as ETH_RPC_URL, or per call through the rpc_url tool argument.

Command-line installation

Instead of editing the file by hand, you can add the server from a terminal with the code --add-mcp command:

code --add-mcp '{"name":"uniswap-universal-router-decoder","type":"stdio","command":"uvx","args":["--from","uniswap-universal-router-decoder[mcp]","ur-mcp"]}'

This adds the server to your VS Code user-profile configuration, using the VS Code format. An env object can be added the same way as in the file.

Without installing the SDK

If you don't want to install the SDK in your environment, you can let uv run the server on the fly:

{
  "servers": {
    "uniswap-universal-router-decoder": {
      "type": "stdio",
      "command": "uvx",
      "args": ["--from", "uniswap-universal-router-decoder[mcp]", "ur-mcp"],
      "env": {
        "RPC_URL": "https://..."
      }
    }
  }
}

Portable configuration

VS Code also supports the portable .mcp.json format, at the root of your workspace, which uses a top-level mcpServers object i/o servers:

{
  "mcpServers": {
    "uniswap-universal-router-decoder": {
      "command": "ur-mcp",
      "env": {
        "RPC_URL": "https://..."
      }
    }
  }
}

Check that it works

Run the MCP: List Servers command from the Command Palette and check that the server is running. You can also start, stop or restart it from there.

Available tools

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 VS Code can auto-approve them i/o prompting on every call.

Ending words

And that's it! Your VS Code agent can now decode and encode Universal Router data for you.

See also How to install and configure the SDK MCP server in Zed ? for the Zed setup.

Clone this wiki locally