milele-prime-mcp

milele-prime-mcp

Read-only MCP server that lets a verified client connect their own AI to their trading account to read account data without order execution.

Category
Visit Server

README

milele-mcp

Read-only MCP server for Milele Prime. Lets a verified client connect their own AI (Claude / ChatGPT) to their own trading account and read account data — no order execution in phase 1.

Stack

TypeScript · Node 22 · Express · @modelcontextprotocol/sdk · Zod · Postgres (Supabase) · opaque revocable tokens · Vitest · Railway.

The core idea: two interfaces are the swap point

Everything in src/ talks to two interfaces, never to a real API:

  • IdentityProvider (src/providers/interfaces/identity.ts) — Brokeret fills this
  • TradingDataProvider (src/providers/interfaces/trading.ts) — MT5 Manager API fills this

Today both run as mocks. When credentials land, set IDENTITY_PROVIDER=real and TRADING_PROVIDER=real in .env and fill the two stub adapters in src/providers/real/. Nothing else changes.

Run it

npm install
cp .env.example .env      # defaults to mock providers, no infra needed
npm run dev               # boots on :8080
npm test                  # runs the isolation suite (6 tests)

Security model (proven by the test suite)

Every tool call goes through AuthGate.resolve() which:

  1. validates the token (exists, not revoked),
  2. confirms via the CRM that the token's login is owned by that client,
  3. confirms the account is KYC-approved and live, then runs the tool with the login the gate resolved — never a login from the caller. A client cannot pass a login and read another account. test/isolation.test.ts proves: own-account read works, cross-account is blocked, forged/revoked/garbage tokens are rejected, suspended accounts are blocked.

Build sequence (status)

  • [x] Server skeleton + config + factory (swap point)
  • [x] Two provider interfaces
  • [x] Mock implementations of both
  • [x] Token service (in-memory; Postgres schema in db/migrations/001_init.sql)
  • [x] Authorization gate + audit log + tool runner
  • [x] One tool end to end: get_account_summary
  • [x] Cross-account isolation test passing
  • [ ] Remaining six read tools (positions, orders, history, quote, price_history, instrument_details)
  • [ ] Swap token store + audit to Supabase Postgres
  • [ ] Mount the real MCP SDK streamable-HTTP transport + OAuth
  • [x] CRM "Connect AI Assistant" portal flow (replaces /dev/connect) — POST /connect/initiate|revoke, GET /connect/activity
  • [ ] Fill the two real adapters when credentials land

Adding a tool

  1. Add the method to TradingDataProvider + both mock and real impls.
  2. Add a tool function in src/tools/index.ts using runTool(...) (gate + audit are automatic).
  3. Add a route (or MCP tool registration) in src/server.ts.
  4. Add an isolation assertion for it in test/isolation.test.ts.

Tomorrow's go-live delta

Fill src/providers/real/identity.ts (Brokeret endpoints) and src/providers/real/trading.ts (MT5 Manager API), set the two env flags to real, point the base URLs at the sandboxes, and run npm test against live data. The gate, tools, tokens, and audit are unchanged.

Recommended Servers

playwright-mcp

playwright-mcp

A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.

Official
Featured
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.

Official
Featured
Local
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.

Official
Featured
Local
TypeScript
VeyraX MCP

VeyraX MCP

Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.

Official
Featured
Local
graphlit-mcp-server

graphlit-mcp-server

The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.

Official
Featured
TypeScript
Kagi MCP Server

Kagi MCP Server

An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.

Official
Featured
Python
E2B

E2B

Using MCP to run code via e2b.

Official
Featured
Neon Database

Neon Database

MCP server for interacting with Neon Management API and databases

Official
Featured
Exa Search

Exa Search

A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.

Official
Featured
Qdrant Server

Qdrant Server

This repository is an example of how to create a MCP server for Qdrant, a vector search engine.

Official
Featured