lib.contracts-runtime-server-mcp
MCP server runtime adapters for ContractSpec contracts
@lssm-tech/lib.contracts-runtime-server-mcpbun add @lssm-tech/lib.contracts-runtime-server-mcpManifest declarations describe the current workspace; they do not verify registry publication or runtime execution.
Package guide
MCP server runtime adapters for ContractSpec contracts.
What It Provides
- Layer: lib.
- Consumers: bundles, CLI.
src/mcp/contains MCP handlers, tools, prompts, and resources.- Related ContractSpec packages include
@lssm-tech/lib.contracts-spec,@lssm-tech/lib.logger,@lssm-tech/tool.bun,@lssm-tech/tool.typescript. src/mcp/contains MCP handlers, tools, prompts, and resources.
Installation
npm install @lssm-tech/lib.contracts-runtime-server-mcp
or
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.tsis the root public barrel and package entrypoint.src/mcp/contains MCP handlers, tools, prompts, and resources.src/provider-mcp.tsis 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/createMcpServerresolves through./src/mcp/createMcpServer.ts. - Export
./mcp/mcpTypesresolves through./src/mcp/mcpTypes.ts. - Export
./mcp/registerPresentationsresolves through./src/mcp/registerPresentations.ts. - Export
./mcp/registerPromptsresolves through./src/mcp/registerPrompts.ts. - Export
./mcp/registerResourcesresolves through./src/mcp/registerResources.ts. - Export
./mcp/registerToolsresolves through./src/mcp/registerTools.ts. - Export
./provider-mcpresolves through./src/provider-mcp.ts. - Deprecated: export
./marketing(with./marketing/marketing-agent-config,./marketing/marketing-mcp,./marketing/marketing-registryand 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-specfacade. 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 devbun run build— contractspec-bun-build buildbun run lint— bun run lint:fixbun run lint:check— biome check .bun run lint:fix— biome check --write --unsafe --only=nursery/useSortedClasses . && biome check --write .bun run typecheck— tsgo --noEmitbun run publish:pkg— bun publish --tolerate-republish --ignore-scripts --verbosebun run publish:pkg:canary— bun publish:pkg --tag canarybun run clean— rm -rf distbun run build:bundle— contractspec-bun-build transpilebun run build:types— contractspec-bun-build typesbun 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.
Relationships
Arrows point from a package to its direct dependency. Counts are derived from captured workspace manifests.
7 declarations
@lssm-tech/lib.contracts-runtime-coreworkspace:^
Read the package manual ↗@lssm-tech/lib.contracts-specworkspace:^
Read the package manual ↗@lssm-tech/lib.contracts-spec-coreworkspace:^
Read the package manual ↗@lssm-tech/lib.loggerworkspace:^
Read the package manual ↗@lssm-tech/lib.utils-typescriptworkspace:^
Read the package manual ↗@modelcontextprotocol/sdkcatalog:ai
Declared capabilities
MCP server runtime adapters for ContractSpec contracts
Scripts
testbun testpublish:pkgbun publish --tolerate-republish --ignore-scripts --verbosepublish:pkg:canarybun publish:pkg --tag canarycleanrm -rf distlintbun run lint:fixlint:fixnode ../../../../scripts/biome.cjs check --write --unsafe --only=nursery/useSortedClasses . && node ../../../../scripts/biome.cjs check --write .lint:checknode ../../../../scripts/biome.cjs check .buildcontractspec-bun-build buildbuild:bundlecontractspec-bun-build transpilebuild:typescontractspec-bun-build typesprebuildcontractspec-bun-build prebuildtypechecktsgo --noEmitdevcontractspec-bun-build dev