Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
node_modules
build
logs
.git
.github
coverage
npm-debug.log
55 changes: 50 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,17 @@ name: CI

on:
push:
branches: [main]
pull_request:
branches: [main]

concurrency:
group: ci-${{ github.ref }}
cancel-in-progress: true

jobs:
test:
lint-test:
runs-on: ubuntu-latest
permissions:
contents: read

steps:
- name: Checkout repository
Expand All @@ -18,6 +22,7 @@ jobs:
uses: actions/setup-node@v4
with:
node-version: "20.x"
cache: npm

- name: Install dependencies
run: npm ci
Expand All @@ -28,5 +33,45 @@ jobs:
- name: Run tests
run: npm test

- name: Build project
run: npm run build
build-and-push:
needs: lint-test
if: github.event_name == 'push' && github.ref_type == 'tag' && (startsWith(github.ref_name, 'test-v') || startsWith(github.ref_name, 'v'))
runs-on: ubuntu-latest
permissions:
contents: read
env:
IMAGE_TAG: ${{ startsWith(github.ref_name, 'test-v') && 'test' || github.ref_name }}

steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
ref: ${{ github.ref }}

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Log in to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Extract metadata (tags, labels)
id: meta
uses: docker/metadata-action@v5
with:
images: bankofai/mcp-server-tron
tags: |
type=raw,value=${{ env.IMAGE_TAG }}

- name: Build and push
uses: docker/build-push-action@v6
with:
context: .
platforms: linux/amd64,linux/arm64
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,14 @@

All notable changes to this project will be documented in this file.

## [1.1.6] - 2026-03-18

### Changed

- Switched HTTP MCP to stateless Streamable HTTP to avoid `mcp-session-id` issues across multiple instances.
- Added Docker support with `docker-start.sh`, `Dockerfile`, and a GitHub Actions Docker build workflow.
- Container logs now write to local `logs/` files with date-based names prefixed by `mcp-server-tron`.

## [1.1.5] - 2026-03-13

### Changed
Expand Down
37 changes: 37 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
FROM node:20-bookworm-slim AS builder

WORKDIR /app

COPY package*.json ./
RUN npm ci

COPY . .
RUN npm run build

FROM node:20-bookworm-slim AS runtime

WORKDIR /app

RUN groupmod -n ec2-user node && \
usermod -l ec2-user node

COPY package*.json ./
RUN npm ci --omit=dev && npm cache clean --force

COPY --from=builder /app/build ./build
COPY docker-start.sh ./docker-start.sh

RUN mkdir -p /app/logs \
&& chown -R ec2-user:ec2-user /app \
&& chmod +x /app/docker-start.sh

USER ec2-user

ENV NODE_ENV=production
ENV MCP_HOST=0.0.0.0
ENV MCP_PORT=3001
ENV MCP_LOG_DIR=/app/logs

EXPOSE 3001

ENTRYPOINT ["./docker-start.sh"]
30 changes: 28 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -184,10 +184,36 @@ npm start
# Start in readonly mode (disables write tools)
npm start -- --readonly

# Start in HTTP mode (Streamable HTTP)
# Start in stateless HTTP mode (Streamable HTTP)
npm run start:http
```

### Docker

Build the image:

```bash
docker build -t mcp-server-tron:test .
```

Run the container with local logs mounted:

```bash
docker run -d \
--name mcp-tron \
-p 3001:3001 \
-e MCP_HOST=0.0.0.0 \
-e MCP_PORT=3001 \
-e MCP_LOG_DIR=/app/logs \
-v "$(pwd)/logs:/app/logs" \
mcp-server-tron:test
```

Docker logs are written to the mounted `logs/` directory and are named by date, for example:

- `logs/mcp-server-tron-2026-03-18-combined.log`
- `logs/mcp-server-tron-2026-03-18-error.log`

### Testing

The project includes a comprehensive test suite with unit tests and integration tests (using the Nile testnet).
Expand Down Expand Up @@ -248,7 +274,7 @@ claude mcp add -e AGENT_WALLET_PASSWORD=xxx -e TRONGRID_API_KEY=xxx mcp-server-t

#### Option B: Official Hosted Server (Remote)

Connect to the official hosted server at `https://tron-mcp-server.bankofai.io`. No installation required, readonly mode.
Connect to the official hosted server at `https://tron-mcp-server.bankofai.io`. No installation required, readonly mode, stateless HTTP.

**Claude Code:**

Expand Down
15 changes: 15 additions & 0 deletions docker-start.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/bin/sh

set -eu

APP_DIR="/app"
LOG_DIR="${MCP_LOG_DIR:-${APP_DIR}/logs}"
DATE_TAG="$(date +%F)"
PROJECT_NAME="mcp-server-tron"
COMBINED_LOG="${LOG_DIR}/${PROJECT_NAME}-${DATE_TAG}-combined.log"
ERROR_LOG="${LOG_DIR}/${PROJECT_NAME}-${DATE_TAG}-error.log"

mkdir -p "${LOG_DIR}"
touch "${COMBINED_LOG}" "${ERROR_LOG}"

exec node build/server/http-server.js --readonly >>"${COMBINED_LOG}" 2>>"${ERROR_LOG}"
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"mcpName": "io.github.bankofai/mcp-server-tron",
"module": "src/index.ts",
"type": "module",
"version": "1.1.5",
"version": "1.1.6",
"description": "MCP server for TRON blockchain. Supports TRX/TRC20 transfers, smart contracts, and AI prompts.",
"bin": {
"mcp-server-tron": "./bin/cli.js"
Expand Down Expand Up @@ -89,4 +89,4 @@
"publishConfig": {
"access": "public"
}
}
}
Loading
Loading