@stellar-agent-services/dev-mcp 0.0.0-stage → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +50 -2
- package/dist/docs.d.ts +35 -0
- package/dist/docs.d.ts.map +1 -0
- package/dist/docs.js +92 -0
- package/dist/docs.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +6 -0
- package/dist/index.js.map +1 -0
- package/dist/server.d.ts +14 -0
- package/dist/server.d.ts.map +1 -0
- package/dist/server.js +125 -0
- package/dist/server.js.map +1 -0
- package/package.json +40 -4
- package/repository/AGENTS.md +162 -0
- package/repository/CONTRIBUTING.md +95 -0
- package/repository/IMPLEMENTATION_PLAN.md +560 -0
- package/repository/README.md +80 -0
- package/repository/SECURITY.md +22 -0
- package/repository/apps/wallet/README.md +78 -0
- package/repository/docs/client-integration/README-AI.md +495 -0
- package/repository/docs/client-integration/README.md +138 -0
- package/repository/docs/dx-improvements.md +670 -0
- package/repository/docs/erc-compatibility.md +163 -0
- package/repository/docs/job-recovery.md +201 -0
- package/repository/docs/payment-client.md +290 -0
- package/repository/docs/provider-setup-guide.md +348 -0
- package/repository/docs/provider-standard.md +728 -0
- package/repository/docs/recovery/README-AI.md +288 -0
- package/repository/docs/recovery/README.md +119 -0
- package/repository/docs/sow-closeout.md +67 -0
- package/repository/docs/standard/README-AI.md +614 -0
- package/repository/docs/standard/README.md +108 -0
- package/repository/docs/verification.md +504 -0
- package/repository/examples/paid-service/README.md +33 -0
- package/repository/examples/python-upstream/README.md +44 -0
- package/repository/llms.txt +65 -0
- package/repository/packages/create-stellar-service/README.md +143 -0
- package/repository/packages/dev-mcp/README.md +51 -0
- package/repository/packages/payment-client/README.md +98 -0
- package/repository/packages/protocol/README.md +15 -0
- package/repository/packages/protocol/schemas/manifest.schema.json +272 -0
- package/repository/packages/protocol/test-vectors/README.md +45 -0
- package/repository/packages/provider-kit/README.md +509 -0
- package/repository/packages/provider-kit/schemas/gateway-config.schema.json +140 -0
- package/repository/packages/verifier/README.md +131 -0
- package/repository/plugins/stellar-agent-services/README.md +31 -0
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
# Python API behind the gateway
|
|
2
|
+
|
|
3
|
+
An existing Python API, [app.py](app.py), that knows nothing about payments, sold as a paid Stellar service
|
|
4
|
+
with only a config file: [provider.config.json](provider.config.json). This is gateway mode of the
|
|
5
|
+
[Provider Kit](../../packages/provider-kit).
|
|
6
|
+
|
|
7
|
+
| Piece | Role |
|
|
8
|
+
| --- | --- |
|
|
9
|
+
| `app.py` | The existing API: `POST /summarize` takes `{ "text", "sentences" }`, answers JSON. Python standard library only. |
|
|
10
|
+
| `provider.config.json` | The gateway config: price (0.01 USDC, charged on success), schemas, capacity, upstream URL |
|
|
11
|
+
| `schemas/` | The input and output JSON Schemas, kept as files |
|
|
12
|
+
|
|
13
|
+
The gateway publishes the manifest, refuses invalid input before anyone pays, asks for the x402 payment, calls
|
|
14
|
+
`app.py` with only the validated input, checks its answer against the output schema, settles, and keeps the job
|
|
15
|
+
so a client that lost the response can collect it.
|
|
16
|
+
|
|
17
|
+
## Run it
|
|
18
|
+
|
|
19
|
+
From the repository root, after `npm install && npm run build`:
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
PUBLIC_ORIGIN=http://localhost:8787 node packages/provider-kit/dist/cli/index.js dev \
|
|
23
|
+
--config examples/python-upstream/provider.config.json --with "python3 examples/python-upstream/app.py"
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
`dev` starts the API on 127.0.0.1:5000, waits until it takes connections, then serves the gateway in front of it.
|
|
27
|
+
`PAY_TO` is the public address that receives the USDC. Without one, `dev` makes a throwaway testnet account to be paid
|
|
28
|
+
to, whose key is dropped at once; set `PAY_TO=G...` to an account in your own wallet to be paid there instead (see the
|
|
29
|
+
[setup guide](../../docs/provider-setup-guide.md)). Then pay it once from another terminal, with its example input:
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
node packages/provider-kit/dist/cli/index.js try summarize --manifest http://localhost:8787/.well-known/stellar-agent-services.json
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
It pays from a throwaway testnet account it funds itself, after you approve the exact payment, and shows the summary
|
|
36
|
+
and the transfer on chain.
|
|
37
|
+
|
|
38
|
+
`packages/provider-kit/test/gateway.test.ts` runs this example end to end, with a stand-in facilitator.
|
|
39
|
+
|
|
40
|
+
## In Docker
|
|
41
|
+
|
|
42
|
+
Build the image as the [setup guide](../../docs/provider-setup-guide.md) shows. On Docker, the gateway reaches
|
|
43
|
+
`app.py` at the host's address rather than `127.0.0.1`, so change `upstream.url` accordingly (for example
|
|
44
|
+
`http://host.docker.internal:5000/summarize`) and set `"store": "/data/jobs.sqlite"`.
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
# Stellar Agent Services
|
|
2
|
+
|
|
3
|
+
> Provider Standard v1 (`stellar-agent-services/provider@1`) and its tools: an open standard for paid AI services on Stellar. A provider publishes a manifest at `/.well-known/stellar-agent-services.json`, is paid per job in USDC through x402 v2 (`exact` scheme), and lets a client collect a paid job's result without paying again. This repository holds the spec, a TypeScript Provider Kit (a library, and a gateway that puts any existing HTTP API behind payments), a payment client, a verifier and an MCP server for coding agents. Development runs on Stellar testnet.
|
|
4
|
+
|
|
5
|
+
- The spec is the source of truth. Cite its rules by id, such as `[J13]`.
|
|
6
|
+
- A provider never holds a Stellar secret key: only its public `payTo` address and a facilitator URL.
|
|
7
|
+
- Everything starts on testnet, with test money. Mainnet (`stellar:pubnet`) is real USDC: `create-stellar-service --network mainnet`, and its facilitator wants an API key (`FACILITATOR_AUTH`). Never pay on mainnet unless the user asked.
|
|
8
|
+
- The packages are on npm: `npm create stellar-service` makes a new provider project. `@stellar-agent-services/provider-kit`, `payment-client` and `verifier` install into your own. AGENTS.md shows how.
|
|
9
|
+
- Agents should start with AGENTS.md, which picks a path and points to the right reference.
|
|
10
|
+
|
|
11
|
+
## Start here
|
|
12
|
+
|
|
13
|
+
- [AGENTS.md](https://raw.githubusercontent.com/AlgoriaLabs/stellar-agent-services/main/AGENTS.md): For AI coding agents: what this is, which path to take (new service, existing API, other language, paying client, verification, contributing), the rules that must not be broken, and when the work is done
|
|
14
|
+
- [README.md](https://raw.githubusercontent.com/AlgoriaLabs/stellar-agent-services/main/README.md): Project overview, packages and status
|
|
15
|
+
- [SECURITY.md](https://raw.githubusercontent.com/AlgoriaLabs/stellar-agent-services/main/SECURITY.md): Key boundaries every package keeps
|
|
16
|
+
|
|
17
|
+
## Standard
|
|
18
|
+
|
|
19
|
+
- [Provider Standard v1](https://raw.githubusercontent.com/AlgoriaLabs/stellar-agent-services/main/docs/provider-standard.md): The normative spec: manifest, services, payment, jobs, capacity, errors, identity, conformance levels. Rule ids M, S, P, J, Q, E, I, V, X
|
|
20
|
+
- [Standard reference for AI coding agents](https://raw.githubusercontent.com/AlgoriaLabs/stellar-agent-services/main/docs/standard/README-AI.md): The spec as an implementation reference: paths, constants, the create-job algorithm, headers, states, a rule index, common mistakes
|
|
21
|
+
- [Standard summary for people](https://raw.githubusercontent.com/AlgoriaLabs/stellar-agent-services/main/docs/standard/README.md): What the standard does and why, without the detail
|
|
22
|
+
- [Test vectors](https://raw.githubusercontent.com/AlgoriaLabs/stellar-agent-services/main/packages/protocol/test-vectors/README.md): Known-answer tests for an implementation in any language: canonical JSON, binding hashes, headers, manifests, challenges, job states, errors
|
|
23
|
+
- [Protocol package](https://raw.githubusercontent.com/AlgoriaLabs/stellar-agent-services/main/packages/protocol/README.md): The standard as dependency-free TypeScript: types, constants and rule checks
|
|
24
|
+
|
|
25
|
+
## Build a provider
|
|
26
|
+
|
|
27
|
+
- [Provider setup guide](https://raw.githubusercontent.com/AlgoriaLabs/stellar-agent-services/main/docs/provider-setup-guide.md): Step by step, from an idea or an existing API to a registered, verified paid service on testnet
|
|
28
|
+
- [Provider Kit](https://raw.githubusercontent.com/AlgoriaLabs/stellar-agent-services/main/packages/provider-kit/README.md): The library (`defineService`, `createProvider`), gateway mode, the `provider-kit` CLI, payment safety, capacity
|
|
29
|
+
- [create-stellar-service](https://raw.githubusercontent.com/AlgoriaLabs/stellar-agent-services/main/packages/create-stellar-service/README.md): `npm create stellar-service`: a new project around an existing API, a TypeScript service or a Python service, ready to run, try and deploy
|
|
30
|
+
- [Example paid service](https://raw.githubusercontent.com/AlgoriaLabs/stellar-agent-services/main/examples/paid-service/README.md): The template for a new TypeScript provider
|
|
31
|
+
- [Example Python API behind the gateway](https://raw.githubusercontent.com/AlgoriaLabs/stellar-agent-services/main/examples/python-upstream/README.md): An existing API made a paid service with only a config file
|
|
32
|
+
|
|
33
|
+
## Build a client
|
|
34
|
+
|
|
35
|
+
- [Client integrations for AI coding agents](https://raw.githubusercontent.com/AlgoriaLabs/stellar-agent-services/main/docs/client-integration/README-AI.md): Signer adapters, payment method adapters, and native clients in any language, with their rules and conformance checks
|
|
36
|
+
- [Client integrations summary](https://raw.githubusercontent.com/AlgoriaLabs/stellar-agent-services/main/docs/client-integration/README.md): The same, for people
|
|
37
|
+
- [Payment client design](https://raw.githubusercontent.com/AlgoriaLabs/stellar-agent-services/main/docs/payment-client.md): Approval, spending policy, journal, payment and recovery
|
|
38
|
+
- [Payment client package](https://raw.githubusercontent.com/AlgoriaLabs/stellar-agent-services/main/packages/payment-client/README.md): `PaymentClient`, the `stellar-pay` CLI and a testnet walkthrough
|
|
39
|
+
- [Agent Wallet page](https://raw.githubusercontent.com/AlgoriaLabs/stellar-agent-services/main/apps/wallet/README.md): The web page where a person approves and pays a service
|
|
40
|
+
|
|
41
|
+
## Verify
|
|
42
|
+
|
|
43
|
+
- [Verification](https://raw.githubusercontent.com/AlgoriaLabs/stellar-agent-services/main/docs/verification.md): Checks C1–C7, receipts, badges and the Stellar 8004 Validation Registry
|
|
44
|
+
- [Verifier package](https://raw.githubusercontent.com/AlgoriaLabs/stellar-agent-services/main/packages/verifier/README.md): The `verifier` CLI and library
|
|
45
|
+
|
|
46
|
+
## Job recovery
|
|
47
|
+
|
|
48
|
+
- [Job recovery](https://raw.githubusercontent.com/AlgoriaLabs/stellar-agent-services/main/docs/job-recovery.md): How a lost response is recovered without paying twice, and how uncertain payments are decided on chain
|
|
49
|
+
- [Job recovery for AI coding agents](https://raw.githubusercontent.com/AlgoriaLabs/stellar-agent-services/main/docs/recovery/README-AI.md): Invariants, file map and spec mapping for changing recovery code
|
|
50
|
+
- [Job recovery summary](https://raw.githubusercontent.com/AlgoriaLabs/stellar-agent-services/main/docs/recovery/README.md): The same, for people
|
|
51
|
+
|
|
52
|
+
## Tools for coding agents
|
|
53
|
+
|
|
54
|
+
- [MCP server](https://raw.githubusercontent.com/AlgoriaLabs/stellar-agent-services/main/packages/dev-mcp/README.md): Spec rules, docs, manifest validation and provider checks as MCP tools. It never pays
|
|
55
|
+
- [Claude Code plugin](https://raw.githubusercontent.com/AlgoriaLabs/stellar-agent-services/main/plugins/stellar-agent-services/README.md): Skills for building providers and clients, and for verifying them
|
|
56
|
+
|
|
57
|
+
## Optional
|
|
58
|
+
|
|
59
|
+
- [SOW closeout](https://raw.githubusercontent.com/AlgoriaLabs/stellar-agent-services/main/docs/sow-closeout.md): Readiness, remaining acceptance work, testnet deployment and evidence handoff
|
|
60
|
+
- [Contributing](https://raw.githubusercontent.com/AlgoriaLabs/stellar-agent-services/main/CONTRIBUTING.md): How changes are made: the spec first, then the kit, client and verifier
|
|
61
|
+
- [ERC compatibility](https://raw.githubusercontent.com/AlgoriaLabs/stellar-agent-services/main/docs/erc-compatibility.md): How the standard lines up with ERC-8126 (agent verification) and ERC-8196 (agent authenticated wallet)
|
|
62
|
+
- [Developer experience improvements](https://raw.githubusercontent.com/AlgoriaLabs/stellar-agent-services/main/docs/dx-improvements.md): What each phase of the developer-experience work changed for providers, and how it was checked
|
|
63
|
+
- [Manifest JSON Schema](https://raw.githubusercontent.com/AlgoriaLabs/stellar-agent-services/main/packages/protocol/schemas/manifest.schema.json): The schema every manifest must pass [M9]
|
|
64
|
+
- [Gateway config JSON Schema](https://raw.githubusercontent.com/AlgoriaLabs/stellar-agent-services/main/packages/provider-kit/schemas/gateway-config.schema.json): The schema of `provider.config.json`
|
|
65
|
+
- [Implementation plan](https://raw.githubusercontent.com/AlgoriaLabs/stellar-agent-services/main/IMPLEMENTATION_PLAN.md): The project plan and its weekly milestones
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
# create-stellar-service
|
|
2
|
+
|
|
3
|
+
`npm create stellar-service` makes a project that sells an AI service on Stellar: agents pay per call in USDC through
|
|
4
|
+
x402, under [Provider Standard v1](../../docs/provider-standard.md). The project runs, takes a paid testnet call and
|
|
5
|
+
goes live as it comes, with no wallet needed until it goes live.
|
|
6
|
+
|
|
7
|
+
```text
|
|
8
|
+
$ npm create stellar-service
|
|
9
|
+
|
|
10
|
+
Project folder [my-stellar-service]: captioner
|
|
11
|
+
What are you making?
|
|
12
|
+
1. Wrap an API you already run, in any language (no code changes)
|
|
13
|
+
2. A new service in TypeScript
|
|
14
|
+
3. A new service in Python (FastAPI)
|
|
15
|
+
Pick 1, 2 or 3 [1]: 1
|
|
16
|
+
Your API's OpenAPI document, or the URL a paid call goes to [http://127.0.0.1:8000/openapi.json]:
|
|
17
|
+
In one sentence, what does it offer? Agents search for it by these words and its name.
|
|
18
|
+
[Enter: the document's]: Captions for product photos, in English and Turkish.
|
|
19
|
+
What does a call cost, in USDC? [0.01]: 0.05
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
Then it writes the project and installs it. Next:
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
cd captioner
|
|
26
|
+
npm run dev # runs it here, paid to a throwaway testnet account: no wallet needed yet
|
|
27
|
+
npm run try # pays for one call with test money, from another terminal
|
|
28
|
+
npm run launch # goes live: one approval in your wallet, then Fly.io
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
`npm run launch` opens a page where your own wallet (Freighter, xBull, Albedo and others) approves the USDC trustline,
|
|
32
|
+
the Stellar 8004 registration and a request for verification, in one go. Then it saves `PAY_TO` and `AGENT_ID`,
|
|
33
|
+
deploys to Fly.io if you say yes, and waits until the service answers at its public address. `npm run status` shows
|
|
34
|
+
where it stands at any time.
|
|
35
|
+
|
|
36
|
+
The project depends on the Provider Kit released with this command. To try changes not released yet, run it from a
|
|
37
|
+
clone of the repository, built once (`npm install && npm run build`):
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
node packages/create-stellar-service/dist/index.js captioner
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
From a clone, it packs the Provider Kit into the project's `vendor/` folder, so the project installs and builds by
|
|
44
|
+
itself, in Docker too.
|
|
45
|
+
|
|
46
|
+
## What it makes
|
|
47
|
+
|
|
48
|
+
| Kind | You get |
|
|
49
|
+
| --- | --- |
|
|
50
|
+
| `wrap` | The [gateway](../provider-kit/README.md#gateway-mode) in front of an API you already run, in any language, with no code changes. With an OpenAPI document (FastAPI serves `/openapi.json`), `provider-kit init --openapi` makes a service of each POST endpoint it can call; without one, a starter service calls the URL you give. |
|
|
51
|
+
| `typescript` | A new service with the [Provider Kit library](../provider-kit/README.md#library-in-short): `src/server.ts` and an example service to replace, `src/services/summarize.ts`. |
|
|
52
|
+
| `python` | A new FastAPI app, `app.py`, with the gateway in front of it, and one container that runs both. |
|
|
53
|
+
|
|
54
|
+
Every project has `.env` (the settings, kept out of git) and `.env.example`, a `Dockerfile` that keeps the job
|
|
55
|
+
database on a volume at `/data`, a `fly.toml` for Fly.io, a `README.md`, and these scripts:
|
|
56
|
+
|
|
57
|
+
| Script | What it does |
|
|
58
|
+
| --- | --- |
|
|
59
|
+
| `npm run dev` | Starts the service, or the gateway (and the Python kind's API), at http://localhost:8787. With `PAY_TO` empty it is paid to a throwaway testnet account ([`provider-kit dev`](../provider-kit/README.md#the-throwaway-payout-account)) |
|
|
60
|
+
| `npm run try` | Pays for one call with test money, from a throwaway testnet account, and starts the service for it when it isn't running ([`provider-kit try`](../provider-kit/README.md#trying-a-paid-call)) |
|
|
61
|
+
| `npm run check` | Checks the provider against the standard and shows how agents see it |
|
|
62
|
+
| `npm run launch` | Takes it live: one page in your wallet for the trustline, the 8004 registration and verification, then the deploy ([`provider-kit launch`](../provider-kit/README.md#launching)) |
|
|
63
|
+
| `npm run status` | Where it stands, from running here to verified, and the command to run next |
|
|
64
|
+
| `npm run deploy` | Deploys again to Fly.io (`fly deploy`) |
|
|
65
|
+
| `npm start` | Starts it for production: `PUBLIC_ORIGIN` must be your HTTPS origin |
|
|
66
|
+
|
|
67
|
+
A gateway config reads `baseUrl`, `payTo`, `store` and the agent id from `.env` (`env:PUBLIC_ORIGIN`, `env:PAY_TO`,
|
|
68
|
+
`env:JOB_DB_PATH`, `env:AGENT_ID`), so the same file runs on a laptop and in a container.
|
|
69
|
+
|
|
70
|
+
**Fly.io.** `fly.toml` names the app after the folder, so the public address, `https://<app>.fly.dev`, is known before
|
|
71
|
+
the first deploy: `launch` registers the service with it, writes `PUBLIC_ORIGIN`, `PAY_TO` and `AGENT_ID` under
|
|
72
|
+
`[env]`, and deploys once. The job database lives on a volume Fly makes on the first deploy. Another host works too:
|
|
73
|
+
`npm run launch -- --url https://your.domain --no-deploy`.
|
|
74
|
+
|
|
75
|
+
**Python.** With [uv](https://docs.astral.sh/uv/) installed, `npm run dev` starts the API with
|
|
76
|
+
`uv run --with-requirements requirements.txt`, so there is no virtual environment to make. Without it, the next steps
|
|
77
|
+
give the two commands that make `.venv`.
|
|
78
|
+
|
|
79
|
+
## Mainnet
|
|
80
|
+
|
|
81
|
+
`--network mainnet` makes a project that takes real USDC on `stellar:pubnet`. What changes:
|
|
82
|
+
|
|
83
|
+
- **The facilitator.** Payments settle through OpenZeppelin's facilitator, `https://channels.openzeppelin.com/x402`,
|
|
84
|
+
which Stellar's docs list for mainnet (x402.org's settles testnet only). It wants an API key: get one at
|
|
85
|
+
[channels.openzeppelin.com/gen](https://channels.openzeppelin.com/gen) and set `FACILITATOR_AUTH="Bearer <key>"` in
|
|
86
|
+
`.env`. A gateway config sends it as `"facilitatorHeaders": { "Authorization": "env:FACILITATOR_AUTH" }`; the
|
|
87
|
+
TypeScript service reads it in `src/server.ts`. Without it, the service stops at start and says so.
|
|
88
|
+
- **The RPC.** `SOROBAN_RPC_URL` in `.env` starts as `https://mainnet.sorobanrpc.com`, the RPC the Stellar 8004 SDK
|
|
89
|
+
uses. Mainnet has no default one. For production traffic, an [RPC provider](https://developers.stellar.org/docs/data/apis/rpc/providers)'s
|
|
90
|
+
is safer.
|
|
91
|
+
- **No test money.** There is no throwaway account and no `npm run try`. `npm run launch` sets up the account clients
|
|
92
|
+
pay in your own wallet, which needs a few XLM, and `npm run dev` runs once `PAY_TO` is set.
|
|
93
|
+
- **The deploy.** `launch` stages `FACILITATOR_AUTH` and `SOROBAN_RPC_URL` as Fly secrets. A TypeScript service reads its
|
|
94
|
+
network from `STELLAR_NETWORK`, which `launch` also writes to `fly.toml`. It won't call a deploy live while it takes
|
|
95
|
+
payments on another network than the one it registered on.
|
|
96
|
+
|
|
97
|
+
To take a testnet project to mainnet, make these changes by hand: in a gateway config, `network`, `facilitator`,
|
|
98
|
+
`facilitatorHeaders` and `rpcUrl`; in a TypeScript project's `.env`, `STELLAR_NETWORK=stellar:pubnet`. In both, add
|
|
99
|
+
`FACILITATOR_AUTH` and `SOROBAN_RPC_URL` to `.env`. Then empty `PAY_TO` and `AGENT_ID` (testnet's agent ids don't exist
|
|
100
|
+
on mainnet), delete `DEV_PAY_TO`, and run `npm run launch`.
|
|
101
|
+
|
|
102
|
+
## For scripts and coding agents
|
|
103
|
+
|
|
104
|
+
Flags answer every question. Without a terminal it asks nothing, and `--kind` is needed:
|
|
105
|
+
|
|
106
|
+
```bash
|
|
107
|
+
create-stellar-service captioner --kind wrap --openapi http://127.0.0.1:8000/openapi.json \
|
|
108
|
+
--description "Captions for product photos, in English and Turkish." --price 0.05
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
| Flag | Answers |
|
|
112
|
+
| --- | --- |
|
|
113
|
+
| `--kind wrap\|typescript\|python` | What to make |
|
|
114
|
+
| `--openapi <file \| url>` | The API's OpenAPI document (`wrap`). It is read first, so nothing is written for an API that isn't running. With a file whose servers are relative, `--upstream` is the API's base URL. |
|
|
115
|
+
| `--upstream <url>` | Without `--openapi`: the URL a paid call goes to (`wrap`) |
|
|
116
|
+
| `--description <text>` | One sentence on what it offers: search matches it and the name |
|
|
117
|
+
| `--name <text>` | The provider's name. Default: the folder's, or the document's title. |
|
|
118
|
+
| `--price <usdc>` | What a call costs, in USDC. Default `0.01`. |
|
|
119
|
+
| `--network testnet\|mainnet` | Where clients pay. Default `testnet`, with test money. `mainnet` takes real USDC: see [Mainnet](#mainnet). |
|
|
120
|
+
| `--wallet`, `--pay-to <G…>` | Set up the payout account now in your wallet, or use an address you have. Without either, nothing is needed until `npm run launch`. |
|
|
121
|
+
| `--yes` | Take the defaults for the questions no flag answers |
|
|
122
|
+
|
|
123
|
+
`--wallet` opens a page in the user's browser, so a coding agent asks the user first. It signs nothing itself. So
|
|
124
|
+
does `npm run launch` later: a coding agent runs it with `--no-open` and gives the user the link.
|
|
125
|
+
|
|
126
|
+
## Safety
|
|
127
|
+
|
|
128
|
+
- **No secret key, anywhere.** It never asks for one, makes one or writes one. The payout account is set up in the
|
|
129
|
+
developer's own wallet, on `provider-kit launch`'s approval page, and only its public address is saved. Until then,
|
|
130
|
+
`npm run dev`'s throwaway testnet account has no key anyone keeps.
|
|
131
|
+
- **It never pays.** `npm run try` pays later, when the developer runs it, from a throwaway account with test money.
|
|
132
|
+
- **Testnet unless asked.** Every project starts on `stellar:testnet`; only `--network mainnet` makes a mainnet one.
|
|
133
|
+
- **Nothing is overwritten.** It refuses a folder that already has files in it.
|
|
134
|
+
|
|
135
|
+
## Files
|
|
136
|
+
|
|
137
|
+
| File | Contents |
|
|
138
|
+
| --- | --- |
|
|
139
|
+
| `src/main.ts` | The questions, the flags, and the run: write, install, the gateway config, the payout account if asked |
|
|
140
|
+
| `src/files.ts` | The files each kind writes: `package.json` and its scripts, `.env`, the README, the Python kind's gateway config, and the templates filled in |
|
|
141
|
+
| `src/kit.ts` | Where the Provider Kit comes from: a clone (packed into `vendor/`) or npm, and the npm overrides a project needs |
|
|
142
|
+
| `src/index.ts` | The command |
|
|
143
|
+
| `templates/` | The code and Dockerfiles each kind starts from, and `fly.toml` |
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
# @stellar-agent-services/dev-mcp
|
|
2
|
+
|
|
3
|
+
An MCP server for coding agents that build on [Provider Standard v1](../../docs/provider-standard.md): a provider,
|
|
4
|
+
a gateway config, a native implementation or a paying client. It answers from this repository's documents and runs
|
|
5
|
+
the verifier's unpaid checks.
|
|
6
|
+
|
|
7
|
+
**It holds no key and never pays.** It is not the payment client's MCP server, which would let an agent hire
|
|
8
|
+
providers. That one is planned in [packages/payment-client](../payment-client/README.md).
|
|
9
|
+
|
|
10
|
+
| Tool | What it does |
|
|
11
|
+
| --- | --- |
|
|
12
|
+
| `list_docs` | The documentation index, [llms.txt](../../llms.txt) |
|
|
13
|
+
| `read_doc` | One document from that index, by repository path (`AGENTS.md`, `docs/provider-standard.md`) or llms.txt URL. Nothing outside the index can be read. |
|
|
14
|
+
| `search_docs` | Lines of the indexed documents that contain every term of a query, as `path:line` |
|
|
15
|
+
| `get_spec_rule` | A rule of the standard by id (`J13`, `[M5]`), with its section |
|
|
16
|
+
| `validate_manifest` | Check C1 on a manifest document before it is served: JSON Schema [M9], the rules it can't express, service schemas, SHOULD rules. Same code as the verifier. |
|
|
17
|
+
| `check_provider` | `verifier check` on a running provider: C1, C2, C3, C6 and an unpaid C7 burst. C4 and C5 need a payer, so they are skipped. |
|
|
18
|
+
|
|
19
|
+
## Use
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
# Claude Code
|
|
23
|
+
claude mcp add stellar-agent-services -- npx -y @stellar-agent-services/dev-mcp
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
Any other MCP client takes the same command as a stdio server:
|
|
27
|
+
|
|
28
|
+
```json
|
|
29
|
+
{
|
|
30
|
+
"mcpServers": {
|
|
31
|
+
"stellar-agent-services": { "command": "npx", "args": ["-y", "@stellar-agent-services/dev-mcp"] }
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
Installed from npm, it reads the documents packed with it in `repository/`, from the same commit as its code. Run from
|
|
37
|
+
a clone instead (`node packages/dev-mcp/dist/index.js`, after `npm install && npm run build`), it reads the clone's
|
|
38
|
+
documents, so `git pull && npm run build` updates it.
|
|
39
|
+
|
|
40
|
+
As a library, `createServer(options)` returns the `McpServer`. `options.verify` passes options to
|
|
41
|
+
`verifyProvider()`, such as an offline provider's `fetch` in tests. It never takes a payer.
|
|
42
|
+
|
|
43
|
+
## Files
|
|
44
|
+
|
|
45
|
+
| File | Contents |
|
|
46
|
+
| --- | --- |
|
|
47
|
+
| `src/server.ts` | `createServer()`: the tools |
|
|
48
|
+
| `src/docs.ts` | The llms.txt index, document reads and search, spec rule parsing |
|
|
49
|
+
| `src/index.ts` | The stdio entry point |
|
|
50
|
+
| `scripts/pack-docs.mjs` | Before npm packs the package: copies llms.txt and every document it links to into `repository/` |
|
|
51
|
+
| `test/server.test.ts` | Every tool through a real MCP client; `check_provider` against the verifier's offline provider |
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
# @stellar-agent-services/payment-client
|
|
2
|
+
|
|
3
|
+
The buyer side: approval, spending policy, a hash-chained journal, payment and job recovery. The design is in
|
|
4
|
+
[docs/payment-client.md](../../docs/payment-client.md).
|
|
5
|
+
|
|
6
|
+
**Status: proof of concept.** The core flow works end to end on Stellar testnet with the built-in signer and
|
|
7
|
+
payment method, both in Node (the `stellar-pay` CLI) and in the browser (the minimal web page in
|
|
8
|
+
[apps/wallet](../../apps/wallet)). The MCP server, browser-wallet and passkey signers come later and reuse this core.
|
|
9
|
+
|
|
10
|
+
Signers and payment methods are strategies: the core keeps every safety step, and adapters for other wallets or
|
|
11
|
+
payment infrastructure plug in without changing it (docs/payment-client.md, "Strategies"). To build one, see
|
|
12
|
+
[docs/client-integration](../../docs/client-integration/README.md).
|
|
13
|
+
|
|
14
|
+
```ts
|
|
15
|
+
const client = new PaymentClient({
|
|
16
|
+
signer: localKeySigner(secret, "stellar:testnet"), // or a wallet adapter
|
|
17
|
+
methods: [x402ExactStellar()], // the default
|
|
18
|
+
policy, journal, secrets,
|
|
19
|
+
});
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
The main entry point runs in Node and the browser. Journal storage depends on where it runs:
|
|
23
|
+
|
|
24
|
+
| Entry point | Contents |
|
|
25
|
+
| --- | --- |
|
|
26
|
+
| `@stellar-agent-services/payment-client` | The core, the built-in signer and payment method |
|
|
27
|
+
| `…/node` | `fileJournalStorage`, `fileSecretStore`: files only the owner can read |
|
|
28
|
+
| `…/browser` | `indexedDbJournalStorage`, `indexedDbSecretStore`: IndexedDB with strict durability |
|
|
29
|
+
| `…/conformance` | The checks every adapter must pass |
|
|
30
|
+
|
|
31
|
+
| File | Contents |
|
|
32
|
+
| --- | --- |
|
|
33
|
+
| `src/client.ts` | `PaymentClient`: `quote()` (nothing signed), `pay()` (signs once), `decline()`, `recover()` (never pays) |
|
|
34
|
+
| `src/strategies.ts` | The `Signer` and `PaymentMethod` interfaces |
|
|
35
|
+
| `src/local-key-signer.ts` | The built-in signer: a secret key in this process |
|
|
36
|
+
| `src/x402-exact-stellar.ts` | The built-in payment method: x402 `exact` on Stellar, the only one Provider Standard v1 allows |
|
|
37
|
+
| `src/conformance.ts` | Checks that every signer and payment-method adapter must pass (`./conformance` entry point) |
|
|
38
|
+
| `src/policy.ts` | Spending policy with ERC-8196 field names; `checkPolicy()` fails closed |
|
|
39
|
+
| `src/verification.ts` | Application-trusted verification source; binds evidence to the approved manifest, payee, network and validity window [V1] |
|
|
40
|
+
| `src/journal.ts` | Append-only, hash-chained journal; job tokens kept apart in a `SecretStore` |
|
|
41
|
+
| `src/file-storage.ts` | Journal and job-token storage in files (`./node` entry point) |
|
|
42
|
+
| `src/browser-storage.ts` | Journal and job-token storage in IndexedDB (`./browser` entry point) |
|
|
43
|
+
| `src/manifest.ts` | Fetches and validates a provider manifest |
|
|
44
|
+
| `src/onchain.ts` | Confirms the settlement transaction on chain |
|
|
45
|
+
| `src/cli.ts` | `stellar-pay`, the PoC surface |
|
|
46
|
+
|
|
47
|
+
## Try it on testnet
|
|
48
|
+
|
|
49
|
+
```bash
|
|
50
|
+
npm install && npm run build
|
|
51
|
+
|
|
52
|
+
# A provider wallet (it only needs a USDC trustline) and a payer wallet with testnet USDC.
|
|
53
|
+
STELLAR_PAY_HOME=~/.stellar-pay-provider npx stellar-pay wallet create
|
|
54
|
+
STELLAR_PAY_HOME=~/.stellar-pay-provider npx stellar-pay wallet fund --usdc 0
|
|
55
|
+
npx stellar-pay wallet create
|
|
56
|
+
npx stellar-pay wallet fund --usdc 2 # buys testnet USDC on the testnet DEX
|
|
57
|
+
|
|
58
|
+
# The sample provider, paid to the provider wallet's address.
|
|
59
|
+
PAY_TO=G... node examples/paid-service/dist/server.js
|
|
60
|
+
|
|
61
|
+
# Pay, with an approval prompt.
|
|
62
|
+
MANIFEST=http://localhost:8787/.well-known/stellar-agent-services.json
|
|
63
|
+
npx stellar-pay services $MANIFEST --dev
|
|
64
|
+
npx stellar-pay pay $MANIFEST text-stats '{"text":"Hello agents."}' --dev
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
Job Recovery: start the provider with `DRILL_LOSE_RESPONSE=1 REPORT_DELAY_SECONDS=8`, pay `delayed-report`,
|
|
68
|
+
then run the `stellar-pay recover <job-id> --dev` command it prints. `stellar-pay jobs` and
|
|
69
|
+
`stellar-pay journal verify` show the journal.
|
|
70
|
+
|
|
71
|
+
`followPaymentUncertain: true` optionally follows an uncertain job within `followSeconds` while the provider
|
|
72
|
+
reconciles it [J13]. It only reads the original job and never pays again [J11]. The default returns uncertainty
|
|
73
|
+
immediately, so a UI can offer manual recovery. `provider-kit try` enables the bounded wait.
|
|
74
|
+
|
|
75
|
+
## Verification policy
|
|
76
|
+
|
|
77
|
+
Configured verification limits are checked at `quote()` and again at `pay()`, before signing [V1]. Install a
|
|
78
|
+
`verificationSource` in `PaymentClientOptions` to supply authenticated evidence. Without a source, or when it
|
|
79
|
+
returns missing, stale, mismatched or unreadable evidence, a payment requiring verification is blocked.
|
|
80
|
+
|
|
81
|
+
- `minVerificationScore` keeps ERC-8196's name and meaning: the **maximum allowed risk score**, 0–100, lower is
|
|
82
|
+
safer. It compares with the source's `riskScore`, not a receipt's higher-is-better conformance score.
|
|
83
|
+
- `stellar.minProviderLevel` is the minimum Provider Standard §8 level, 0–3.
|
|
84
|
+
- Even a configured value of zero requires evidence. Leaving both fields unset requires no source.
|
|
85
|
+
- Sources are trusted application code. They must authenticate validators and receipt/registry data, bind the
|
|
86
|
+
answer to the requested subject, set `checkedAt` and `expiresAt`, and bound their network calls. Never use a
|
|
87
|
+
provider's own claims as proof. No built-in registry/risk-source adapter is supplied yet.
|
|
88
|
+
- Recovery collects an already paid job without consulting the source or signing again [J11], [J13].
|
|
89
|
+
|
|
90
|
+
See [the design](../../docs/payment-client.md#verification-source) for the interface and trust boundary.
|
|
91
|
+
|
|
92
|
+
## Not done in the PoC
|
|
93
|
+
|
|
94
|
+
- No built-in Validation Registry or ERC-8126 risk-source adapter. Configured verification limits fail closed
|
|
95
|
+
until the application supplies its own trusted source.
|
|
96
|
+
- The wallet secret is a plain file (mode 600). Testnet only.
|
|
97
|
+
- No MCP server yet.
|
|
98
|
+
- Only the built-in signer and method. Adapters for other wallets come later, each in its own package.
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# @stellar-agent-services/protocol
|
|
2
|
+
|
|
3
|
+
Provider Standard v1 as code. It holds the manifest, job, receipt and header definitions that every other
|
|
4
|
+
package shares. Specification: [docs/provider-standard.md](../../docs/provider-standard.md).
|
|
5
|
+
|
|
6
|
+
| Path | Contents |
|
|
7
|
+
| --- | --- |
|
|
8
|
+
| [`schemas/manifest.schema.json`](schemas/manifest.schema.json) | The manifest JSON Schema (2020-12) |
|
|
9
|
+
| [`schemas/verification-receipt.schema.json`](schemas/verification-receipt.schema.json), [`schemas/validation-request.schema.json`](schemas/validation-request.schema.json) | The two Validation Registry documents: the verifier's receipt and the owner's request |
|
|
10
|
+
| [`test-vectors/`](test-vectors) | Known-answer tests that implementations in any language can use |
|
|
11
|
+
| `src/` | Types (manifest, `JobView`, `Problem`, `PaymentReceipt`, `VerificationReceipt`, `ValidationRequest`), constants and the reference checks: `canonicalJson`, `bindingHash`, `checkManifestRules`, `checkChallenge`, `stellarAddressKind`, `canTransition`, `chargedFor`, `conformanceLevel`, `validationRequestHash`, `validationRequestDataUri` |
|
|
12
|
+
|
|
13
|
+
- No runtime dependencies and no signing code, so the read-only discovery server can import it safely.
|
|
14
|
+
- It ships the schema rather than a validator. To validate a manifest, run any JSON Schema 2020-12 validator,
|
|
15
|
+
then `checkManifestRules()` (spec §2.4).
|