AgentStack
Browse Sign in
Browse Why AgentStack Sell Docs
Sign in
MCP verified MIT Self-run

Substack Gateway Oss

mcp-jakub-k-slys-substack-gateway-oss · by jakub-k-slys

Stateless Substack Gateway exposing a REST API and MCP for reading profiles, posts, notes, and comments, plus authenticated personal and note-publishing workflows.

No reviews yet
0 installs
18 views
0.0% view→install

Install

$ agentstack add mcp-jakub-k-slys-substack-gateway-oss

✓ scanned · ✓ verified, works with Claude Code, Cursor, and more.

Security review

✓ Passed

No issues found. Passed automated security review. · v0.1.0 How review works →

  • Prompt-injection patterns
  • Secret / credential exfiltration
  • Dangerous shell & filesystem operations
  • Untrusted network calls
  • Known-malicious package signatures

What it can access

  • Network access Used
  • Filesystem access No
  • Shell / process execution No
  • Environment & secrets No
  • Dynamic code execution No

From automated source analysis of v0.1.0. “Used” means the capability is present in the source — more access means more to trust, not that it’s unsafe.

View the full security report →

Verified badge

Passed review? Show it. Paste this badge into your README, it links to the public security report.

AgentStack Verified badge Links to your public security report.
[![AgentStack Verified](https://agentstack.voostack.com/badges/verified.svg)](https://agentstack.voostack.com/security/report/mcp-jakub-k-slys-substack-gateway-oss)

Reliability & compatibility

Security review passed
0 installs to date
no reviews yet
1mo ago

Declared compatibility

Claude CodeClaude DesktopCursorWindsurf

Compatibility is declared by the source manifest. End-to-end runtime verification is coming, see below.

Preview Execution monitoring

We're building live execution health for every listing: tool-call success rate, median latency, uptime, and last-checked timestamps, measured, not self-reported. It isn't live yet, so we don't show numbers we can't stand behind.

How agent discovery & health will work →
Are you the author of Substack Gateway Oss? Claim this listing to set pricing, connect Stripe payouts, and keep 70% of every sale.
Sign up to claim

About

Substack Gateway OSS

[](https://github.com/jakub-k-slys/substack-gateway-oss/actions/workflows/ci.yml) [](https://github.com/jakub-k-slys/substack-gateway-oss/actions/workflows/e2e.yml) [](https://substack-gateway.vercel.app)

A stateless Python gateway for Substack that exposes a REST API and an MCP server on top of the same service layer.

Designed to make Substack data and actions accessible from scripts, applications, and AI tooling — without duplicating integration logic across different interfaces.

What You Can Do

  • Read public Substack profiles, posts, notes, and comments
  • Access authenticated me endpoints with a base64-encoded credential token
  • Create and delete notes through the REST API
  • Use the same gateway as an MCP server for AI tools and agent workflows
  • Extend the app with custom routes, MCP tools, auth providers, and lifespan

hooks

Interfaces

  • REST API at /api/v1/*
  • MCP server at /mcp

Both share the same service layer and HTTP clients.

Quickstart

Requirements:

  • Python 3.10+
  • uv

Install dependencies:

uv sync --dev

Run the application locally:

uv run python -m substack_gateway.main

Check the root metadata endpoint:

curl http://127.0.0.1:5001/

Check the liveness probe:

curl http://127.0.0.1:5001/api/v1/health/live

Fetch a public profile:

curl http://127.0.0.1:5001/api/v1/profiles/

REST Example

Public profile lookup:

curl http://127.0.0.1:5001/api/v1/profiles/

Authenticated request:

curl \
  -H "x-gateway-token: " \
  http://127.0.0.1:5001/api/v1/me

The REST API is mounted under /api/v1 and includes endpoints for health, profiles, posts, notes, comments, and authenticated me operations.

Authentication

Gateway access and Substack access are separate concerns.

For this OSS repository, Substack credentials are passed as a base64-encoded JSON object. REST requests send that value as the x-gateway-token header.

Credential shape:

{
  "publication_url": "https://example.substack.com",
  "substack_sid": "s%3A...",
  "connect_sid": "s%3A..."
}

Encode it with:

echo '{"publication_url":"https://example.substack.com","substack_sid":"s%3A...","connect_sid":"s%3A..."}' | base64

Treat substack_sid and connect_sid as bearer credentials. Do not commit real values to the repository.

MCP

The MCP server is mounted at /mcp and served over streamable HTTP.

Public OSS MCP tools include:

  • get_note
  • get_post
  • get_post_comments
  • get_profile
  • get_profile_posts
  • get_profile_notes

Project Layout

Core application code lives in src/gateway_oss/.

  • api/v1/: FastAPI route handlers
  • mcp/: FastMCP tool surface and transport integration
  • services/: shared business logic
  • client/: Substack HTTP client wrappers
  • models/: schemas and pagination models
  • converters/: Markdown conversion
  • extensions/: runtime extension hooks

Configuration

Application settings are environment-driven via the SUBSTACK_GATEWAY_ prefix.

Common examples include:

  • SUBSTACK_GATEWAY_LOG_LEVEL
  • SUBSTACK_GATEWAY_SUBSTACK_BASE_URL
  • SUBSTACK_GATEWAY_SUBSTACK_TIMEOUT_SEC

Validation

uv run ruff check .
uv run ruff format --check .
uv run ty check .
uv build
uv run pytest tests/
uv run behave features/

Documentation

The repository includes MkDocs and Read the Docs configuration:

  • [Docs home](docs/index.md)
  • [Introduction](docs/introduction.md)
  • [Installation guide](docs/installation.md)
  • [Authentication](docs/authentication.md)
  • [API reference](docs/api-reference.md)
  • [MCP documentation](docs/mcp.md)
  • [Development guide](docs/development.md)
  • [Contributing guide](CONTRIBUTING.md)

Read the Docs can build the site directly from .readthedocs.yaml and mkdocs.yml.

Author

Built by Jakub Slys — Backend Engineer building distributed systems for telecoms, running a self-hosted Kubernetes homelab, and building AI automation pipelines with n8n, MCP, and Claude.

This gateway is the backend I use to automate my own Substack at iam.slys.dev, where I write about system design, machine learning fundamentals, and the AI tools I actually build and run in production.

If you want to understand how this gateway works under the hood — the architecture decisions, what I got wrong the first time, and how it fits into a full content automation stack — that's what the newsletter is for.

iam.slys.dev

Source & license

This open-source MCP server is cataloged on AgentStack and links to its original source — we do not rehost the code.

Install and usage instructions live in the source repository linked above.

Reviews

No reviews yet, be the first.

Versions

  • v0.1.0 Imported from the upstream source.