Skip to content

Support ClickHouse-backed MCP Skills (SEP-2640), including supplementary resources, without filesystem storage #200

Backlog

Description

@BorisTyshkevich

Motivation

The MCP Skills extension (SEP-2640) enables an MCP server to publish Agent Skills alongside its tools. Native support in Claude and other clients makes it possible to distribute application-specific workflows and domain expertise through the same connector as the application's read and write tools.

Altinity MCP should implement this using the same architectural principle as dynamic tools: ClickHouse owns the application data and logic; Altinity MCP is a stateless protocol adapter.

Skills, their descriptions, supporting documents, version selection, and visibility rules should be defined in ClickHouse. There should be no local skills directory, filesystem-backed provider, persistent MCP-side skill store, or requirement to rebuild/redeploy Altinity MCP when a skill changes.

For example, an analytics application can expose parameterized read views, insert-backed write tools, and skills explaining its business semantics and approved analytical workflows. An agent-memory application can expose tools to discover and save knowledge, plus skills teaching agents when and how to use them.

Proposed design

1. Shared resource provider — dependency on #202

Use the generic ClickHouse-backed MCP Resources and Resource Templates provider (#202) as the authoritative storage/retrieval layer. Do not implement a separate skill table contract or file reader. The Skills extension is a projection over the same logical resource interface used for general documents, instructions (#196, optional Stage 2) and MCP Apps (#203).

Support the required logical SKILL.md document and arbitrary supplementary resources from the beginning. The reference deployment in #205 uses one physical application-definition table app.mcp_catalog; its ordinary resource view app.mcp_resources exposes the #202 contract. Any table/view exposing the same contract works. No separate skill storage table is needed. Skill identity and file paths are derived from validated logical URIs.

For example, using the reference catalog from #205 (revision 1, one application namespace):

INSERT INTO app.mcp_catalog
    (kind, id, name, description, mime_type, content, revision)
VALUES
(
    'resource',
    'skill://query-optimization/SKILL.md',
    'query-optimization',
    'Diagnose and optimize ClickHouse queries.',
    'text/markdown',
    '---
name: query-optimization
description: Diagnose and optimize ClickHouse queries.
---

# Query optimization

Inspect system.query_log, identify expensive queries,
and analyze EXPLAIN output.
Read references/indexes.md when investigating index usage.',
    1
),
(
    'resource',
    'skill://query-optimization/references/indexes.md',
    'indexes.md',
    'Index analysis reference',
    'text/markdown',
    '# Index analysis

Use EXPLAIN indexes = 1 to inspect index pruning.',
    1
),
(
    'resource',
    'skill://query-optimization/examples/queries.sql',
    'queries.sql',
    'Example diagnostic query',
    'text/plain',
    'SELECT query_id, query_duration_ms FROM system.query_log ORDER BY query_duration_ms DESC LIMIT 10;',
    1
);

The view returns the three logical resources. Publication, revision selection and visibility are application responsibilities; manifest integrity still requires a consistent published revision and exact byte verification. See #202/#205 for the resource contract and ReplacingMergeTree limitations. No corresponding local files are created by Altinity MCP. Clients may materialize resources locally; supplementary scripts are served as data, not executed by the connector.

2. Configuration

Proposed opt-in configuration using #202:

server:
  resources:
    - table: app.mcp_resources
  skills:
    enabled: true

The field names are illustrative. Discover eligible skill://.../SKILL.md roots from the configured provider, validate them against Agent Skills rules, and build complete manifests using the same authorized resource source. Non-skill resources remain available through core MCP Resources, subject to authorization. If allowing additional URI schemes or explicit skill catalog selection, keep the contract consistent with SEP-2640. No local directory or per-skill server configuration is needed. Skills-specific grouping, frontmatter, manifests and protocol semantics belong here; generic URI resolution, byte retrieval, templates and authorization belong in #202.

3. Protocol implementation

Implement the Beta Skills specification, extension identifier io.modelcontextprotocol/skills.

MCP operation ClickHouse-backed behavior
server/discover (or applicable capability negotiation for the negotiated protocol revision) Advertise the Skills extension and Resources capability when enabled.
skills/list Discover visible skill entries, including parsed SKILL.md frontmatter and complete resource manifests. Support protocol pagination and credential-appropriate caching.
skills/get Retrieve one skill entry by its root SKILL.md URI, including skills omitted from a listing.
resources/read Use the shared provider (#202) to retrieve exact resource content.
resources/directory/read Enumerate immediate logical children of a directory, if advertising the optional directoryRead capability.

Reuse the existing MCP SDK and resource handling where possible. Track upstream Go SDK support and use an extension adapter if necessary rather than waiting for a filesystem provider. Do not substitute ordinary tools returning markdown for the native Skills protocol.

Parse YAML frontmatter from the actual SKILL.md bytes; return the complete frontmatter as JSON in skill metadata, including all author-defined fields. Validate required name and description, Agent Skills naming rules, and agreement between the name and the last segment of the skill path.

Each skill entry must expose the root SKILL.md URI and either a complete manifest of its logical resources or the explicit protocol dynamic marker. For ordinary table/view-backed skills, prefer complete manifests with resource URI, SHA-256 digest (sha256:<lowercase hex>), and raw byte size. Compute digest and size from exactly the bytes served by resources/read; ClickHouse can perform these calculations in SQL to avoid loading supporting documents during discovery.

Example entry (digest abbreviated for readability):

{
  "uri": "skill://query-optimization/SKILL.md",
  "frontmatter": {
    "name": "query-optimization",
    "description": "Diagnose and optimize ClickHouse queries."
  },
  "resources": [
    {
      "uri": "skill://query-optimization/SKILL.md",
      "digest": "sha256:...",
      "size": 200
    }
  ]
}

The actual manifest must include every resource, including supporting resources, with real digests and sizes. Use content digests even if the database content is editable. Use resources: "dynamic" only where stable digests genuinely cannot be published; clients may reject unverifiable skills. No implicit downgrade to dynamic on validation errors.

Handle nested paths and nested skills according to the spec, or explicitly reject unsupported nested-skill configurations in the initial implementation. Support supplementary resources in subdirectories regardless.

4. Statelessness, security and lifecycle

  • All discovery and reads must use the request's effective ClickHouse identity, roles, settings, and selected cluster, following the existing OAuth/JWE/multicluster isolation model. Respect ClickHouse grants and row policies; no static-credential fallback in authenticated mode.
  • Direct URI reads and skills/get must independently enforce access. A resource must not become readable merely because its URI is known or appeared in a previous cached catalog. Validate/normalize logical paths, reject ambiguous encodings, traversal, absolute paths, and collisions with other resource namespaces; use parameter binding and safe identifier handling for SQL.
  • Cache only as an optional optimization, isolated by effective principal/credential and cluster, with no authoritative state in the MCP process and no dependency on session affinity. Do not mark caller-specific manifests as globally shareable. Content hashes are integrity checks, not an authorization mechanism.
  • Define a publication/versioning convention using ClickHouse tables/views so the metadata and manifest describe a consistent published revision. A content change must update the manifest; handle clients reading across concurrent updates through the protocol's digest verification and refresh mechanism. Never silently serve mismatched frontmatter/content. Consider immutable/versioned URI paths where applications need stable reads across edits.
  • Bound query costs, catalog page size, frontmatter parsing and response bytes. Honor the extension's per-skill limits (512 resources, 16 MiB total content) and document any additional limits. Do not use existing SELECT row/byte truncation to silently publish incomplete manifests or corrupt resource bytes.
  • A skill provides instructions, not additional authority. The host's approval rules and existing MCP tool authorization must still apply. Document that writers of skill content can influence agent behavior and should be trusted/controlled through ClickHouse grants.
  • Multiple MCP replicas should work against the same ClickHouse source with no shared filesystem or persistent MCP-side database. Editing/publishing a skill should require only database operations, not a service restart.

Acceptance criteria

  • Enabling Skills over the configured shared resource provider (Generic ClickHouse-backed MCP Resources and Resource Templates #202) advertises SEP-2640 support; disabled configuration leaves existing clients and tools unaffected.
  • Skills and general/UI resources coexist in one source; Skills reuses the provider for metadata, authorized reads and exact bytes without maintaining a second storage contract.
  • End-to-end integration test publishes a SKILL.md row plus multiple supplementary resources (including nested paths), discovers the skill, retrieves its entry, and reads each resource with exact bytes and correct MIME type.
  • Frontmatter metadata agrees with the source SKILL.md; manifests are complete and include correct SHA-256 digests and byte sizes. Test non-ASCII text, binary content, invalid YAML, invalid names/paths, duplicate rows, and missing SKILL.md.
  • Pagination, limits, direct URI access, and optional directory listing are tested according to the extension specification.
  • Publishing a revised skill through ClickHouse changes its metadata/content/digest without rebuilding or restarting the MCP server. Document behavior when the content changes between listing and read.
  • Verify credential/role/cluster isolation for skills/list, skills/get, and resources/read, including revoked access and mixed-tenant caches.
  • Validate stateless multi-replica operation with no local skill files or persistent MCP-side skill store.
  • Demonstrate consumption with a native Skills-capable MCP client (e.g. Claude or VS Code); test and document actual client compatibility, including ChatGPT when native support is available.
  • Document the source schema, configuration, SQL examples, versioning/publication pattern, client approval behavior, and security model.

Related Altinity MCP issues

These features together allow ClickHouse to define an application's operations, responses, events, and agent workflows while keeping Altinity MCP a thin, stateless connector.

References

The source contract and configuration above are a proposed implementation design. Live client interoperability and Go SDK integration still need to be verified.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions