@secondlayer/mcp 6.0.0 → 7.0.0

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/README.md CHANGED
@@ -1,11 +1,11 @@
1
1
  # @secondlayer/mcp
2
2
 
3
- MCP server for Secondlayer, the hosted indexer for Stacks — Index (decoded
4
- rows), Subgraphs (your schema, hosted), and Streams (raw inputs). Exposes the
5
- golden-path tools only — Index reads, the subgraph lifecycle, subscriptions,
6
- contract discovery/scaffolding, and key self-provisioning. Everything else
7
- (single-record lookups, mempool, stacking, proofs, codegen, credits,
8
- live Streams reads) is available over REST `/v1` + OpenAPI.
3
+ Gives your coding agent direct access to the Stacks data on your own instance —
4
+ Index (decoded rows), Subgraphs (tables you define, served from your instance),
5
+ and Streams (raw inputs). Exposes the golden-path tools only: Index reads, the
6
+ subgraph lifecycle, subscriptions, and contract discovery/scaffolding.
7
+ Everything else (single-record lookups, mempool, stacking, proofs, codegen,
8
+ credits, live Streams reads) is available over REST `/v1` + OpenAPI.
9
9
 
10
10
  ## Install
11
11
 
@@ -15,7 +15,7 @@ bun add @secondlayer/mcp
15
15
 
16
16
  ## Auth
17
17
 
18
- Most reads are public — `index_*` and `contracts_find` work with no key. Subgraph tools need an `SL_API_KEY`; separately, **public** subgraphs are anon-readable over HTTP at `GET /v1/subgraphs/<name>/<table>` (`{ rows, next_cursor, tip }` cursor envelope), while private ones need the owning account's key (anon → 404). `streams_dumps` needs no key — the dumps manifest is public; the tool only needs `SL_STREAMS_DUMPS_URL` configured. Writes (deploy, reindex, delete, subscriptions) and account tools need a key: create one (prefixed `sk-sl_`) from your account console at https://console.secondlayer.tools and set it as `SL_API_KEY`. Read `secondlayer://context` first — it reports auth state and read-auth tiers.
18
+ Most reads are public — `index_*` and `contracts_find` work with no key. Subgraph tools need an `SL_API_KEY`; separately, **public** subgraphs are anon-readable over HTTP at `GET /v1/subgraphs/<name>/<table>` (`{ rows, next_cursor, tip }` cursor envelope), while private ones need the owning account's key (anon → 404). `streams_dumps` needs no key — the dumps manifest is public; the tool only needs `SL_STREAMS_DUMPS_URL` configured. Every other `streams_*` tool is key-mandatory (keyless → 401). Writes (deploy, reindex, delete, subscriptions) need a key: set `SL_API_KEY` to the `INSTANCE_TOKEN` that `secondlayer init` wrote for your instance. Read `secondlayer://context` first — it reports auth state and read-auth tiers.
19
19
 
20
20
  ## Quick Start — Stdio (IDE)
21
21
 
@@ -48,7 +48,7 @@ bunx -p @secondlayer/mcp secondlayer-mcp-http
48
48
 
49
49
  | Variable | Required | Default | Description |
50
50
  | --- | --- | --- | --- |
