Source snapshot bcc79fcc · Declared package version 5.0.4. This page combines the checked-in package guide and manifest; commands and runtime behavior were not executed in this review.
bun add @lssm-tech/lib.contracts-runtime-server-mcp
Usage
Import the root entrypoint from @lssm-tech/lib.contracts-runtime-server-mcp, or choose a documented subpath when you only need one part of the package surface.
Scoped approvals
McpCtxFactories.toolApprovalReceipt adapts client-held approval evidence into the common handler context without adding it to tool input. MCP metadata describes declared effects and whether approval is required, while the shared operation registry remains the authoritative pre-handler enforcement boundary.
Query envelope params
Tool arguments stay the operation input. A client sends the other
QueryEnvelope params (search, filters, sort, pagination, cache, tags, consistency, economic evidence refs) as an object under the tools/call request
_meta key contractspec/queryEnvelope (MCP_QUERY_ENVELOPE_META_KEY from
./mcp/registerTools; the prefix follows the MCP _meta naming rules).
registerMcpTools rebuilds the full envelope into HandlerCtx.queryEnvelope
on a per-call copy of the toolCtx() context; calls without it get the operation and input only. A tool without an input schema gets {} as input and an envelope without input: the SDK request extra (auth info, headers, session) never becomes input. Malformed params return the same BAD_REQUEST
problem as REST, after the auth gate and before the handler.
Architecture
src/index.ts is the root public barrel and package entrypoint.
src/mcp/ contains MCP handlers, tools, prompts, and resources.
src/provider-mcp.ts is part of the package's public or composition surface.
Presentation resources are projected to Markdown in the MCP adapter, so consumers do not install the presentation runtime or its UI-oriented dependency tree.
Public Entry Points
Export . resolves through ./src/index.ts.
Export ./mcp/createMcpServer resolves through ./src/mcp/createMcpServer.ts.
Export ./mcp/mcpTypes resolves through ./src/mcp/mcpTypes.ts.
Export ./mcp/registerPresentations resolves through ./src/mcp/registerPresentations.ts.
Export ./mcp/registerPrompts resolves through ./src/mcp/registerPrompts.ts.
Export ./mcp/registerResources resolves through ./src/mcp/registerResources.ts.
Export ./mcp/registerTools resolves through ./src/mcp/registerTools.ts.
Export ./provider-mcp resolves through ./src/provider-mcp.ts.
Deprecated: export ./marketing (with ./marketing/marketing-agent-config, ./marketing/marketing-mcp, ./marketing/marketing-registry and the root re-export of the same symbols) resolves through ./src/marketing/index.ts, a frozen copy of the public marketing site MCP surface. Its owner is @lssm-tech/bundle.marketing-operations/site-mcp, which has the same exports (./site-mcp, ./site-mcp/marketing-agent-config, ./site-mcp/marketing-mcp, ./site-mcp/marketing-registry). It cannot forward there, because a platform package may not depend on a bundle, and its registry reaches the Growth operations only through the @lssm-tech/lib.contracts-spec facade. The copy, the four subpaths, the root re-export and the facade dependency are removed at the next major of this package.
Local Commands
bun run dev — contractspec-bun-build dev
bun run build — contractspec-bun-build build
bun run lint — bun run lint:fix
bun run lint:check — biome check .
bun run lint:fix — biome check --write --unsafe --only=nursery/useSortedClasses . && biome check --write .
bun run typecheck — tsgo --noEmit
bun run publish:pkg — bun publish --tolerate-republish --ignore-scripts --verbose
bun run publish:pkg:canary — bun publish:pkg --tag canary
bun run clean — rm -rf dist
bun run build:bundle — contractspec-bun-build transpile
bun run build:types — contractspec-bun-build types
bun run prebuild — contractspec-bun-build prebuild
Recent Updates
Replace eslint+prettier by biomejs to optimize speed.
Add changesets and apply pending fixes.
Notes
MCP protocol compliance is critical; transport layer must stay spec-compliant.
Do not introduce runtime-specific (Node/browser) dependencies in the transport layer.
Declared capabilities.
Lib Contracts Runtime Server Mcp
MCP server runtime adapters for ContractSpec contracts
Use it to
Adopt mcp server runtime adapters for contractspec contracts
Requires
TypeScript
Choose another boundary when
The @lssm-tech/lib.contracts-runtime-server-mcp package constraints do not match the target runtime or platform.
These are package-manifest entry points. Named symbols listed above come from the capability catalogue; this is not an exhaustive TypeScript symbol reference.