Skip to content

Repository files navigation

InjPilot MCP

InjPilot MCP is a deployed live Injective MCP demo with Gemini explanations and a safety-first execution preview. It reads real testnet market/account context, runs local risk math, and proves that no wallet, private key, signing, transfer, bridge, authz, or broadcast path is enabled.

Deployment:

https://injpilot-mcp.vercel.app

Routes

  • / - command center and project overview.
  • /market - live MCP market reads and local leverage simulations.
  • /portfolio - read-only public Injective address validation and balance scan.
  • /execution - inert testnet trade_open preview with broadcast blocked.
  • /audit - visible allowlist/blocklist timeline with collapsed raw JSON.

Guided Product Flow

  1. Open / and confirm the status bar shows sandbox mode, MCP readiness, Gemini/Copilot readiness, broadcast disabled, and Injective testnet.
  2. Go to /market and run Show INJ market.
  3. Run Simulate $50 ETH long at 5x.
  4. Go to /execution and run Prepare testnet INJ long.
  5. Go to /portfolio and try inj1bad to show clean validation.
  6. Go to /audit and inspect the ready, prepared, and blocked tools.

What Works

  • Live Injective MCP reads on Vercel through the bundled MCP server.
  • Market cards for BTC, ETH, and INJ perpetuals.
  • Local simulation presets for $50 BTC/ETH/INJ longs at 5x.
  • Controlled Execution Preview for BTC/ETH/INJ.
  • Read-only Injective address inspection through account_balances.
  • Tool-call timeline for allowed reads, prepared previews, and blocked paths.
  • Gemini explanations when configured, with deterministic local explanations as the safe default.

Safety Model

Allowed read-only MCP tools:

market_list
market_price
account_balances

Blocked write/execution tools:

trade_open
trade_close
trade_limit_open
transfer_send
subaccount_deposit
bridge_debridge_send
evm_broadcast
authz_grant
wallet_import

Controlled Execution Preview may show inert trade_open parameters, but it does not call trade_open, sign anything, request a private key, or broadcast a transaction. If MCP startup fails, the app fails safely into labeled fallback mode; fallback data is never mislabeled as live MCP data.

Why Not Real Execution?

InjPilot intentionally stops before wallet connection or broadcast because the goal is safe MCP-assisted trading readiness, not custody or execution. The product proves that an AI agent can inspect live market/account data, simulate risk, and prepare an auditable execution preview without gaining permission to move funds.

Presets

Show BTC market
Show ETH market
Show INJ market
Simulate $50 BTC long at 5x
Simulate $50 ETH long at 5x
Simulate $50 INJ long at 5x
Prepare testnet BTC long
Prepare testnet ETH long
Prepare testnet INJ long

Natural language prompts such as Simulate a $50 ETH long at 5x and Prepare a $50 INJ long at 5x are parsed for symbol, amount, side, and leverage.

Architecture

User prompt
  -> Next.js UI
  -> /api/pilot safety layer
  -> MCP adapter
  -> official Injective MCP Server
  -> read-only market/account tools
  -> Gemini/local explainer
  -> broadcast block

The /api/pilot route is the safety boundary. It parses intent, validates supported symbols and addresses, calls only allowlisted read-only tools, builds simulation or preview objects locally, and keeps broadcast/write tools blocked.

More detail:

Screenshots

Audit screenshots from the final Playwright pass:

Command center

Live INJ market read

ETH risk simulation

Execution preview

Grouped audit trail

Local Development

Run from the app directory:

npm run dev

Open:

http://localhost:3000

Useful checks:

npm run lint
npm run build
npm run test:e2e

MCP Usage

The app uses the official Injective MCP Server through a stdio child process. Resolution order:

INJPILOT_MCP_SERVER_PATH
./mcp-server/dist/mcp/server.js
../mcp-server/dist/mcp/server.js
safe labeled fallback

The adapter runs the MCP child process with:

INJECTIVE_NETWORK=testnet

For local sibling development, build the sibling MCP repo and run the app:

cd ../mcp-server
npm install
npm run build
cd ../injpilot-mcp
npm run dev

Optional AI Explanation

The app works with no paid API keys. Gemini is the recommended optional provider because it is free-tier friendly. If a server-side key exists, the API route can generate a short explanation from already-selected results and safety status. AI providers do not choose tools, execute trades, or bypass the safety layer.

Provider priority:

Gemini -> OpenAI -> Anthropic -> local deterministic explainer

Supported optional environment variables:

GEMINI_API_KEY=
GEMINI_MODEL=gemini-1.5-flash

OPENAI_API_KEY=
OPENAI_MODEL=gpt-4o-mini

ANTHROPIC_API_KEY=
ANTHROPIC_MODEL=claude-3-5-haiku-latest

The browser never receives API keys.

Deployment Notes

Bundled deployment mode vendors the MCP server under:

./mcp-server

The app build runs:

npm run build:mcp

which installs the nested MCP server dependencies and builds ./mcp-server/dist/mcp/server.js before next build. The Next.js config includes the MCP server dist files and nested runtime dependencies in the /api/pilot serverless bundle.

Production /api/mcp-health exposes only safe summary fields. Detailed MCP path diagnostics remain available during local development.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages