Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion docs/AGENT_API.md
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ protectedResourceMetadataUrl, allowedOrigins, authenticate, limit })` returns
the same `{ handle(request) }` router interface. `mcpUrl` must exactly equal
`resource`. It uses the HTTP adapter's trusted authentication/admission ports,
URL/Host/Origin rules, protected-resource challenge, strict UTF-8 reader, and
response protections. Metadata is host-owned and is never served by this
response protections. OAuth metadata is host-owned and is never served by this
package. Configure the same resource on the dispatcher and both transports.

The adapter uses pinned MCP SDK `1.32.2` and Zod `4.6.7`. Each admitted POST
Expand All @@ -279,6 +279,18 @@ are advertised, using the five names above with useful strict input JSON
schemas. Client metadata and capability objects are bounded and validated
before reaching the SDK; they grant no server authority.

The unpublished `0.1.6` source candidate accepts opaque JSON extension fields
inside `params._meta` on initialize, ping, tools/list, tools/call, and the
initialized/cancelled notifications. If present, `progressToken` retains its
existing shape validation: a string of at most 128 characters or a safe integer,
without a registered-value allowlist. All extension values share the complete
request's byte, depth, node, array and object-key ceilings described below.
Other envelope fields and tool arguments remain closed. Metadata does not grant
identity, scopes, resource access, evidence, review or publication authority;
those facts still come from separately authenticated host context. The adapter
does not persist these extensions in KB records, include them in application
results, or use them to fetch URLs or construct application commands.

Responses use JSON rather than an SSE stream. Authenticated GET and DELETE
receive 405; an accepted initialized notification receives 202. The pinned
SDK negotiates the protocol version. Tool calls use the shared dispatcher;
Expand Down
17 changes: 17 additions & 0 deletions docs/RELEASING.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,23 @@ their own current-head gates; historical results do not validate changed
composition. Production hosts require verified trusted versions of both
components and their separately retained acceptance.

## Unpublished 0.1.6 candidate

All four source packages are synchronized at `0.1.6` for the MCP extension
metadata compatibility patch. The adapter accepts bounded opaque `params._meta`
values used by native clients. An optional `progressToken` must be a string of
at most 128 characters or a safe integer, without a registered-value allowlist.
Strict tool arguments, current authorization and existing complete-message
limits remain unchanged. It adds no tool, scope, durable record, credential or
migration. The generic SDK error-response mapping is unchanged.

The current qualified release remains `0.1.5`; this candidate needs its own
current-head gates, review, signed-tag preparation, trusted publication and
strict complete-set registry verification. Existing `0.1.5` receipts and
tarballs remain unchanged. Hosts and Support Desk consumers must deliberately
align their exact Knowledge Base graph before adoption; producer qualification
does not close native-client or real-host acceptance.

## Repository and development artifact gates

Use Node 22.6.0+ or 24 with `pnpm@10.34.5`. Published package engines remain
Expand Down
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,11 @@
"@cloudflare/workers-types": "5.20260730.1",
"@modelcontextprotocol/sdk": "1.32.2",
"@pegma/authorization-core": "0.4.0",
"@pegma/knowledge-base-application": "0.1.5",
"@pegma/knowledge-base-application": "0.1.6",
"@pegma/knowledge-base-application-previous": "npm:@pegma/knowledge-base-application@0.1.1",
"@pegma/knowledge-base-contracts": "0.1.5",
"@pegma/knowledge-base-core": "0.1.5",
"@pegma/knowledge-base-mcp": "0.1.5",
"@pegma/knowledge-base-contracts": "0.1.6",
"@pegma/knowledge-base-core": "0.1.6",
"@pegma/knowledge-base-mcp": "0.1.6",
"@pegma/spine": "0.1.2",
"@pegma/storage-azure-tables": "0.4.0",
"@pegma/storage-cloudflare-d1": "0.4.6",
Expand Down
6 changes: 3 additions & 3 deletions packages/application/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@pegma/knowledge-base-application",
"version": "0.1.5",
"version": "0.1.6",
"description": "Authorized knowledge authoring, evidence, review, and publication over Pegma storage.",
"license": "MIT",
"type": "module",
Expand Down Expand Up @@ -31,8 +31,8 @@
"dependencies": {
"@pegma/audit": "0.2.0",
"@pegma/authorization-core": "0.4.0",
"@pegma/knowledge-base-contracts": "0.1.5",
"@pegma/knowledge-base-core": "0.1.5",
"@pegma/knowledge-base-contracts": "0.1.6",
"@pegma/knowledge-base-core": "0.1.6",
"@pegma/spine": "0.1.2",
"@pegma/storage-core": "0.4.0"
},
Expand Down
2 changes: 1 addition & 1 deletion packages/contracts/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@pegma/knowledge-base-contracts",
"version": "0.1.5",
"version": "0.1.6",
"description": "Provider-neutral knowledge collections, revisions, validation, and approval contracts.",
"license": "MIT",
"type": "module",
Expand Down
4 changes: 2 additions & 2 deletions packages/core/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@pegma/knowledge-base-core",
"version": "0.1.5",
"version": "0.1.6",
"description": "Pure knowledge article, validation, and publication transitions.",
"license": "MIT",
"type": "module",
Expand Down Expand Up @@ -29,7 +29,7 @@
"directory": "packages/core"
},
"dependencies": {
"@pegma/knowledge-base-contracts": "0.1.5"
"@pegma/knowledge-base-contracts": "0.1.6"
},
"scripts": {
"build": "tsc -p tsconfig.json",
Expand Down
10 changes: 10 additions & 0 deletions packages/mcp/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,16 @@ client acceptance remain separate. These source README corrections apply to a
future release. Published `0.1.5` tarballs, including their bundled README bytes,
remain unchanged.

The synchronized `0.1.6` source candidate is unpublished. It accepts bounded
opaque MCP `params._meta` extensions, including native-client correlation and
standard trace fields, while retaining the existing `progressToken` shape
validation: a string of at most 128 characters or a safe integer. Metadata
does not establish identity, permissions or evidence and is not stored or
returned as an application result. Complete-message byte, depth, node and key
ceilings, strict tool arguments and fresh host authentication remain unchanged.
The official-SDK regression and packed protocol proof exercise fictional
extension values; actual requested-client and host acceptance remain separate.

The contracts, core, and application packages remain independent of MCP, HTTP,
provider SDKs, and login flows. Hosts choose this adapter when exposing agent
access. The adapter pins `@modelcontextprotocol/sdk` at `1.32.2` and `zod` at
Expand Down
8 changes: 4 additions & 4 deletions packages/mcp/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@pegma/knowledge-base-mcp",
"version": "0.1.5",
"version": "0.1.6",
"description": "Optional MCP transport for authorized Pegma knowledge authoring and validation.",
"license": "MIT",
"type": "module",
Expand Down Expand Up @@ -32,9 +32,9 @@
"@cfworker/json-schema": "4.1.6",
"@modelcontextprotocol/sdk": "1.32.2",
"@pegma/authorization-core": "0.4.0",
"@pegma/knowledge-base-application": "0.1.5",
"@pegma/knowledge-base-contracts": "0.1.5",
"@pegma/knowledge-base-core": "0.1.5",
"@pegma/knowledge-base-application": "0.1.6",
"@pegma/knowledge-base-contracts": "0.1.6",
"@pegma/knowledge-base-core": "0.1.6",
"zod": "4.6.7"
},
"scripts": {
Expand Down
8 changes: 6 additions & 2 deletions packages/mcp/src/mcp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,11 @@ const requestId = z.union([
z.number().int().min(Number.MIN_SAFE_INTEGER).max(Number.MAX_SAFE_INTEGER),
]);
const empty = z.object({}).strict();
const metadata = z.object({ progressToken: requestId.optional() }).strict();
// MCP reserves _meta for opaque client extensions, not authority. The complete
// message already passed the shared JSON byte/depth/node/key ceilings.
const metadata = z
.object({ progressToken: requestId.optional() })
.catchall(z.unknown());
const basicParams = z.object({ _meta: metadata.optional() }).strict();
Comment thread
FlyOverCoderKY marked this conversation as resolved.
Resolved
const featureMap = z.record(
z.string().max(128),
Expand Down Expand Up @@ -349,7 +353,7 @@ export function createKnowledgeAgentMcp(
maxRequestBodySize: dispatcher.limits.maxRequestBytes,
});
const server = new Server(
{ name: "@pegma/knowledge-base-mcp", version: "0.1.5" },
{ name: "@pegma/knowledge-base-mcp", version: "0.1.6" },
{
capabilities: { tools: {} },
// Workers prohibit the runtime code generation used by SDK-default AJV.
Expand Down
20 changes: 10 additions & 10 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 18 additions & 1 deletion scripts/agent-protocol-fixture.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -834,7 +834,22 @@ async function httpCall(host, token, operation, input) {

async function mcpCall(client, operation, input) {
const result = await client.callTool(
{ name: knowledgeAgentToolNames[operation], arguments: input },
{
name: knowledgeAgentToolNames[operation],
arguments: input,
// Ordinary opaque metadata, supplied by the official SDK client. These
// fictional correlation values confer no identity, scopes or authority.
_meta: {
callId: "fictional-packed-call",
threadId: "fictional-packed-thread",
sessionId: "fictional-packed-session",
itemId: "fictional-packed-item",
windowId: "fictional-packed-window",
traceparent: "00-11111111111111111111111111111111-2222222222222222-01",
tracestate: "fictional=packed",
"com.example/extension": { values: [null, false, 7] },
},
},
undefined,
{ timeout: 5_000 },
);
Expand Down Expand Up @@ -1199,6 +1214,7 @@ async function runProof() {
liveHostsProven: false,
targetClientAppsProven: 0,
sdkDiscovery: true,
opaqueRequestMetadata: true,
s256Pkce: true,
browserSession: true,
csrfAndOrigin: true,
Expand Down Expand Up @@ -1458,6 +1474,7 @@ async function runReportProof() {
tools: tools.tools.length,
scopes: host.configuration.scopes.length,
reportQueued: true,
opaqueRequestMetadata: true,
bodyFreePolling: true,
humanConfirmed: true,
originalReceiptCommitted: true,
Expand Down
Loading
Loading