# secondlayer

> secondlayer is a freemium MCP server for analytics and data. Query Stacks blockchain data and scaffold subgraphs from an AI client. It can run locally on your machine or as a hosted remote server.

- **Kind:** MCP server
- **Pricing:** Freemium
- **Platforms:** API, Web, self-hosted, CLI
- **Website:** https://www.secondlayer.tools/docs/mcp
- **Repository:** https://github.com/ryanwaits/secondlayer/tree/HEAD/packages/mcp
- **MCP Registry name:** tools.secondlayer/secondlayer
- **Categories:** analytics and data, developer tools
- **Listing updated:** 2026-11-14

## About

Secondlayer indexes the Stacks chain, and this server lets an agent read contracts, events, transfers and blocks, then scaffold and manage subgraphs. The docs ask the agent to read `secondlayer://context` first, then use the resources it points to before calling tools.

The hosted server carries read tools only, and signs in through the browser; local stdio (`@secondlayer/mcp`) adds everything else, including deploying subgraphs and managing webhooks. Tool names include `index_events`, `index_ft_transfers`, `contracts_find`, `subgraphs_scaffold`, `subgraphs_deploy` and `webhooks_create`.

Billing is by rows delivered, with the first 1M rows free each month and $5 per 1M after that. Self-hosting is free under MIT licence.

## Features

- **Chain data reads:** Blocks, transactions, events and transfers.
- **Contract lookup:** Find contracts and inspect their calls.
- **Subgraph scaffolding:** Generate subgraph scaffolds and specs.
- **Webhook management:** Create webhooks, available on the local server.
- **Hosted or local:** Remote read-only or full-tool stdio.
- **Self-hostable:** The runtime is MIT licensed.

## Good for

- Look up fungible token transfers for a contract
- Scaffold a subgraph for a contract
- Backfill or reindex a subgraph
- Create a chain webhook

## Install

### Claude Code (Terminal)

```sh
claude mcp add --transport http secondlayer https://api.secondlayer.tools/mcp
```

### Claude Desktop (Settings → Connectors → Add custom connector)

```sh
https://api.secondlayer.tools/mcp
```

### Cursor (~/.cursor/mcp.json)

```json
{
  "mcpServers": {
    "secondlayer": {
      "url": "https://api.secondlayer.tools/mcp"
    }
  }
}
```

### VS Code (.vscode/mcp.json)

```json
{
  "servers": {
    "secondlayer": {
      "type": "http",
      "url": "https://api.secondlayer.tools/mcp"
    }
  }
}
```

### Windsurf (~/.codeium/windsurf/mcp_config.json)

```json
{
  "mcpServers": {
    "secondlayer": {
      "serverUrl": "https://api.secondlayer.tools/mcp"
    }
  }
}
```

### Other clients (your client's MCP settings (most use this shape))

```json
{
  "mcpServers": {
    "secondlayer": {
      "type": "http",
      "url": "https://api.secondlayer.tools/mcp"
    }
  }
}
```

## Tools

- `index_blocks`: Read indexed blocks.
- `index_events`: Read indexed events.
- `index_ft_transfers`: Read fungible token transfers.
- `index_nft_transfers`: Read NFT transfers.
- `index_transactions`: Read transactions.
- `index_contract_calls`: Read contract calls.
- `contracts_find`: Find contracts.
- `subgraphs_scaffold`: Scaffold a subgraph.
- `subgraphs_deploy`: Deploy a subgraph (local only).
- `subgraphs_backfill`: Backfill a subgraph.
- `subgraphs_reindex`: Reindex a subgraph.
- `subgraphs_query`: Query a subgraph.
- `webhooks_create`: Create a chain webhook.

## FAQ

### Can the hosted server deploy subgraphs?

No. It carries read tools only; use the local package for deploys and webhooks.

### How is it billed?

By rows delivered, with 1M free each month and $5 per 1M beyond.

### Can I self-host?

Yes. The runtime is MIT licensed and free to run yourself.

### How do I sign in?

Browser OAuth, or a Bearer `sk-sl_` key for clients without OAuth.

### Is secondlayer free?

secondlayer has a free plan, with paid plans for more usage or features.

### How do I add secondlayer to Claude Code?

Run this command in your terminal: claude mcp add --transport http secondlayer https://api.secondlayer.tools/mcp

### What are the best alternatives to secondlayer?

The closest alternatives to secondlayer are REA, Codebase Memory, GitHub, Serena MCP: the IDE for your agent and XERJ.

## Alternatives

- [REA](https://ai-powered.com/mcp/rea): REA is an open-source MCP server for developer tools.
- [Codebase Memory](https://ai-powered.com/mcp/codebase-memory): Codebase Memory is an open-source MCP server for knowledge and memory.
- [GitHub](https://ai-powered.com/mcp/github-2): GitHub is an open-source MCP server for developer tools.
- [Serena MCP: the IDE for your agent](https://ai-powered.com/mcp/serena-mcp-the-ide-for-your-agent): Serena MCP: the IDE for your agent is an open-source MCP server for developer tools.
- [XERJ](https://ai-powered.com/mcp/xerj): XERJ is an open-source MCP server for knowledge and memory.
- [Agent-Native Analytics](https://ai-powered.com/mcp/agent-native-analytics): Agent-Native Analytics is an open-source MCP server for analytics and data.
- [Ouroboros](https://ai-powered.com/mcp/ouroboros): Ouroboros is an open-source MCP server for developer tools.
- [Claude Code Ultimate Guide](https://ai-powered.com/mcp/claude-code-ultimate-guide): Claude Code Ultimate Guide is an open-source MCP server for ai models and llm tooling.

---
Source: https://ai-powered.com/mcp/secondlayer
