Skip to main content

No project description provided

Project description

PortHub

PortHub is a local-first tool for storing and retrieving Markdown context by hierarchical keys via CLI and MCP.

MVP Scope

  • Local filesystem storage only (default: ~/.porthub; configurable via PORTHUB_HOME or --root).
  • CLI workflows plus an MCP stdio server.
  • Five commands: set, get, search, list, server.
  • Exact match for get.
  • Case-insensitive substring match for search (with optional key-only/content-only modes).

Install

Install the CLI tool:

uv tool install -U porthub

Or run directly without installation:

uvx porthub --help

For local development in this repository:

uv sync

You can run commands either through uv:

uv run porthub --help

Or through the installed script:

porthub --help

Usage

Set Markdown content from an inline string:

porthub set python/typer "# Typer\nCLI framework for Python"

Set Markdown content from a file:

porthub set python/typer --file ./notes/typer.md

Set Markdown content from stdin:

cat ./notes/typer.md | porthub set python/typer --stdin

Get content by exact key:

porthub get python/typer

Search by key or content (case-insensitive):

porthub search typer

Search by key only:

porthub search typer --key-only

Search by content only:

porthub search typer --content-only

Limit search results:

porthub search typer --limit 10

List all keys:

porthub list

Use a custom storage root for any command:

porthub --help
porthub list --root ./tmp-porthub
porthub get python/typer --root ./tmp-porthub

Or set a default storage root via environment variable:

export PORTHUB_HOME=./tmp-porthub
porthub list

MCP Server

Start MCP server over stdio:

uv run porthub server
uvx porthub server

Use custom storage root:

uv run porthub server --root ./tmp-porthub

Default MCP tools (namespaced):

  • porthub_get(key)
  • porthub_set(key, value)
  • porthub_search(query, mode=\"all\"|\"key\"|\"content\", limit=None)
  • porthub_list()

Tool responses are structured JSON objects with:

  • ok (true or false)
  • error (null or {code, message})
  • tool payload fields such as key, content, matches, keys

Example MCP client configuration (same pattern as uvx + args):

{
  "mcpServers": {
    "porthub": {
      "command": "uvx",
      "args": ["porthub", "server"]
    }
  }
}

With custom storage root:

{
  "mcpServers": {
    "porthub": {
      "command": "uvx",
      "args": ["porthub", "server", "--root", "./tmp-porthub"]
    }
  }
}

Skills

This repository includes a local skill for package-documentation retrieval workflows:

  • Install (method 1):
npx skills add narumiruna/porthub
  • Install (method 2):
npx ctx7 skills install narumiruna/porthub
  • Skill source: skills/porthub/SKILL.md

Key Rules

A key is valid only when all rules pass:

  1. It is not empty after trimming spaces.
  2. It does not start or end with /.
  3. It does not contain //.
  4. It does not contain ...
  5. It does not end with .md.

Error Behavior

  • Validation failures return non-zero exit code.
  • get returns non-zero when a key is not found.
  • search returns empty output with exit code 0 when no match exists.
  • search returns non-zero when --key-only and --content-only are both provided.
  • search returns non-zero when --limit is not greater than 0.
  • set returns non-zero unless exactly one content source is provided:
    • positional value
    • --file
    • --stdin

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

porthub-0.0.5.tar.gz (5.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

porthub-0.0.5-py3-none-any.whl (6.7 kB view details)

Uploaded Python 3

File details

Details for the file porthub-0.0.5.tar.gz.

File metadata

  • Download URL: porthub-0.0.5.tar.gz
  • Upload date:
  • Size: 5.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.11 {"installer":{"name":"uv","version":"0.10.11","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for porthub-0.0.5.tar.gz
Algorithm Hash digest
SHA256 1a5a353c719f17abe0877ddb2f01036a09a67a1f6a248ad13a647b7dbb2cc78a
MD5 2b92c9e3ad9b518e7f4a98c2ba712edc
BLAKE2b-256 85d6a861e2826955ff76cc2cfb2cd29f4f6abf7c51446a4463e10095c0c2cdce

See more details on using hashes here.

File details

Details for the file porthub-0.0.5-py3-none-any.whl.

File metadata

  • Download URL: porthub-0.0.5-py3-none-any.whl
  • Upload date:
  • Size: 6.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.11 {"installer":{"name":"uv","version":"0.10.11","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for porthub-0.0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 f93fbc94b92f3555a86effee1e254991d3cdf6f800b90e18b52e0ffc4c44bdb4
MD5 e138584f0d05610b5de33bceae7861ee
BLAKE2b-256 a449a7eafeb59ed96809c991d040a6a4e69f44543a2bd2e001b104acf3f495b4

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page