diff --git a/English/SUMMARY.md b/English/SUMMARY.md index 5ef451f5..2be181f3 100644 --- a/English/SUMMARY.md +++ b/English/SUMMARY.md @@ -780,6 +780,8 @@ * [GenAI Studio](ai-stack/genai-studio.md) * [GreenNode AgentBase](ai-stack/agent-base/README.md) * [Getting Started](ai-stack/agent-base/getting-started.md) + * [Manage AgentBase with the GreenNode CLI](ai-stack/agent-base/manage-agentbase-with-the-greennode-cli.md) + * [Manage AgentBase with the GreenNode MCP](ai-stack/agent-base/manage-agentbase-with-the-greennode-mcp.md) * [Access Control](ai-stack/agent-base/access-control/README.md) * [Agent Runtime](ai-stack/agent-base/agent-runtime/README.md) * [Create Runtime](ai-stack/agent-base/agent-runtime/create-runtime.md) diff --git a/English/ai-stack/agent-base/manage-agentbase-with-the-greennode-cli.md b/English/ai-stack/agent-base/manage-agentbase-with-the-greennode-cli.md new file mode 100644 index 00000000..94f344db --- /dev/null +++ b/English/ai-stack/agent-base/manage-agentbase-with-the-greennode-cli.md @@ -0,0 +1,227 @@ +# Manage AgentBase with the GreenNode CLI + +### Introduction + +The **GreenNode CLI** (the `grn` command) is a command-line tool for managing GreenNode resources directly from your terminal. For **GreenNode AgentBase**, the `grn agentbase` command group lets you create and operate the full lifecycle of an agent — Identity, Runtime, Memory, MCP Gateway, Policy and Container Registry — instead of using the Portal. + +The `agentbase` command group ships in the default `grn` binary — no special build is required: + +```bash +grn agentbase --help +``` + +Full command reference: [https://greennodehub.github.io/greennode-cli/](https://greennodehub.github.io/greennode-cli/). + +The CLI is one of several ways to work with AgentBase, alongside the [Portal](README.md) and [MCP](manage-agentbase-with-the-greennode-mcp.md). Choose the CLI when you need fast, repeatable operations, or when you want to move agent deployment into automation scripts and CI/CD. + +{% hint style="info" %} +The `agentbase` command group is still being added to the public reference site. In the meantime, run `grn agentbase --help` or `grn agentbase --help` to see the commands and parameters available in the version you have installed. +{% endhint %} + +--- + +### 1. Installation + +`grn` is a single binary with zero external dependencies. Download the latest build for your platform from [GitHub Releases](https://github.com/GreenNodeHub/greennode-cli/releases). + +**macOS** + +```bash +# Apple Silicon (M1/M2/M3) +curl -L -o grn https://github.com/GreenNodeHub/greennode-cli/releases/latest/download/grn-darwin-arm64 +# Intel +curl -L -o grn https://github.com/GreenNodeHub/greennode-cli/releases/latest/download/grn-darwin-amd64 +chmod +x grn && sudo mv grn /usr/local/bin/ +``` + +**Linux** + +```bash +# x86_64 +curl -L -o grn https://github.com/GreenNodeHub/greennode-cli/releases/latest/download/grn-linux-amd64 +# ARM64 +curl -L -o grn https://github.com/GreenNodeHub/greennode-cli/releases/latest/download/grn-linux-arm64 +chmod +x grn && sudo mv grn /usr/local/bin/ +``` + +**Windows:** download `grn-windows-amd64.exe` from GitHub Releases and add it to your `PATH`. + +**Build from source** (requires [Go 1.22+](https://go.dev/dl/)): + +```bash +git clone https://github.com/GreenNodeHub/greennode-cli.git +cd greennode-cli/go +go build -o grn . && sudo mv grn /usr/local/bin/ +``` + +Verify: `grn --version` + +--- + +### 2. Configuration and authentication + +The `agentbase` command group **shares the `~/.greennode` profile** with the rest of `grn` (`vks`, `vserver`) — there is no separate config file. Two authentication modes are available. + +**Machine mode (M2M)** — recommended for CI/CD and scripts: + +```bash +grn configure +``` + +``` +GRN Client ID [None]: +GRN Client Secret [None]: +Default region name [HCM-3]: +Default output format [json]: +Project ID (leave blank to auto-detect) [None]: +``` + +**Client ID** and **Client Secret** come from the **GreenNode IAM Portal → Service Accounts** ([hcm-3.console.vngcloud.vn/iam](https://hcm-3.console.vngcloud.vn/iam/)). Leave **Project ID** blank and the wizard auto-detects it. + +**User mode (PKCE)** — recommended for interactive use on your own machine: + +```bash +grn login # browser-based login +grn logout # clear the stored login +``` + +The active mode is determined by `auth_mode` in the profile (`user` or `machine`). `grn login` persists only the **refresh token** to disk (`0600`); the access token is held in process memory and refreshed automatically before it expires. + +#### Config files and environment variables + +Configuration is stored in `~/.greennode/credentials` (permissions `0600`) and `~/.greennode/config`. You can override it with environment variables — environment variables always take priority over the files: + +| Environment variable | Purpose | +|---|---| +| `GRN_ACCESS_KEY_ID` | Client ID | +| `GRN_SECRET_ACCESS_KEY` | Client Secret | +| `GRN_DEFAULT_REGION` | Default region | +| `GRN_DEFAULT_PROJECT_ID` | Project ID | +| `GRN_PROFILE` | Profile to use (default `default`) | +| `GRN_DEFAULT_OUTPUT` | Default output format | + +For multiple environments, use profiles: `grn configure --profile staging`, then `grn --profile staging agentbase runtime list`. + +#### Choosing the dev / prod environment + +The environment is selected via `iam_env` in the profile (default `prod`). AgentBase calls `agentbase.api.vngcloud.vn` in prod and `agentbase.api-dev.vngcloud.tech` in dev. + +```bash +grn configure set iam_env # machine mode +grn login --iam-env # user mode +grn agentbase context current # show the active environment + endpoints +``` + +{% hint style="info" %} +In **user mode**, `iam_env` is bound to the login token — to switch environments you must run `grn login --iam-env ` again. In **machine mode**, you can switch `iam_env` freely. +{% endhint %} + +--- + +### 3. AgentBase command groups + +Command structure: `grn agentbase [options]`. Each group maps to one AgentBase service: + +| Command group | Manages | Related page | +|---|---|---| +| `context` | The active environment, endpoints, headers and decorators | — | +| `identity` | Workload Identity and Outbound Auth (OAuth2, static API key, delegated), api-key delegate | [Access Control](access-control/README.md) | +| `gateway` | Create and manage MCP Gateways, access logs, Inbound Auth JWT, private network routes | [MCP Gateway](mcp-governance/mcp-gateway/README.md) | +| `runtime` | Deploy the container that runs the agent code (image, command, args, env, autoscaling), endpoints, logs, metrics, traces | [Agent Runtime](agent-runtime/README.md) | +| `memory` | Memory containers, strategies, sessions, events and records | [Memory](memory/README.md) | +| `catalog` | Runtime flavors, OpenClaw versions and workspaces | [OpenClaw](agent-runtime/openclaw/README.md) | +| `policy` | Policy Groups, policies, condition operators and decisions | [Policy Groups](mcp-governance/policy-groups/README.md) | +| `cr` | Repositories, images, artifacts and registry credentials on vCR | [Container Registry](container-registry/README.md) | +| `deploy` | Orchestrator that composes `identity` + `memory` + `runtime` (+ `cr`) into a single lifecycle | — | + +Get help any time with `grn agentbase --help`. + +Every command accepts `-o` (`--output`) to pick the result format, and `--interactive` to have the CLI prompt for any missing required parameters: + +| `-o` value | Meaning | +|---|---| +| `table` (default) | Human-readable table; secrets masked | +| `json` | Raw JSON; secrets revealed (e.g. to pipe into `docker login`) | +| `id` | Print only the ID — handy for scripting | + +{% hint style="warning" %} +`-o json` prints secrets in cleartext (Client Secret, robot account password). Do not use `-o json` in public CI logs or while sharing your screen. +{% endhint %} + +--- + +### 4. Deploy an agent with `deploy` + +In AgentBase, an **agent** is the set of resources that share a **name** as the join key: an Identity (always present), a Memory container (optional — omit it for a stateless agent), and a Runtime that runs the agent code. The `deploy` command group is a client-side orchestrator that composes these services into one lifecycle: + +| Command | Effect | +|---|---| +| `deploy generate` | Print an agent manifest template (YAML or JSON) | +| `deploy up` | Apply the manifest — create resources if absent, then wait for the Runtime to reach `ACTIVE` | +| `deploy status` | Show the agent's state across all services | +| `deploy destroy` | Delete the agent's Runtime and Memory (add `--purge` to delete the Identity too) | + +Generate a template, then fill it in: + +```bash +grn agentbase deploy generate > agent.yaml +``` + +```yaml +# name is the shared join key across identity + memory + runtime +# (3-50 chars, ^[a-zA-Z0-9_-]+$). identity is always created. +name: my-agent +description: "A customer-support agent" + +identity: + allowedReturnUrls: + - https://app.example.com/callback + +# memory: OPTIONAL. Omit the whole block for a stateless agent. +# When present, at least one strategy (name/type/namespaceTemplate) is required. +memory: + eventExpiryDuration: 3600 + strategies: + - name: prefs + type: USER_PREFERENCE + namespaceTemplate: "/strategies/USER_PREFERENCE/actors/{actorId}" + +runtime: + image: registry.vngcloud.vn//my-agent:v1 + imageAuth: auto # "auto" resolves pull credentials from your vCR robot account + command: [./agent] + args: [--port, "8080"] + env: {LOG_LEVEL: info} + flavorId: agent.small + autoscaling: {minReplicas: 1, maxReplicas: 3, cpuUtilization: 70, memoryUtilization: 80} +``` + +Apply the manifest, track it, then clean up when you no longer need it: + +```bash +grn agentbase deploy up --file agent.yaml +grn agentbase deploy status my-agent +grn agentbase deploy destroy my-agent # deletes runtime + memory +grn agentbase deploy destroy my-agent --purge # also deletes the identity +``` + +`deploy up` is **idempotent** — running it repeatedly does not create duplicate resources. `up`, `status` and `destroy` all look resources up by name, so no state file is needed. + +{% hint style="warning" %} +If `deploy up` fails partway through, the CLI does **not** roll back the resources it already created. Re-run `deploy up` (it is idempotent) to continue, or run `deploy destroy` to clean up and start over. `deploy destroy --purge` also deletes the Identity and **cannot be undone**. +{% endhint %} + +--- + +### 5. Troubleshooting + +| Symptom | What to do | +|---|---| +| `authentication failed: ...` | Run `grn configure` (machine) or `grn login` (user). Check the environment and profile with `grn agentbase context current` | +| 404 on a resource lookup | `deploy` and `status` look up by name — a wrong name, or a resource in a different environment, both report as absent | +| Runtime stuck in `CREATING` | Runtimes converge asynchronously — use `grn agentbase runtime wait ` or `deploy status ` to wait | +| Switching dev ↔ prod has no effect | Machine mode: `grn configure set iam_env `. User mode: you must run `grn login --iam-env ` again, since the token is bound to the environment | + +--- + +If you run into problems, contact GreenNode by email: [**support@greennode.ai**](mailto:support@greennode.ai) - hotline: **19001549**. Help center: [https://helpdesk.greennode.ai](https://helpdesk.greennode.ai) diff --git a/English/ai-stack/agent-base/manage-agentbase-with-the-greennode-mcp.md b/English/ai-stack/agent-base/manage-agentbase-with-the-greennode-mcp.md new file mode 100644 index 00000000..9202ef77 --- /dev/null +++ b/English/ai-stack/agent-base/manage-agentbase-with-the-greennode-mcp.md @@ -0,0 +1,287 @@ +# Manage AgentBase with the GreenNode MCP + +### Introduction + +**AgentBase MCP** lets AI assistants (Claude Desktop, Claude Code, Cursor, Windsurf, or any MCP-compatible client) operate **GreenNode AgentBase** directly through natural language — list Runtimes, create an MCP Gateway, look up a Policy, inspect Memory — without memorizing command syntax or clicking through the Portal. + +AgentBase MCP is a server built on the [Model Context Protocol](https://modelcontextprotocol.io/) standard. Repo: [https://github.com/vngcloud/greennode-agentbase-mcp](https://github.com/vngcloud/greennode-agentbase-mcp) + +What sets it apart from a conventional MCP server: instead of exposing hundreds of tools — one per API — AgentBase MCP exposes only **3 meta-tools**: `list_servers`, `search_tools`, `execute`. The AI assistant discovers the operation it needs and then runs it, so your client's context stays small no matter how many APIs AgentBase has. + +MCP is one of several ways to work with AgentBase, alongside the [Portal](README.md) and the [CLI](manage-agentbase-with-the-greennode-cli.md). Choose MCP when you want an AI assistant to look up resources, suggest configurations, and perform operations on your behalf. + +{% hint style="info" %} +AgentBase MCP currently supports the **prod** environment only — the services behind `agentbase.api.vngcloud.vn`. +{% endhint %} + +--- + +### 1. Prerequisites + +You need two things before configuring any client: + +| Requirement | Details | +|---|---| +| **Bearer token** | An IAM Service Account token, set in the `GREENNODE_MCP_TOKEN` environment variable. Required for both connection paths | +| **Node.js ≥ 20** | Only needed for the local (stdio) path. The HTTP path installs nothing on your machine | + +The token is minted from your Service Account's **Client ID** and **Client Secret** (available under **GreenNode IAM Portal → Service Accounts**): + +```bash +export GREENNODE_MCP_TOKEN=$(curl -s -X POST \ + https://iam.api.vngcloud.vn/accounts-api/v2/auth/token \ + -u "$GREENNODE_CLIENT_ID:$GREENNODE_CLIENT_SECRET" \ + -H "Content-Type: application/x-www-form-urlencoded" \ + -d "grant_type=client_credentials" | jq -r .access_token) +``` + +{% hint style="warning" %} +`GREENNODE_MCP_TOKEN` is a short-lived JWT (roughly **30 minutes**) and carries real permissions over your AgentBase resources — treat it like a password. Never commit it to git or paste it into shared config. The configs below reference it through an environment variable so the value stays out of the file. When the token expires, every call returns `401` — see [5. Token rotation](#id-5-token-rotation). +{% endhint %} + +--- + +### 2. Two ways to connect + +| Path | Mechanism | Suitable clients | +|---|---|---| +| **Local stdio** | The client spawns the server as a subprocess on your machine | Claude Desktop, Claude Code, Cursor, Windsurf, Cline, Roo Code | +| **Remote HTTP** | The client talks to the AgentBase MCP Gateway over HTTPS; nothing is installed locally | Claude.ai (web) and any client that supports Streamable HTTP | + +Choose **local stdio** when you control the machine and want to experiment quickly. Choose **remote HTTP** when you cannot or do not want to run the server locally — the Gateway enforces IAM inbound auth and centralizes access logging. + +--- + +### 3. Install the server for the local stdio path + +```bash +git clone https://github.com/vngcloud/greennode-agentbase-mcp.git +cd greennode-agentbase-mcp +npm install + +export GREENNODE_MCP_TOKEN="" +``` + +Check that the server runs — it prints a startup banner and waits for input; press `Ctrl-C` to exit: + +```bash +npx tsx src/index.ts +``` + +The server reads the following environment variables (all have defaults, so you rarely need to change them): + +| Environment variable | Default | Purpose | +|---|---|---| +| `GREENNODE_MCP_TOKEN` | — | Bearer token used to call the AgentBase services | +| `TOKEN_ENV` | `GREENNODE_MCP_TOKEN` | Rename the variable that holds the token, if you prefer a different name | +| `TRANSPORT` | `stdio` | `stdio` or `http` | +| `PORT` | `8080` | Listening port when `TRANSPORT=http` | +| `MAX_RESPONSE_BYTES` | `25000` | Response truncation threshold, so large payloads don't flood the client's context | +| `SEARCH_LIMIT_DEFAULT` | `5` | Default number of results returned by `search_tools` | + +{% hint style="info" %} +The stdio path requires cloning the repo because the server loads a bundled operation registry (`registry.generated.json`) at startup, and that file ships with the source. The HTTP endpoint already has the registry baked into its image, so no clone is needed. +{% endhint %} + +--- + +### 4. Connect an MCP client + +#### Claude Desktop + +Open (or create) the MCP config file: + +* macOS: `~/Library/Application Support/Claude/claude_desktop_config.json` +* Windows: `%APPDATA%\Claude\claude_desktop_config.json` + +```json +{ + "mcpServers": { + "agentbase": { + "command": "npx", + "args": ["tsx", "/ABSOLUTE/PATH/TO/greennode-agentbase-mcp/src/index.ts"], + "cwd": "/ABSOLUTE/PATH/TO/greennode-agentbase-mcp", + "env": { + "GREENNODE_MCP_TOKEN": "" + } + } + } +} +``` + +Quit Claude Desktop fully (not just close the window) and relaunch. In a new chat, `agentbase` appears in the list of connected MCP servers. + +{% hint style="warning" %} +Claude Desktop launches from a different working directory than your shell, so `args` and `cwd` must be **absolute paths**. With relative paths the server will not start. +{% endhint %} + +#### Claude Code + +The quickest way — run this in the repo directory: + +```bash +claude mcp add agentbase \ + -e GREENNODE_MCP_TOKEN="" \ + -- npx tsx src/index.ts +``` + +Or add the entry directly to `~/.claude.json`: + +```json +{ + "mcpServers": { + "agentbase": { + "type": "stdio", + "command": "npx", + "args": ["tsx", "src/index.ts"], + "cwd": "/ABSOLUTE/PATH/TO/greennode-agentbase-mcp", + "env": { + "GREENNODE_MCP_TOKEN": "" + } + } + } +} +``` + +Restart Claude Code, then run `/mcp` in a session to confirm `agentbase` is connected with 3 tools. + +#### Cursor and Windsurf + +Both use the same config as Claude Desktop; only the file location differs: + +* Cursor: **Settings → Cursor Settings → MCP → Add new MCP server**, or edit `~/.cursor/mcp.json` +* Windsurf: **Settings → MCP Servers**, or edit `~/.codeium/windsurf/mcp_config.json` + +#### Cline and Roo Code + +* Cline: open the Cline panel → **MCP** icon → **Edit MCP Settings** (`~/.cline/mcp_settings.json`) +* Roo Code: **Settings → MCP Servers → Edit** (`~/.roo/mcp_settings.json`) + +Same config as above, plus two extension-specific fields: + +```json +{ + "mcpServers": { + "agentbase": { + "command": "npx", + "args": ["tsx", "/ABSOLUTE/PATH/TO/greennode-agentbase-mcp/src/index.ts"], + "cwd": "/ABSOLUTE/PATH/TO/greennode-agentbase-mcp", + "env": { + "GREENNODE_MCP_TOKEN": "" + }, + "disabled": false, + "alwaysAllow": [] + } + } +} +``` + +The `alwaysAllow` array pre-approves tool names so the extension does not prompt on every call. Add `"list_servers"` and `"search_tools"` for read-heavy workflows, but keep `"execute"` prompted since that tool changes real resources. + +#### Claude.ai and other HTTP clients + +No clone required. Add an HTTP MCP server pointing at the Gateway endpoint, with an `Authorization` header: + +```json +{ + "mcpServers": { + "agentbase": { + "type": "http", + "url": "https:///agentbase_mcp/mcp", + "headers": { + "Authorization": "Bearer ${GREENNODE_MCP_TOKEN}" + } + } + } +} +``` + +For Claude.ai on the web, go to **Settings → Connectors → Add custom connector** and supply the URL and the Bearer header. The connector runs server-side, so your token is stored with Anthropic — use a token scoped for this purpose if that matters to you. + +{% hint style="info" %} +The Gateway endpoint is issued once the feature is enabled for your project. Contact [support@greennode.ai](mailto:support@greennode.ai) to get the exact endpoint. +{% endhint %} + +--- + +### 5. Token rotation + +stdio clients read the token **at spawn time** and hold it static, so a long-running server can outlive its token. The repo ships `scripts/mcp-launch.sh` — it mints a fresh token and then `exec`s the server, so every client spawn rotates the token automatically. Point your client at the script instead of `npx tsx`: + +```json +"command": "bash", +"args": ["/ABSOLUTE/PATH/TO/greennode-agentbase-mcp/scripts/mcp-launch.sh"] +``` + +The script needs `GREENNODE_CLIENT_ID` and `GREENNODE_CLIENT_SECRET` in the environment. Each client has its own way of forcing a respawn: + +| Client | How to respawn the server | +|---|---| +| Claude Desktop | Quit the app fully and relaunch | +| Claude Code | Run `/mcp` and reconnect the `agentbase` server | +| Cursor / Windsurf | Click **Restart** next to the `agentbase` server in the MCP panel | +| Cline / Roo Code | Restart the `agentbase` server in the extension's MCP panel | +| Claude.ai (HTTP) | Cannot self-rotate — mint a new token and update the connector | + +If you only have a static token and no Client Secret on the machine, skip the script and re-export `GREENNODE_MCP_TOKEN` before respawning the client. + +--- + +### 6. The three meta-tools + +Every interaction follows the same three steps: `list_servers` (orient) → `search_tools` (discover) → `execute` (run). + +| Tool | Parameters | Purpose | +|---|---|---| +| `list_servers` | — | List the available AgentBase services with operation counts and tags. Call this first to orient | +| `search_tools` | `query`, `server` (optional), `limit` (max 25) | Search for an operation by intent in natural language. Returns matches with their full input schema inline, ready to pass to `execute` | +| `execute` | `id`, `args`, `fields` (optional) | Run an operation by the `id` returned from `search_tools`. `fields` is a JMESPath expression that projects the response to reduce its size | + +`list_servers` returns 6 services: + +| Service | Scope | +|---|---| +| `runtime` | The Runtime that runs the agent code, endpoints, logs, metrics, traces | +| `gateway` | MCP Gateway, Inbound Auth, access logs, private networking | +| `identity` | Workload Identity and Outbound Auth | +| `memory` | Memory containers, strategies, sessions, events, records | +| `policy` | Policy Groups, policies and decisions | +| `cr` | Repositories, images and artifacts on vCR | + +{% hint style="warning" %} +Always take the `id` from the `search_tools` results — never guess it. Operation ids mirror the `operationId` in the upstream OpenAPI spec, so they are not always pretty (`runtime.list_1`, `runtime.get`, `runtime.listEndpoints`…) and can shift between spec versions. +{% endhint %} + +--- + +### Quick example: ask the AI assistant to deploy an agent + +Once connected, just ask the AI assistant in natural language: + +``` +List the Agent Runtimes running in my project, +then tell me which one used the most CPU in the last hour. +``` + +The AI assistant calls `list_servers` to identify the `runtime` service, calls `search_tools` with the query "list agent runtimes" to get the operation id and input schema, then calls `execute` to run it — asking you for any missing required information along the way. + +If you're building an agent in code rather than using a chat client, connect with the official MCP SDK and follow the same three-step pattern: + +```typescript +const { tools } = await client.listTools(); +console.log(tools.map(t => t.name)); // ["list_servers","search_tools","execute"] + +const search = await client.callTool({ + name: "search_tools", + arguments: { query: "list agent runtimes", limit: 5 }, +}); + +const result = await client.callTool({ + name: "execute", + arguments: { id: "runtime.list_1", args: {} }, +}); +``` + +--- + +If you run into any issues, contact GreenNode via email: [**support@greennode.ai**](mailto:support@greennode.ai) - hotline: **19001549**. Support center: [https://helpdesk.greennode.ai](https://helpdesk.greennode.ai) diff --git a/English/ai-stack/release-notes.md b/English/ai-stack/release-notes.md index a57b27a9..51986b3c 100644 --- a/English/ai-stack/release-notes.md +++ b/English/ai-stack/release-notes.md @@ -6,6 +6,16 @@ A single timeline of updates across all GreenNode AI Stack products — GreenNod ## August 2026 +**GreenNode AgentBase — CLI & MCP** + +AgentBase adds two ways to work alongside the Portal — the command line and AI assistants: + +* **GreenNode CLI:** the `grn agentbase` command group manages the full agent lifecycle — Identity, Runtime, Memory, MCP Gateway, Policy and Container Registry — and deploys a whole agent from a single manifest via `grn agentbase deploy up`. Ideal for moving agent deployment into automation scripts and CI/CD. + * Learn more at [Manage AgentBase with the GreenNode CLI](agent-base/manage-agentbase-with-the-greennode-cli.md). + +* **AgentBase MCP:** an MCP server that lets AI assistants (Claude Desktop, Claude Code, Cursor, Windsurf...) operate AgentBase through natural language via the 3 meta-tools `list_servers` / `search_tools` / `execute`. Supports both local (stdio) and remote (HTTP through the MCP Gateway) connections. + * Learn more at [Manage AgentBase with the GreenNode MCP](agent-base/manage-agentbase-with-the-greennode-mcp.md). + **GreenNode MaaS — Model Catalog & Pricing Update** GreenNode is updating the MaaS model catalog into two groups — **GreenNode self-hosted models** and **third-party models** under official contracts — along with better pricing on many models. The Portal now shows a **model type label (Self-host / Partner)** right on the model list, making it easy to tell models apart and pick the right one. diff --git a/English/overview/product-updates-all/2026.md b/English/overview/product-updates-all/2026.md index 80636226..8a59e93a 100644 --- a/English/overview/product-updates-all/2026.md +++ b/English/overview/product-updates-all/2026.md @@ -165,6 +165,14 @@ For more details about the updated renewal mechanism and policy, please refer [h **Aug 2026** +**GreenNode AgentBase — CLI & MCP** + +AgentBase adds two ways to work alongside the Portal — the command line and AI assistants: + +* **GreenNode CLI:** the `grn agentbase` command group manages the full agent lifecycle (Identity, Runtime, Memory, MCP Gateway, Policy, Container Registry) and deploys a whole agent from a single manifest — ideal for moving agent deployment into automation scripts and CI/CD. +* **AgentBase MCP:** lets AI assistants (Claude Desktop, Claude Code, Cursor, Windsurf...) operate AgentBase through natural language via 3 meta-tools, with both local (stdio) and remote (HTTP) connections. +* Learn more at [AI Stack — Release Notes](../../ai-stack/release-notes.md). + **GreenNode AI Stack — Token Plan** Token Plan lets you lock in your monthly AI budget with a **30-day prepaid** package that has a fixed token/request limit per model — instead of paying per token actually used like PAYG. diff --git a/Vietnamese/SUMMARY.md b/Vietnamese/SUMMARY.md index b43dd241..41b4b9e6 100644 --- a/Vietnamese/SUMMARY.md +++ b/Vietnamese/SUMMARY.md @@ -869,6 +869,8 @@ * [GenAI Studio](ai-stack/genai-studio.md) * [GreenNode AgentBase](ai-stack/agent-base/README.md) * [Bắt đầu](ai-stack/agent-base/getting-started.md) + * [Sử dụng GreenNode CLI để quản lý AgentBase](ai-stack/agent-base/su-dung-greennode-cli-de-quan-ly-agentbase.md) + * [Sử dụng GreenNode MCP để quản lý AgentBase](ai-stack/agent-base/su-dung-greennode-mcp-de-quan-ly-agentbase.md) * [Access Control](ai-stack/agent-base/access-control/README.md) * [Agent Runtime](ai-stack/agent-base/agent-runtime/README.md) * [Khởi tạo Runtime](ai-stack/agent-base/agent-runtime/khoi-tao-runtime.md) diff --git a/Vietnamese/ai-stack/agent-base/su-dung-greennode-cli-de-quan-ly-agentbase.md b/Vietnamese/ai-stack/agent-base/su-dung-greennode-cli-de-quan-ly-agentbase.md new file mode 100644 index 00000000..bdcb5abc --- /dev/null +++ b/Vietnamese/ai-stack/agent-base/su-dung-greennode-cli-de-quan-ly-agentbase.md @@ -0,0 +1,227 @@ +# Sử dụng GreenNode CLI để quản lý AgentBase + +### Giới thiệu + +**GreenNode CLI** (lệnh `grn`) là công cụ dòng lệnh để quản lý tài nguyên GreenNode ngay trên terminal. Với **GreenNode AgentBase**, nhóm lệnh `grn agentbase` cho phép bạn tạo và vận hành trọn vòng đời của agent — Identity, Runtime, Memory, MCP Gateway, Policy và Container Registry — thay vì thao tác qua Portal. + +Nhóm lệnh `agentbase` nằm sẵn trong binary `grn` mặc định, không cần build riêng: + +```bash +grn agentbase --help +``` + +Trang reference đầy đủ: [https://greennodehub.github.io/greennode-cli/](https://greennodehub.github.io/greennode-cli/). + +CLI là một trong các cách làm việc với AgentBase, bên cạnh [Portal](README.md) và [MCP](su-dung-greennode-mcp-de-quan-ly-agentbase.md). Chọn CLI khi bạn cần thao tác nhanh, lặp lại được, hoặc muốn đưa việc deploy agent vào script tự động hoá và CI/CD. + +{% hint style="info" %} +Nhóm lệnh `agentbase` đang được bổ sung dần vào trang reference công khai. Trong lúc chờ, dùng `grn agentbase --help` hoặc `grn agentbase --help` để xem danh sách lệnh và tham số của phiên bản bạn đang cài. +{% endhint %} + +--- + +### 1. Cài đặt + +`grn` là một binary duy nhất, không phụ thuộc thư viện ngoài. Tải bản mới nhất cho hệ điều hành của bạn tại [GitHub Releases](https://github.com/GreenNodeHub/greennode-cli/releases). + +**macOS** + +```bash +# Apple Silicon (M1/M2/M3) +curl -L -o grn https://github.com/GreenNodeHub/greennode-cli/releases/latest/download/grn-darwin-arm64 +# Intel +curl -L -o grn https://github.com/GreenNodeHub/greennode-cli/releases/latest/download/grn-darwin-amd64 +chmod +x grn && sudo mv grn /usr/local/bin/ +``` + +**Linux** + +```bash +# x86_64 +curl -L -o grn https://github.com/GreenNodeHub/greennode-cli/releases/latest/download/grn-linux-amd64 +# ARM64 +curl -L -o grn https://github.com/GreenNodeHub/greennode-cli/releases/latest/download/grn-linux-arm64 +chmod +x grn && sudo mv grn /usr/local/bin/ +``` + +**Windows:** tải `grn-windows-amd64.exe` từ GitHub Releases và thêm vào `PATH`. + +**Build từ source** (cần [Go 1.22+](https://go.dev/dl/)): + +```bash +git clone https://github.com/GreenNodeHub/greennode-cli.git +cd greennode-cli/go +go build -o grn . && sudo mv grn /usr/local/bin/ +``` + +Kiểm tra: `grn --version` + +--- + +### 2. Cấu hình và xác thực + +Nhóm lệnh `agentbase` **dùng chung profile** `~/.greennode` với các nhóm lệnh khác của `grn` (`vks`, `vserver`) — không có file cấu hình riêng. Có 2 chế độ xác thực. + +**Machine mode (M2M)** — khuyến nghị cho CI/CD và script: + +```bash +grn configure +``` + +``` +GRN Client ID [None]: +GRN Client Secret [None]: +Default region name [HCM-3]: +Default output format [json]: +Project ID (leave blank to auto-detect) [None]: +``` + +**Client ID** và **Client Secret** lấy tại **GreenNode IAM Portal → Service Accounts** ([hcm-3.console.vngcloud.vn/iam](https://hcm-3.console.vngcloud.vn/iam/)). Để trống **Project ID** thì wizard tự phát hiện. + +**User mode (PKCE)** — khuyến nghị khi làm việc trực tiếp trên máy cá nhân: + +```bash +grn login # đăng nhập qua browser +grn logout # xoá login đã lưu +``` + +Chế độ đang dùng được quyết định bởi `auth_mode` trong profile (`user` hoặc `machine`). `grn login` chỉ lưu **refresh token** xuống đĩa (`0600`); access token giữ trong bộ nhớ tiến trình và tự refresh trước khi hết hạn. + +#### File cấu hình và biến môi trường + +Cấu hình lưu tại `~/.greennode/credentials` (quyền `0600`) và `~/.greennode/config`. Bạn có thể ghi đè bằng biến môi trường — biến môi trường luôn ưu tiên hơn file: + +| Biến môi trường | Ý nghĩa | +|---|---| +| `GRN_ACCESS_KEY_ID` | Client ID | +| `GRN_SECRET_ACCESS_KEY` | Client Secret | +| `GRN_DEFAULT_REGION` | Region mặc định | +| `GRN_DEFAULT_PROJECT_ID` | Project ID | +| `GRN_PROFILE` | Profile sử dụng (mặc định `default`) | +| `GRN_DEFAULT_OUTPUT` | Định dạng output mặc định | + +Với nhiều môi trường, dùng profile: `grn configure --profile staging`, sau đó `grn --profile staging agentbase runtime list`. + +#### Chọn môi trường dev / prod + +Môi trường được chọn qua `iam_env` trong profile (mặc định `prod`). AgentBase gọi tới `agentbase.api.vngcloud.vn` ở prod và `agentbase.api-dev.vngcloud.tech` ở dev. + +```bash +grn configure set iam_env # machine mode +grn login --iam-env # user mode +grn agentbase context current # xem environment + endpoint đang active +``` + +{% hint style="info" %} +Ở **user mode**, `iam_env` gắn với token đã đăng nhập — muốn đổi môi trường phải `grn login --iam-env ` lại. Ở **machine mode**, bạn đổi `iam_env` tự do. +{% endhint %} + +--- + +### 3. Các nhóm lệnh AgentBase + +Cấu trúc lệnh: `grn agentbase [options]`. Mỗi nhóm ánh xạ tới một service của AgentBase: + +| Nhóm lệnh | Quản lý | Trang liên quan | +|---|---|---| +| `context` | Xem environment, endpoint, header và decorator đang active | — | +| `identity` | Workload Identity và Outbound Auth (OAuth2, static API key, delegated), api-key delegate | [Access Control](access-control/README.md) | +| `gateway` | Tạo và quản lý MCP Gateway, access logs, Inbound Auth JWT, private network routes | [MCP Gateway](mcp-governance/mcp-gateway/README.md) | +| `runtime` | Deploy container chạy code agent (image, command, args, env, autoscaling), endpoint, logs, metrics, trace | [Agent Runtime](agent-runtime/README.md) | +| `memory` | Memory container, strategy, session, event và record | [Memory](memory/README.md) | +| `catalog` | Runtime flavor, OpenClaw version và workspace | [OpenClaw](agent-runtime/openclaw/README.md) | +| `policy` | Policy Group, policy, condition operator và decision | [Policy Groups](mcp-governance/policy-groups/README.md) | +| `cr` | Repository, image, artifact và registry credential trên vCR | [Container Registry](container-registry/README.md) | +| `deploy` | Orchestrator gộp `identity` + `memory` + `runtime` (+ `cr`) thành một vòng đời duy nhất | — | + +Xem trợ giúp bất cứ lúc nào bằng `grn agentbase --help`. + +Mọi lệnh đều nhận `-o` (`--output`) để chọn định dạng kết quả, và `--interactive` để CLI hỏi lần lượt các tham số bắt buộc còn thiếu: + +| Giá trị `-o` | Ý nghĩa | +|---|---| +| `table` (mặc định) | Bảng dễ đọc, secret được che | +| `json` | JSON thuần, secret hiển thị đầy đủ (ví dụ để pipe vào `docker login`) | +| `id` | Chỉ in ID — tiện cho script | + +{% hint style="warning" %} +`-o json` in secret ra ở dạng rõ (Client Secret, robot account password). Không dùng `-o json` trong log CI công khai hoặc terminal đang share màn hình. +{% endhint %} + +--- + +### 4. Deploy một agent bằng `deploy` + +Trong AgentBase, một **agent** là tập tài nguyên dùng chung một **name** làm khoá liên kết: một Identity (luôn có), một Memory container (tuỳ chọn — agent stateless thì bỏ), và một Runtime chạy code agent. Nhóm lệnh `deploy` là orchestrator phía client, gộp các service này lại thành một lifecycle: + +| Lệnh | Tác dụng | +|---|---| +| `deploy generate` | In ra manifest mẫu (YAML hoặc JSON) | +| `deploy up` | Áp manifest — tạo tài nguyên nếu chưa có, rồi chờ Runtime về `ACTIVE` | +| `deploy status` | Xem trạng thái của agent trên tất cả service | +| `deploy destroy` | Xoá Runtime và Memory của agent (thêm `--purge` để xoá cả Identity) | + +Sinh manifest mẫu rồi điền thông tin: + +```bash +grn agentbase deploy generate > agent.yaml +``` + +```yaml +# name là khoá liên kết dùng chung giữa identity + memory + runtime +# (3-50 ký tự, ^[a-zA-Z0-9_-]+$). identity luôn được tạo. +name: my-agent +description: "A customer-support agent" + +identity: + allowedReturnUrls: + - https://app.example.com/callback + +# memory: TUỲ CHỌN. Bỏ cả block này nếu agent stateless. +# Nếu có, cần ít nhất một strategy (name/type/namespaceTemplate). +memory: + eventExpiryDuration: 3600 + strategies: + - name: prefs + type: USER_PREFERENCE + namespaceTemplate: "/strategies/USER_PREFERENCE/actors/{actorId}" + +runtime: + image: registry.vngcloud.vn//my-agent:v1 + imageAuth: auto # "auto" tự lấy pull credential từ robot account vCR của bạn + command: [./agent] + args: [--port, "8080"] + env: {LOG_LEVEL: info} + flavorId: agent.small + autoscaling: {minReplicas: 1, maxReplicas: 3, cpuUtilization: 70, memoryUtilization: 80} +``` + +Áp manifest, theo dõi, rồi xoá khi không còn dùng: + +```bash +grn agentbase deploy up --file agent.yaml +grn agentbase deploy status my-agent +grn agentbase deploy destroy my-agent # xoá runtime + memory +grn agentbase deploy destroy my-agent --purge # xoá cả identity +``` + +`deploy up` là **idempotent** — chạy lại nhiều lần không tạo trùng tài nguyên. `up`, `status` và `destroy` đều tra tài nguyên theo name nên không cần file state. + +{% hint style="warning" %} +Khi `deploy up` lỗi giữa đường, CLI **không rollback** các tài nguyên đã tạo. Chạy lại `deploy up` (idempotent) để tiếp tục, hoặc `deploy destroy` để dọn sạch rồi làm lại. `deploy destroy --purge` xoá cả Identity và **không thể hoàn tác**. +{% endhint %} + +--- + +### 5. Xử lý sự cố thường gặp + +| Triệu chứng | Cách xử lý | +|---|---| +| `authentication failed: ...` | Chạy `grn configure` (machine) hoặc `grn login` (user). Kiểm tra environment và profile bằng `grn agentbase context current` | +| Lỗi 404 khi tra tài nguyên | `deploy` và `status` tra theo name — sai name hoặc tài nguyên nằm ở môi trường khác đều báo là không tồn tại | +| Runtime treo ở trạng thái `CREATING` | Runtime hội tụ không đồng bộ — dùng `grn agentbase runtime wait ` hoặc `deploy status ` để chờ | +| Đổi dev ↔ prod không có tác dụng | Machine mode: `grn configure set iam_env `. User mode: phải `grn login --iam-env ` lại vì token gắn với môi trường | + +--- + +Nếu gặp vấn đề, liên hệ GreenNode qua email: [**support@greennode.ai**](mailto:support@greennode.ai) - hotline: **19001549**. Trung tâm hỗ trợ: [https://helpdesk.greennode.ai](https://helpdesk.greennode.ai) diff --git a/Vietnamese/ai-stack/agent-base/su-dung-greennode-mcp-de-quan-ly-agentbase.md b/Vietnamese/ai-stack/agent-base/su-dung-greennode-mcp-de-quan-ly-agentbase.md new file mode 100644 index 00000000..36ab6fe2 --- /dev/null +++ b/Vietnamese/ai-stack/agent-base/su-dung-greennode-mcp-de-quan-ly-agentbase.md @@ -0,0 +1,287 @@ +# Sử dụng GreenNode MCP để quản lý AgentBase + +### Giới thiệu + +**AgentBase MCP** giúp AI assistant (Claude Desktop, Claude Code, Cursor, Windsurf, hoặc bất kỳ MCP client nào) thao tác trực tiếp với **GreenNode AgentBase** bằng ngôn ngữ tự nhiên — liệt kê Runtime, tạo MCP Gateway, tra Policy, xem Memory — mà không cần nhớ cú pháp lệnh hay click qua Portal. + +AgentBase MCP là máy chủ triển khai theo chuẩn [Model Context Protocol](https://modelcontextprotocol.io/). Repo: [https://github.com/vngcloud/greennode-agentbase-mcp](https://github.com/vngcloud/greennode-agentbase-mcp) + +Điểm khác biệt so với một MCP server thông thường: thay vì expose hàng trăm tool tương ứng từng API, AgentBase MCP chỉ expose **3 meta-tool** — `list_servers`, `search_tools`, `execute`. AI assistant tự tìm operation cần dùng rồi gọi, nên context của client luôn gọn dù AgentBase có bao nhiêu API. + +MCP là một trong các cách làm việc với AgentBase, bên cạnh [Portal](README.md) và [CLI](su-dung-greennode-cli-de-quan-ly-agentbase.md). Chọn MCP khi muốn để AI assistant tự tra cứu tài nguyên, gợi ý cấu hình và thực hiện thao tác thay bạn. + +{% hint style="info" %} +AgentBase MCP hiện chỉ hỗ trợ môi trường **prod** — các service đứng sau `agentbase.api.vngcloud.vn`. +{% endhint %} + +--- + +### 1. Chuẩn bị + +Bạn cần 2 thứ trước khi cấu hình bất kỳ client nào: + +| Yêu cầu | Chi tiết | +|---|---| +| **Bearer token** | Token IAM Service Account, đặt vào biến môi trường `GREENNODE_MCP_TOKEN`. Bắt buộc cho cả 2 cách kết nối | +| **Node.js ≥ 20** | Chỉ cần cho cách chạy local (stdio). Cách kết nối HTTP không cần cài gì trên máy | + +Token được mint từ **Client ID** và **Client Secret** của Service Account (lấy tại **GreenNode IAM Portal → Service Accounts**): + +```bash +export GREENNODE_MCP_TOKEN=$(curl -s -X POST \ + https://iam.api.vngcloud.vn/accounts-api/v2/auth/token \ + -u "$GREENNODE_CLIENT_ID:$GREENNODE_CLIENT_SECRET" \ + -H "Content-Type: application/x-www-form-urlencoded" \ + -d "grant_type=client_credentials" | jq -r .access_token) +``` + +{% hint style="warning" %} +`GREENNODE_MCP_TOKEN` là JWT ngắn hạn (khoảng **30 phút**) và có quyền thao tác thật trên tài nguyên AgentBase — coi như password. Không commit vào git, không paste vào file cấu hình dùng chung. Các mẫu cấu hình bên dưới tham chiếu token qua biến môi trường để giá trị không nằm trong file. Khi token hết hạn, mọi lệnh trả về `401` — xem mục [5. Xoay token](#id-5-xoay-token). +{% endhint %} + +--- + +### 2. Hai cách kết nối + +| Cách | Cơ chế | Client phù hợp | +|---|---|---| +| **Local stdio** | Client tự spawn server dưới dạng tiến trình con trên máy bạn | Claude Desktop, Claude Code, Cursor, Windsurf, Cline, Roo Code | +| **Remote HTTP** | Client gọi thẳng tới MCP Gateway của AgentBase qua HTTPS, không cài gì trên máy | Claude.ai (web) và mọi client hỗ trợ Streamable HTTP | + +Chọn **local stdio** khi bạn kiểm soát được máy chạy và muốn thử nghiệm nhanh. Chọn **remote HTTP** khi không thể hoặc không muốn chạy server cục bộ — Gateway đã bật Inbound Auth theo IAM và ghi access log tập trung. + +--- + +### 3. Cài đặt server cho cách local stdio + +```bash +git clone https://github.com/vngcloud/greennode-agentbase-mcp.git +cd greennode-agentbase-mcp +npm install + +export GREENNODE_MCP_TOKEN="" +``` + +Kiểm tra server chạy được — lệnh sẽ in banner rồi chờ input, nhấn `Ctrl-C` để thoát: + +```bash +npx tsx src/index.ts +``` + +Server đọc các biến môi trường sau (đều có giá trị mặc định, thường không cần đổi): + +| Biến môi trường | Mặc định | Ý nghĩa | +|---|---|---| +| `GREENNODE_MCP_TOKEN` | — | Bearer token dùng để gọi các service AgentBase | +| `TOKEN_ENV` | `GREENNODE_MCP_TOKEN` | Đổi tên biến chứa token, nếu bạn muốn dùng tên khác | +| `TRANSPORT` | `stdio` | `stdio` hoặc `http` | +| `PORT` | `8080` | Port lắng nghe khi `TRANSPORT=http` | +| `MAX_RESPONSE_BYTES` | `25000` | Ngưỡng cắt response để không làm tràn context của client | +| `SEARCH_LIMIT_DEFAULT` | `5` | Số kết quả mặc định của `search_tools` | + +{% hint style="info" %} +Cách stdio cần clone repo vì server nạp registry operation dựng sẵn (`registry.generated.json`) lúc khởi động, và file này đi kèm source. Endpoint HTTP đã có registry trong image nên không cần clone. +{% endhint %} + +--- + +### 4. Kết nối MCP client + +#### Claude Desktop + +Mở (hoặc tạo) file cấu hình MCP: + +* macOS: `~/Library/Application Support/Claude/claude_desktop_config.json` +* Windows: `%APPDATA%\Claude\claude_desktop_config.json` + +```json +{ + "mcpServers": { + "agentbase": { + "command": "npx", + "args": ["tsx", "/ABSOLUTE/PATH/TO/greennode-agentbase-mcp/src/index.ts"], + "cwd": "/ABSOLUTE/PATH/TO/greennode-agentbase-mcp", + "env": { + "GREENNODE_MCP_TOKEN": "" + } + } + } +} +``` + +Thoát hẳn Claude Desktop (không chỉ đóng cửa sổ) rồi mở lại. Trong chat mới, `agentbase` sẽ xuất hiện trong danh sách MCP server đã kết nối. + +{% hint style="warning" %} +Claude Desktop khởi chạy từ working directory khác terminal của bạn, nên `args` và `cwd` phải là **đường dẫn tuyệt đối**. Dùng đường dẫn tương đối, server sẽ không khởi động được. +{% endhint %} + +#### Claude Code + +Cách nhanh nhất — chạy trong thư mục repo: + +```bash +claude mcp add agentbase \ + -e GREENNODE_MCP_TOKEN="" \ + -- npx tsx src/index.ts +``` + +Hoặc thêm trực tiếp vào `~/.claude.json`: + +```json +{ + "mcpServers": { + "agentbase": { + "type": "stdio", + "command": "npx", + "args": ["tsx", "src/index.ts"], + "cwd": "/ABSOLUTE/PATH/TO/greennode-agentbase-mcp", + "env": { + "GREENNODE_MCP_TOKEN": "" + } + } + } +} +``` + +Khởi động lại Claude Code, rồi chạy `/mcp` trong session để xác nhận `agentbase` đã kết nối với 3 tool. + +#### Cursor và Windsurf + +Cả hai dùng cùng cấu hình như Claude Desktop, chỉ khác vị trí file: + +* Cursor: **Settings → Cursor Settings → MCP → Add new MCP server**, hoặc sửa `~/.cursor/mcp.json` +* Windsurf: **Settings → MCP Servers**, hoặc sửa `~/.codeium/windsurf/mcp_config.json` + +#### Cline và Roo Code + +* Cline: mở panel Cline → icon **MCP** → **Edit MCP Settings** (`~/.cline/mcp_settings.json`) +* Roo Code: **Settings → MCP Servers → Edit** (`~/.roo/mcp_settings.json`) + +Cấu hình giống trên, thêm 2 field riêng của extension: + +```json +{ + "mcpServers": { + "agentbase": { + "command": "npx", + "args": ["tsx", "/ABSOLUTE/PATH/TO/greennode-agentbase-mcp/src/index.ts"], + "cwd": "/ABSOLUTE/PATH/TO/greennode-agentbase-mcp", + "env": { + "GREENNODE_MCP_TOKEN": "" + }, + "disabled": false, + "alwaysAllow": [] + } + } +} +``` + +Mảng `alwaysAllow` cho phép duyệt trước một số tool để extension không hỏi lại mỗi lần gọi. Thêm `"list_servers"` và `"search_tools"` cho các luồng chỉ đọc, nhưng nên để `"execute"` vẫn hỏi vì tool này thay đổi tài nguyên thật. + +#### Claude.ai và các client HTTP + +Không cần clone repo. Thêm một MCP server dạng HTTP trỏ tới endpoint Gateway, kèm header `Authorization`: + +```json +{ + "mcpServers": { + "agentbase": { + "type": "http", + "url": "https:///agentbase_mcp/mcp", + "headers": { + "Authorization": "Bearer ${GREENNODE_MCP_TOKEN}" + } + } + } +} +``` + +Với Claude.ai bản web, vào **Settings → Connectors → Add custom connector** và điền URL cùng header Bearer. Connector chạy phía server nên token được lưu tại Anthropic — dùng token cấp riêng cho mục đích này nếu bạn quan tâm điểm đó. + +{% hint style="info" %} +Endpoint Gateway được cấp khi tính năng được bật cho project của bạn. Liên hệ [support@greennode.ai](mailto:support@greennode.ai) để nhận endpoint chính xác. +{% endhint %} + +--- + +### 5. Xoay token + +Client stdio đọc token **tại thời điểm spawn** và giữ nguyên giá trị đó, nên một server chạy lâu sẽ sống lâu hơn token. Repo có sẵn `scripts/mcp-launch.sh` — script này mint token mới rồi `exec` server, nên mỗi lần client spawn lại là token tự động được làm mới. Trỏ client vào script thay vì `npx tsx`: + +```json +"command": "bash", +"args": ["/ABSOLUTE/PATH/TO/greennode-agentbase-mcp/scripts/mcp-launch.sh"] +``` + +Script cần `GREENNODE_CLIENT_ID` và `GREENNODE_CLIENT_SECRET` có trong môi trường. Mỗi client có một cách buộc spawn lại khác nhau: + +| Client | Cách spawn lại server | +|---|---| +| Claude Desktop | Thoát hẳn ứng dụng rồi mở lại | +| Claude Code | Chạy `/mcp` rồi reconnect server `agentbase` | +| Cursor / Windsurf | Nhấn **Restart** cạnh server `agentbase` trong panel MCP | +| Cline / Roo Code | Restart server `agentbase` trong panel MCP của extension | +| Claude.ai (HTTP) | Không tự xoay được — mint token mới và cập nhật lại connector | + +Nếu chỉ có token tĩnh mà không có Client Secret trên máy, bỏ qua script và `export GREENNODE_MCP_TOKEN` lại trước khi spawn lại client. + +--- + +### 6. Ba meta-tool + +Mọi tương tác đều theo một luồng 3 bước: `list_servers` (định hướng) → `search_tools` (tìm operation) → `execute` (chạy). + +| Tool | Tham số | Tác dụng | +|---|---|---| +| `list_servers` | — | Liệt kê các service AgentBase khả dụng kèm số lượng operation và tag. Gọi đầu tiên để định hướng | +| `search_tools` | `query`, `server` (tuỳ chọn), `limit` (tối đa 25) | Tìm operation theo ý định bằng ngôn ngữ tự nhiên. Trả về kết quả kèm luôn input schema đầy đủ, dùng được ngay cho `execute` | +| `execute` | `id`, `args`, `fields` (tuỳ chọn) | Chạy operation theo `id` lấy từ `search_tools`. `fields` là biểu thức JMESPath để chiếu bớt response cho gọn | + +`list_servers` trả về 6 service: + +| Service | Phạm vi | +|---|---| +| `runtime` | Runtime chạy code agent, endpoint, logs, metrics, trace | +| `gateway` | MCP Gateway, Inbound Auth, access logs, private network | +| `identity` | Workload Identity và Outbound Auth | +| `memory` | Memory container, strategy, session, event, record | +| `policy` | Policy Group, policy và decision | +| `cr` | Repository, image và artifact trên vCR | + +{% hint style="warning" %} +Luôn lấy `id` từ kết quả `search_tools`, đừng tự đoán. Operation id phản chiếu `operationId` trong OpenAPI spec gốc nên không phải lúc nào cũng đẹp (`runtime.list_1`, `runtime.get`, `runtime.listEndpoints`…) và có thể thay đổi giữa các phiên bản spec. +{% endhint %} + +--- + +### Ví dụ nhanh: nhờ AI assistant deploy một agent + +Sau khi kết nối xong, chỉ cần hỏi AI assistant bằng ngôn ngữ tự nhiên: + +``` +Liệt kê các Agent Runtime đang chạy trong project của tôi, +rồi cho tôi biết runtime nào đang dùng nhiều CPU nhất trong 1 giờ qua. +``` + +AI assistant sẽ gọi `list_servers` để nhận ra service `runtime`, gọi `search_tools` với query "list agent runtimes" để lấy operation id và input schema, rồi gọi `execute` để chạy — hỏi lại bạn nếu thiếu thông tin bắt buộc. + +Nếu bạn viết agent bằng code thay vì dùng chat client, kết nối qua MCP SDK chính thức theo đúng luồng 3 bước: + +```typescript +const { tools } = await client.listTools(); +console.log(tools.map(t => t.name)); // ["list_servers","search_tools","execute"] + +const search = await client.callTool({ + name: "search_tools", + arguments: { query: "list agent runtimes", limit: 5 }, +}); + +const result = await client.callTool({ + name: "execute", + arguments: { id: "runtime.list_1", args: {} }, +}); +``` + +--- + +Nếu gặp vấn đề, liên hệ GreenNode qua email: [**support@greennode.ai**](mailto:support@greennode.ai) - hotline: **19001549**. Trung tâm hỗ trợ: [https://helpdesk.greennode.ai](https://helpdesk.greennode.ai) diff --git a/Vietnamese/ai-stack/release-notes.md b/Vietnamese/ai-stack/release-notes.md index 6d67d1da..2d7bcb4f 100644 --- a/Vietnamese/ai-stack/release-notes.md +++ b/Vietnamese/ai-stack/release-notes.md @@ -6,6 +6,16 @@ Tổng hợp các bản cập nhật của toàn bộ sản phẩm trong GreenNo ## Tháng 8, 2026 +**GreenNode AgentBase — CLI & MCP** + +AgentBase bổ sung 2 cách làm việc bên cạnh Portal — dòng lệnh và AI assistant: + +* **GreenNode CLI:** nhóm lệnh `grn agentbase` quản lý trọn vòng đời agent — Identity, Runtime, Memory, MCP Gateway, Policy và Container Registry — và deploy cả agent bằng một manifest duy nhất qua `grn agentbase deploy up`. Phù hợp để đưa việc deploy agent vào script tự động hoá và CI/CD. + * Tìm hiểu thêm tại [Sử dụng GreenNode CLI để quản lý AgentBase](agent-base/su-dung-greennode-cli-de-quan-ly-agentbase.md). + +* **AgentBase MCP:** máy chủ MCP cho phép AI assistant (Claude Desktop, Claude Code, Cursor, Windsurf...) thao tác với AgentBase bằng ngôn ngữ tự nhiên qua 3 meta-tool `list_servers` / `search_tools` / `execute`. Hỗ trợ cả kết nối local (stdio) và remote (HTTP qua MCP Gateway). + * Tìm hiểu thêm tại [Sử dụng GreenNode MCP để quản lý AgentBase](agent-base/su-dung-greennode-mcp-de-quan-ly-agentbase.md). + **GreenNode MaaS — Cập nhật danh mục model & bảng giá** GreenNode cập nhật danh mục model trên MaaS thành hai nhóm — **model do GreenNode self-host** và **model third-party** đã ký hợp đồng chính thức — kèm bảng giá tốt hơn cho nhiều model. Portal bổ sung **label loại model (Self-host / Partner)** ngay trên danh sách, giúp bạn dễ dàng phân biệt và chọn model phù hợp. diff --git a/Vietnamese/gioi-thieu-chung/thong-bao-va-cap-nhat/2026.md b/Vietnamese/gioi-thieu-chung/thong-bao-va-cap-nhat/2026.md index e3c73356..916dc888 100644 --- a/Vietnamese/gioi-thieu-chung/thong-bao-va-cap-nhat/2026.md +++ b/Vietnamese/gioi-thieu-chung/thong-bao-va-cap-nhat/2026.md @@ -158,6 +158,14 @@ Chính sách gia hạn tài nguyên này áp dụng từ ngày 8/1/2026 và áp **Tháng 8, 2026** +**GreenNode AgentBase — CLI & MCP** + +AgentBase bổ sung 2 cách làm việc bên cạnh Portal — dòng lệnh và AI assistant: + +* **GreenNode CLI:** nhóm lệnh `grn agentbase` quản lý trọn vòng đời agent (Identity, Runtime, Memory, MCP Gateway, Policy, Container Registry) và deploy cả agent bằng một manifest duy nhất — phù hợp để đưa việc deploy agent vào script tự động hoá và CI/CD. +* **AgentBase MCP:** cho AI assistant (Claude Desktop, Claude Code, Cursor, Windsurf...) thao tác với AgentBase bằng ngôn ngữ tự nhiên qua 3 meta-tool, hỗ trợ cả kết nối local (stdio) và remote (HTTP). +* Tìm hiểu thêm tại [AI Stack — Lịch sử cập nhật](../../ai-stack/release-notes.md). + **GreenNode AI Stack — Token Plan** Token Plan giúp khoá trước ngân sách AI hàng tháng bằng gói **prepaid 30 ngày** với hạn mức token/request cố định theo từng model — thay vì trả theo token thực dùng như PAYG.