51
- | `SL_API_KEY` | Writes only | — | An `sk-sl_` API key from your account console (https://console.secondlayer.tools). Required for write/account tools; reads are public. |
51
+ | `SL_API_KEY` | Writes only | — | The `INSTANCE_TOKEN` from `secondlayer init`. Required for write tools; reads are public. |
52
52
  | `SECONDLAYER_API_URL` | No | `https://api.secondlayer.tools` | Base API URL. Point at a local instance for dev. |
53
53
  | `SECONDLAYER_MCP_PORT` | No | `3100` | HTTP transport port. |
54
54
  | `SECONDLAYER_MCP_SECRET` | No | — | Bearer token for HTTP auth. Disabled if unset. |
@@ -58,18 +58,22 @@ bunx -p @secondlayer/mcp secondlayer-mcp-http
58
58
  | Domain | Tools |
59
59
  | --- | --- |
60
60
  | **Index** (9) | `index_events`, `index_ft_transfers`, `index_nft_transfers`, `index_contract_calls`, `index_blocks`, `index_transactions`, `index_print_schema`, `index_discover`, `batch_query` |
61
- | **Subgraphs** (9) | `subgraphs_list`, `subgraphs_get`, `subgraphs_deploy`, `subgraphs_delete`, `subgraphs_query`, `subgraphs_backfill`, `subgraphs_reindex`, `subgraphs_stop`, `subgraphs_gaps` |
62
- | **Subscriptions** (7) | `subscriptions_create`, `subscriptions_list`, `subscriptions_get`, `subscriptions_update`, `subscriptions_delete`, `subscriptions_test`, `subscriptions_replay` |
63
- | **Streams** (1) | `streams_dumps` |
64
- | **Contracts** (2) | `contracts_find`, `get_contract_abi` |
65
- | **Scaffold** (1) | `scaffold_from_contract` |
61
+ | **Subgraphs** (12) | `subgraphs_list`, `subgraphs_status`, `subgraphs_spec`, `subgraphs_scaffold`, `subgraphs_deploy`, `subgraphs_delete`, `subgraphs_query`, `subgraphs_backfill`, `subgraphs_reindex`, `subgraphs_stop`, `subgraphs_operations`, `subgraphs_gaps` |
62
+ | **Subscriptions** (13) | `subscriptions_create`, `subscriptions_list`, `subscriptions_get`, `subscriptions_update`, `subscriptions_delete`, `subscriptions_test`, `subscriptions_pause`, `subscriptions_resume`, `subscriptions_rotate_secret`, `subscriptions_deliveries`, `subscriptions_dead`, `subscriptions_requeue`, `subscriptions_replay` |
63
+ | **Streams** (7) | `streams_tip`, `streams_events`, `streams_events_by_tx`, `streams_block_events`, `streams_canonical`, `streams_reorgs`, `streams_dumps` |
64
+ | **Contracts** (2) | `contracts_find`, `contracts_get_abi` |
65
+ | **Account** (2) | `account_whoami`, `account_create_key` |
66
+
67
+ Verify after mutating: `subgraphs_operations` for deploy/reindex/backfill/stop,
68
+ `subscriptions_deliveries` for create/test/replay.
66
69
 
67
70
  Periphery surfaces (single block/tx lookups, mempool, stacking, proofs,
68
- codegen, credits/caps, live Streams reads, delivery forensics) are
69
- REST-only: see the OpenAPI spec at the API host.
71
+ credits/caps, live Streams SSE) are REST-only: see the OpenAPI spec at the API
72
+ host. Following the chain over MCP means polling `streams_events` with a cursor.
70
73
 
71
- Account tools are unmounted. Point the server at your instance with `SL_API_URL`
72
- (default `http://127.0.0.1:3800`). Writes use `INSTANCE_TOKEN` from `secondlayer init`.
74
+ Point the server at your instance with `SL_API_URL` (default
75
+ `http://127.0.0.1:3800`). Writes and account tools use `INSTANCE_TOKEN` from
76
+ `secondlayer init`.
73
77
 
74
78
  ### `subscriptions_create` kinds
75
79
 
@@ -79,10 +83,6 @@ a webhook on raw chain events (contract / event / function / trait) with no
79
83
  subgraph (e.g. `[{ "type": "contract_call", "contractId": "SP....amm",
80
84
  "functionName": "swap-*" }]`).
81
85
 
82
- ### Subgraph visibility
83
-
84
- Deploys default `public` — the name is claimed in a single global public namespace (409 `PUBLIC_NAME_TAKEN` if claimed). Public subgraphs are anon-readable at `GET /v1/subgraphs/<name>/<table>`.
85
-
86
86
  ### `subgraphs_query` enhancements
87
87
 
88
88
  - `fields` — comma-separated column projection (e.g. `"sender,amount_x"`)