AI agent이 Stacks blockchain 데이터에 접근하고, subgraph를 관리하며, 호스팅된 API 또는 로컬 인스턴스를 통해 webhook을 설정할 수 있도록 지원합니다.
다른 이름 ryanwaits/secondlayer, @secondlayer/mcp
- 스타
- 8
- Tools
- 2
- 다운로드, 30일
- —
- 최신 버전
- 11.6.6
- 마지막 커밋
- 2026년 11월 13일
- 라이선스
- MIT
secondlayer MCP란?
secondlayer은(는) MCP server입니다. AI agent이 Stacks blockchain 데이터에 접근하고, subgraph를 관리하며, 호스팅된 API 또는 로컬 인스턴스를 통해 webhook을 설정할 수 있도록 지원합니다. 2개 도구를 제공합니다. 예: fields, count.
프로젝트 README에서 생성된 요약
secondlayer MCP server 정보
Stacks blockchain 기반의 개발자는 이 MCP server를 사용하여 AI agent에게 blockchain 데이터 및 인프라 관리 권한을 직접 부여할 수 있습니다. Agent는 인덱스 읽기, subgraph의 전체 생명주기 관리, 그리고 원시 체인 이벤트에 반응하기 위한 webhook 설정을 수행할 수 있습니다. 이 서버는 브라우저 로그인을 통한 호스팅 API와 CLI로 관리되는 로컬 인스턴스를 모두 지원합니다.
사용자는 IDE 통합을 위해 stdio를 통해 연결하거나 원격 설정을 위해 HTTP transport를 사용할 수 있습니다. 많은 인덱스 및 contract discovery 도구는 공개되어 있지만, subgraph나 webhook을 관리하려면 로컬 설정의 경우 INSTANCE_TOKEN이, 호스팅 서비스의 경우 SECONDLAYER_API_KEY가 필요합니다. 이 도구 세트는 subgraph 배포, 재인덱싱, webhook 테스트와 같은 고가치 작업에 집중되어 있으며, 더 세밀한 데이터 조회는 REST API를 통해 수행하도록 설계되었습니다.
활용 사례
- 1subgraph 생명주기 관리AI agent가 blockchain 데이터를 정리하기 위해 커스텀 subgraph를 배포, 재인덱싱 또는 삭제할 수 있습니다.
- 2webhook 설정 자동화개발자는 특정 contract 호출이나 이벤트 발생 시 트리거되는 webhook을 생성하고 테스트하도록 agent에게 지시할 수 있습니다.
- 3디코딩된 blockchain 데이터 쿼리Agent는 트랜잭션 또는 전송을 위한 인덱스 도구를 사용하여 디코딩된 행에서 특정 정보를 검색할 수 있습니다.
- 4blockchain 아카이브 검증이 서버를 통해 agent는 데이터 무결성을 보장하기 위해 아카이브를 부트스트랩하고 검증할 수 있습니다.
프로젝트의 README를 바탕으로 작성되었습니다. 모든 활용 사례는 해당 내용의 인용문과 대조하여 확인합니다.
secondlayer MCP 설치 방법
형식 확인: 2026년 11월 10일Cursor에 추가Goose에 추가Claude Code에 secondlayer MCP 설치
$ claude mcp add --env 'SECONDLAYER_API_KEY=<YOUR_SECONDLAYER_API_KEY>' secondlayer -- npx -y @secondlayer/mcpCursor에 secondlayer MCP 설치
~/.cursor/mcp.json
{
"mcpServers": {
"secondlayer": {
"command": "npx",
"args": [
"-y",
"@secondlayer/mcp"
],
"env": {
"SECONDLAYER_API_KEY": "<YOUR_SECONDLAYER_API_KEY>"
}
}
}
}VS Code에 secondlayer MCP 설치
.vscode/mcp.json
{
"servers": {
"secondlayer": {
"type": "stdio",
"command": "npx",
"args": [
"-y",
"@secondlayer/mcp"
],
"env": {
"SECONDLAYER_API_KEY": "<YOUR_SECONDLAYER_API_KEY>"
}
}
}
}VS Code CLI에 secondlayer MCP 설치
$ code --add-mcp '{"name":"secondlayer","type":"stdio","command":"npx","args":["-y","@secondlayer/mcp"],"env":{"SECONDLAYER_API_KEY":"<YOUR_SECONDLAYER_API_KEY>"}}'Claude Desktop에 secondlayer MCP 설치
claude_desktop_config.json
{
"mcpServers": {
"secondlayer": {
"command": "npx",
"args": [
"-y",
"@secondlayer/mcp"
],
"env": {
"SECONDLAYER_API_KEY": "<YOUR_SECONDLAYER_API_KEY>"
}
}
}
}Codex에 secondlayer MCP 설치
$ codex mcp add secondlayer --env 'SECONDLAYER_API_KEY=<YOUR_SECONDLAYER_API_KEY>' -- npx -y @secondlayer/mcpCodex config.toml에 secondlayer MCP 설치
~/.codex/config.toml
[mcp_servers.secondlayer] command = "npx" args = ["-y", "@secondlayer/mcp"] [mcp_servers.secondlayer.env] SECONDLAYER_API_KEY = "<YOUR_SECONDLAYER_API_KEY>"
Gemini CLI에 secondlayer MCP 설치
$ gemini mcp add -s user -e 'SECONDLAYER_API_KEY=<YOUR_SECONDLAYER_API_KEY>' secondlayer npx -- -y @secondlayer/mcpGemini settings.json에 secondlayer MCP 설치
~/.gemini/settings.json
{
"mcpServers": {
"secondlayer": {
"command": "npx",
"args": [
"-y",
"@secondlayer/mcp"
],
"env": {
"SECONDLAYER_API_KEY": "<YOUR_SECONDLAYER_API_KEY>"
}
}
}
}secondlayer MCP 도구 2
README에서 감지됨fieldscount
| fields | — | |
| count | — |
구성
SECONDLAYER_API_KEY비밀Account API key (sk-sl_*) for the hosted API: credits, writes.
INSTANCE_TOKENSECONDLAYER_API_URLInstance API URL. Use https://api.secondlayer.tools for hosted.
SECONDLAYER_MCP_SECRET
| 이름 | 설명 | 유형 |
|---|---|---|
| SECONDLAYER_API_KEY | Account API key (sk-sl_*) for the hosted API: credits, writes. | 비밀 |
| INSTANCE_TOKEN | — | |
| SECONDLAYER_API_URL | Instance API URL. Use https://api.secondlayer.tools for hosted. | |
| SECONDLAYER_MCP_SECRET | — |
자동 검사
2026년 11월 12일에 실행됨전체 보고서 →자동 검사를 통과했습니다. 이는 보안 감사가 아닙니다. 코드를 직접 읽고 서버에 필요한 최소한의 권한만 부여하십시오. 검사 방식
- 소스 저장소 연결 및 접근 가능통과
- 오픈 소스 라이선스 (OSI)통과
- 최근 1년 내 커밋 또는 릴리스통과
- 패키지 이름이 인기 패키지와 유사하지 않음통과
- 원격 엔드포인트가 HTTPS 사용통과
- 파괴적인 도구에 라벨 표시됨통과
- 모델에 대한 숨겨진 지침 없음통과
- 패키지 및 해당 종속성에 중요한 보안 권고 없음통과
README
GitHub에서 보기@secondlayer/mcp
Gives your coding agent direct access to Stacks data, on the hosted API
(api.secondlayer.tools) or on your own instance:
Index (decoded rows), Subgraphs (tables you define, served from your account or instance),
and Streams (raw inputs). Exposes the golden-path tools only: Index reads, the
subgraph lifecycle, webhooks, contract discovery/scaffolding, instance
status, archive verify/bootstrap, and hosted credits/quote. Everything else
(single-record lookups, mempool, PoX, proofs, live Streams reads) is
available over REST /v1 + OpenAPI. There is no consume tool.
Hosted
No install: the hosted API serves the read tools over Streamable HTTP, with a browser sign-in.
claude mcp add --transport http secondlayer https://api.secondlayer.tools/mcp
Clients without OAuth send Authorization: Bearer <sk-sl_ key>. Subgraph
deploys, webhooks, archive, codegen and instance tools are local only. See
/docs/mcp.
Install
bun add @secondlayer/mcp
Auth
Most reads are public: index_* and contracts_find work with no key. Subgraph tools need an INSTANCE_TOKEN past loopback, and so does GET /v1/subgraphs/<name>/<table> over HTTP ({ rows, next_cursor, tip } cursor envelope); on loopback it is open. There is no per-subgraph public or private flag. streams_dumps needs no key: the dumps manifest is public; the tool only needs SL_STREAMS_DUMPS_URL configured. streams_tip is key-mandatory (keyless → 401). Live Streams list reads are REST-only (GET /v1/streams/*). Writes (deploy, reindex, delete, webhooks) need a key, and the key follows the host: on https://api.secondlayer.tools the server uses SECONDLAYER_API_KEY (sk-sl_*) automatically; anywhere else it uses INSTANCE_TOKEN from secondlayer init. Hosted credits/quote use SECONDLAYER_API_KEY too. On the hosted API, subgraph sources are limited to event filters and contract_call/contract_deploy (422 SOURCE_NOT_HOSTABLE otherwise); set startBlock. Read secondlayer://context first: it reports auth state and read-auth tiers.
Quick Start — Stdio (IDE)
Add to your Claude Desktop or Cursor config:
{
"mcpServers": {
"secondlayer": {
"command": "bunx",
"args": ["-p", "@secondlayer/mcp", "secondlayer-mcp"],
"env": {
"SECONDLAYER_API_URL": "http://127.0.0.1:3800",
"INSTANCE_TOKEN": "..."
}
}
}
}
Quick Start — HTTP (Remote)
export SECONDLAYER_API_URL=http://127.0.0.1:3800
export INSTANCE_TOKEN=<from secondlayer init>
export SECONDLAYER_MCP_SECRET=your-secret
bunx -p @secondlayer/mcp secondlayer-mcp-http
# Listening on port 3100
Environment Variables
| Variable | Required | Default | Description |
|---|---|---|---|
INSTANCE_TOKEN |
Writes on your instance | — | From secondlayer init. Required for write tools elsewhere than api.secondlayer.tools; reads are public. Not sent to the hosted API. |
SECONDLAYER_API_KEY |
Hosted API, credits/quote/latest | — | sk-sl_*, used automatically when SECONDLAYER_API_URL is https://api.secondlayer.tools. |
SECONDLAYER_API_URL |
No | http://127.0.0.1:3800 |
Instance API, or https://api.secondlayer.tools for hosted. |
SECONDLAYER_BIN |
CLI tools | secondlayer on PATH |
Path to the CLI binary (bootstrap, repair). |
SECONDLAYER_CWD |
CLI tools | process cwd | Compose project directory. |
SECONDLAYER_MCP_PORT |
No | 3100 |
HTTP transport port. |
SECONDLAYER_MCP_SECRET |
No | — | Bearer token for HTTP auth. Disabled if unset. |
Tools
| Domain | Tools |
|---|---|
| Index (9) | index_events, index_ft_transfers, index_nft_transfers, index_contract_calls, index_blocks, index_transactions, index_print_schema, index_discover, batch_query |
| 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 |
| Webhooks (13) | webhooks_create, webhooks_list, webhooks_get, webhooks_update, webhooks_delete, webhooks_test, webhooks_pause, webhooks_resume, webhooks_rotate_secret, webhooks_deliveries, webhooks_dead, webhooks_requeue, webhooks_replay |
| Streams (2) | streams_tip, streams_dumps |
| Contracts (2) | contracts_find, contracts_get_abi |
| Instance (1) | instance_status |
| Archive (5) | archive_verify, archive_bootstrap, archive_repair, archive_latest, archive_quote |
| Credits (1) | credits_balance (needs SECONDLAYER_API_KEY) |
| Account (4) | account_whoami, account_create_key, account_list_keys, account_rotate_key (only when pointed at https://api.secondlayer.tools) |
Verify after mutating: subgraphs_operations for deploy/reindex/backfill/stop,
webhooks_deliveries for create/test/replay. Empty index:
archive_bootstrap, poll instance_status until decoders are ok, then
archive_verify, then codegen_index_schema.
Periphery surfaces (single block/tx lookups, mempool, PoX, proofs,
credits/caps, live Streams reads/SSE) are REST-only: see the OpenAPI spec at
the API host. Live Streams list reads use GET /v1/streams/events.
Point the server at your instance with SECONDLAYER_API_URL (default
http://127.0.0.1:3800). Writes use INSTANCE_TOKEN from
secondlayer init. account_* tools appear only when the server is pointed at
https://api.secondlayer.tools.
webhooks_create triggers
Webhooks fire on raw chain events. Pass a triggers array (contract / event /
function / trait), e.g. [{ "type": "contract_call", "contractId": "SP....amm", "functionName": "swap-*" }]. To react to subgraph rows, read the
table from your own Postgres or poll the subgraph API.
subgraphs_query enhancements
fields— comma-separated column projection (e.g."sender,amount_x")count— boolean, returns row count instead of rows- Filter operators:
eq,neq,gt,gte,lt,lte,like - Max limit: 200
Resources
| URI | Description |
|---|---|
secondlayer://context |
Live state — what exists (your subgraphs, webhooks, account), what you can do, and read-auth tiers. Read first. |
secondlayer://filters |
Subgraph source filter types and their fields |
secondlayer://column-types |
Column type mappings and options |
secondlayer://traits |
SIP trait standards (valid trait values) |
secondlayer://chain-triggers |
Chain-webhook trigger types and fields |
Error Handling
All tools return structured errors with isError: true:
{ "error": { "type": "not_found", "status": 404, "message": "Subgraph not found" } }
| Error type | Status | When |
|---|---|---|
unauthorized |
401 | Invalid or missing API key |
not_found |
404 | Resource doesn't exist |
rate_limited |
429 | Too many requests |
server_error |
5xx | Server-side failure |
error |
other | Validation, bundling, etc. |
Bundle/deploy errors use descriptive prefixes: "Bundle failed:", "Module evaluation failed:", "Validation failed:". HTTP transport enforces a 1MB body limit (413) and JSON parse safety (400). Scaffold ABI fetch has a 10s timeout.
Programmatic Usage
import { createServer } from "@secondlayer/mcp";
const server = createServer();
// Connect to your own transport
License
MIT
secondlayer MCP 질문
secondlayer MCP를 Claude Code에 추가하려면 어떻게 하나요?
터미널에서 claude mcp add --env 'SECONDLAYER_API_KEY=<YOUR_SECONDLAYER_API_KEY>' secondlayer -- npx -y @secondlayer/mcp를 실행합니다. 모든 프로젝트에서 사용할 수 있게 하려면 --scope user를 추가합니다.
secondlayer MCP를 Cursor에 추가하려면 어떻게 하나요?
~/.cursor/mcp.json를 열고 mcpServers 아래에 서버를 추가합니다. 위 설치 섹션에 표시된 Cursor 구성을 사용합니다.
secondlayer MCP는 어떤 도구를 제공하나요?
2개 도구를 제공합니다. 예: fields, count.
모든 도구에 API key가 필요한가요?
아니요, index_events 및 contracts_find와 같은 대부분의 읽기 작업은 공개되어 있어 키 없이도 작동합니다. 하지만 subgraph 도구 및 쓰기 작업에는 INSTANCE_TOKEN 또는 API key가 필요합니다.
개인 로컬 인스턴스와 함께 사용할 수 있나요?
네, SECONDLAYER_API_URL 환경 변수를 설정하여 서버가 사용자의 인스턴스를 가리키도록 할 수 있습니다.
secondlayer://context 리소스의 용도는 무엇인가요?
현재 인증 상태와 사용 가능한 read-auth 티어를 보고하는 데 사용됩니다.