> ## Documentation Index
> Fetch the complete documentation index at: https://acachete.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Quickstart

> Build the contracts, run the test suite, and stand up a demo wallet on Stellar testnet.

## Prerequisites

<CardGroup cols={2}>
  <Card title="stellar-cli" icon="terminal">
    Rust toolchain + the `wasm32v1-none` target for building Soroban contracts.
  </Card>

  <Card title="Bun 1.3+" icon="bolt" href="https://bun.sh">
    Package manager, native TypeScript runtime, and test runner -- no Node/npm needed for development.
  </Card>
</CardGroup>

## 1. Build and test the contracts

<CodeGroup>
  ```bash Rust theme={null}
  stellar contract build
  cargo test --workspace
  ```
</CodeGroup>

This compiles `contracts/example-vault` (the canonical demo contract) and `contracts/agent-policy` (the generalized policy signer), then runs their unit tests -- 17 tests total (11 for `agent-policy`, 6 for `example-vault`), entirely offline.

## 2. Install and typecheck the TypeScript layer

<CodeGroup>
  ```bash Bun theme={null}
  bun install
  bun run typecheck
  bun test
  ```
</CodeGroup>

`bun test` runs the fast unit suite (40 tests across 6 files, zero network calls, well under a second) covering every hand-rolled Soroban XDR encoder, the MCP arg-filling heuristic, and `stellar agentgate init`'s flag parsing.

<Warning>
  Bare `bun test` also discovers `test/e2e/*.e2e.test.ts` if run without a path argument -- that's the `test:all` script's job. The scoped, fast command is `bun run test` (→ `bun test test/unit`).
</Warning>

## 3. Stand up a demo wallet on testnet

<CodeGroup>
  ```bash Bootstrap theme={null}
  bun run reset-demo
  ```
</CodeGroup>

This single command:

<Steps>
  <Step title="Generates fresh identities">
    A local `owner` (admin) key and an `agent-signer` (machine/agent) key, both funded via friendbot.
  </Step>

  <Step title="Deploys three fresh contracts">
    `example-vault`, `agent-policy`, and a `passkey-kit` smart wallet instance, all on Stellar testnet.
  </Step>

  <Step title="Wires the policy gate">
    Adds `agent-signer` and `agent-policy` as wallet signers, configures the allow-list (`deposit` uncapped, `withdraw` capped at 1000/24h), then restricts `agent-signer` to require `agent-policy` as a co-signer.
  </Step>

  <Step title="Writes .env">
    Every ID and secret the other scripts and the MCP server need -- gitignored, never committed.
  </Step>
</Steps>

## 4. Watch the policy gate in action

<CodeGroup>
  ```bash Scripted demo theme={null}
  bun run demo
  ```
</CodeGroup>

Runs the exact allow/reject sequence this documentation describes, against the wallet `reset-demo` just deployed:

```text theme={null}
-> deposit(wallet, 2000) -- allowed, uncapped
   ALLOWED  tx=...

-> withdraw(wallet, 100) -- allowed, within 1000 window cap
   ALLOWED  tx=...

-> withdraw(wallet, 950) -- REJECTED: 100+950=1050 exceeds 1000 window cap
   REJECTED  re-simulation failed: HostError: Error(Auth, InvalidAction)

-> touch(wallet) -- REJECTED: method not on the allow-list
   REJECTED  re-simulation failed: HostError: Error(Auth, InvalidAction)
```

## 5. Run it as an MCP server

`stellar-agentgate` is [published on npm](https://www.npmjs.com/package/stellar-agentgate) -- no clone required to install it:

<CodeGroup>
  ```bash From npm theme={null}
  npm install -g stellar-agentgate
  ```

  ```bash From source theme={null}
  bun run build
  bun link          # or: bun install -g .
  ```

  ```bash Use it theme={null}
  stellar agentgate policy-explain   # human-readable: what can this agent do?
  stellar agentgate mcp              # MCP server over stdio
  ```
</CodeGroup>

`stellar-cli` discovers `stellar-agentgate` on `PATH` and runs it as a native subcommand -- there is no `stellar plugin install`; installation is entirely this package's responsibility, exactly like any other `stellar-<name>` plugin.

<CardGroup cols={2}>
  <Card title="Next: understand the architecture" icon="arrow-right" href="/concepts/architecture">
    See exactly how a natural-language request becomes an on-chain decision.
  </Card>

  <Card title="Wire up your own wallet" icon="user-plus" href="/guides/self-service-onboarding">
    Everything above uses a disposable demo wallet -- `stellar agentgate init` does the same wiring against your own.
  </Card>
</CardGroup>
