@cyanheads/libofcongress-mcp-server 0.2.2 → 0.2.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CLAUDE.md +2 -2
- package/Dockerfile +10 -9
- package/README.md +7 -1
- package/dist/config/server-config.js +1 -1
- package/dist/libofcongress-mcp-server.mcpb +0 -0
- package/package.json +25 -26
- package/server.json +5 -5
- package/AGENTS.md +0 -388
- package/changelog/0.1.x/0.1.0.md +0 -22
- package/changelog/0.1.x/0.1.1.md +0 -29
- package/changelog/0.2.x/0.2.0.md +0 -13
- package/changelog/0.2.x/0.2.1.md +0 -14
- package/changelog/0.2.x/0.2.2.md +0 -26
- package/changelog/template.md +0 -119
package/CLAUDE.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# Developer Protocol
|
|
2
2
|
|
|
3
3
|
**Server:** libofcongress-mcp-server
|
|
4
|
-
**Version:** 0.2.
|
|
4
|
+
**Version:** 0.2.4
|
|
5
5
|
**Framework:** [@cyanheads/mcp-ts-core](https://www.npmjs.com/package/@cyanheads/mcp-ts-core) `^0.9.9`
|
|
6
6
|
**Engines:** Bun ≥1.3.0, Node ≥24.0.0
|
|
7
7
|
**MCP SDK:** `@modelcontextprotocol/sdk` ^1.29.0
|
|
@@ -113,7 +113,7 @@ import { z } from '@cyanheads/mcp-ts-core';
|
|
|
113
113
|
import { parseEnvConfig } from '@cyanheads/mcp-ts-core/config';
|
|
114
114
|
|
|
115
115
|
const ServerConfigSchema = z.object({
|
|
116
|
-
userAgent: z.string().default('libofcongress-mcp-server/0.2.
|
|
116
|
+
userAgent: z.string().default('libofcongress-mcp-server/0.2.4').describe('User-Agent header for LOC API requests.'),
|
|
117
117
|
requestDelayMs: z.coerce.number().default(3100).describe('Delay in ms between LOC API requests.'),
|
|
118
118
|
});
|
|
119
119
|
|
package/Dockerfile
CHANGED
|
@@ -1,24 +1,24 @@
|
|
|
1
1
|
# ==============================================================================
|
|
2
2
|
# Build Stage
|
|
3
3
|
#
|
|
4
|
-
#
|
|
5
|
-
#
|
|
4
|
+
# This stage installs all dependencies (including dev), builds the TypeScript
|
|
5
|
+
# source code into JavaScript, and prepares the production assets.
|
|
6
6
|
# ==============================================================================
|
|
7
|
-
FROM
|
|
7
|
+
FROM oven/bun:1.3 AS build
|
|
8
8
|
|
|
9
9
|
WORKDIR /usr/src/app
|
|
10
10
|
|
|
11
|
-
# Copy dependency manifests
|
|
11
|
+
# Copy dependency manifests for optimized layer caching
|
|
12
12
|
COPY package.json bun.lock ./
|
|
13
13
|
|
|
14
|
-
# Install all dependencies
|
|
15
|
-
RUN
|
|
14
|
+
# Install all dependencies (including dev dependencies for building)
|
|
15
|
+
RUN bun install --frozen-lockfile
|
|
16
16
|
|
|
17
17
|
# Copy the rest of the source code
|
|
18
18
|
COPY . .
|
|
19
19
|
|
|
20
20
|
# Build the application
|
|
21
|
-
RUN
|
|
21
|
+
RUN bun run build
|
|
22
22
|
|
|
23
23
|
|
|
24
24
|
# ==============================================================================
|
|
@@ -34,9 +34,10 @@ WORKDIR /usr/src/app
|
|
|
34
34
|
ENV NODE_ENV=production
|
|
35
35
|
|
|
36
36
|
# OCI image metadata (https://github.com/opencontainers/image-spec/blob/main/annotations.md)
|
|
37
|
-
LABEL org.opencontainers.image.title="libofcongress-mcp-server"
|
|
38
|
-
LABEL org.opencontainers.image.description=""
|
|
37
|
+
LABEL org.opencontainers.image.title="@cyanheads/libofcongress-mcp-server"
|
|
38
|
+
LABEL org.opencontainers.image.description="Search LOC digital collections, browse Chronicling America newspapers with full OCR text, and look up LC Subject Headings via MCP."
|
|
39
39
|
LABEL org.opencontainers.image.licenses="Apache-2.0"
|
|
40
|
+
LABEL org.opencontainers.image.source="https://github.com/cyanheads/libofcongress-mcp-server"
|
|
40
41
|
|
|
41
42
|
# Copy dependency manifests
|
|
42
43
|
COPY package.json bun.lock ./
|
package/README.md
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
|
|
8
8
|
<div align="center">
|
|
9
9
|
|
|
10
|
-
[](./CHANGELOG.md) [](./LICENSE) [](https://github.com/users/cyanheads/packages/container/package/libofcongress-mcp-server) [](https://modelcontextprotocol.io/) [](https://www.npmjs.com/package/@cyanheads/libofcongress-mcp-server) [](https://www.typescriptlang.org/) [](https://bun.sh/)
|
|
11
11
|
|
|
12
12
|
</div>
|
|
13
13
|
|
|
@@ -19,6 +19,12 @@
|
|
|
19
19
|
|
|
20
20
|
</div>
|
|
21
21
|
|
|
22
|
+
<div align="center">
|
|
23
|
+
|
|
24
|
+
**Public Hosted Server:** [https://libofcongress.caseyjhand.com/mcp](https://libofcongress.caseyjhand.com/mcp)
|
|
25
|
+
|
|
26
|
+
</div>
|
|
27
|
+
|
|
22
28
|
---
|
|
23
29
|
|
|
24
30
|
## Tools
|
|
@@ -7,7 +7,7 @@ import { parseEnvConfig } from '@cyanheads/mcp-ts-core/config';
|
|
|
7
7
|
const ServerConfigSchema = z.object({
|
|
8
8
|
userAgent: z
|
|
9
9
|
.string()
|
|
10
|
-
.default('libofcongress-mcp-server/0.2.
|
|
10
|
+
.default('libofcongress-mcp-server/0.2.3')
|
|
11
11
|
.describe('User-Agent header sent with LOC API requests. LOC recommends a descriptive value for polite access.'),
|
|
12
12
|
requestDelayMs: z.coerce
|
|
13
13
|
.number()
|
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cyanheads/libofcongress-mcp-server",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.4",
|
|
4
4
|
"mcpName": "io.github.cyanheads/libofcongress-mcp-server",
|
|
5
5
|
"description": "Search LOC digital collections, browse Chronicling America newspapers with full OCR text, and look up LC Subject Headings via MCP. STDIO or Streamable HTTP.",
|
|
6
6
|
"type": "module",
|
|
@@ -9,35 +9,25 @@
|
|
|
9
9
|
"bin": {
|
|
10
10
|
"libofcongress-mcp-server": "dist/index.js"
|
|
11
11
|
},
|
|
12
|
-
"files": [
|
|
13
|
-
"changelog/",
|
|
14
|
-
"dist/",
|
|
15
|
-
"README.md",
|
|
16
|
-
"LICENSE",
|
|
17
|
-
"CLAUDE.md",
|
|
18
|
-
"AGENTS.md",
|
|
19
|
-
"Dockerfile",
|
|
20
|
-
"server.json"
|
|
21
|
-
],
|
|
12
|
+
"files": ["dist/", "README.md", "LICENSE", "CLAUDE.md", "Dockerfile", "server.json"],
|
|
22
13
|
"scripts": {
|
|
23
|
-
"build": "
|
|
24
|
-
"rebuild": "
|
|
25
|
-
"clean": "
|
|
26
|
-
"devcheck": "
|
|
14
|
+
"build": "bun run scripts/build.ts",
|
|
15
|
+
"rebuild": "bun run scripts/clean.ts && bun run build",
|
|
16
|
+
"clean": "bun run scripts/clean.ts",
|
|
17
|
+
"devcheck": "bun run scripts/devcheck.ts",
|
|
27
18
|
"audit:refresh": "rm -f bun.lock && bun install && bun audit",
|
|
28
|
-
"tree": "
|
|
29
|
-
"list-skills": "
|
|
19
|
+
"tree": "bun run scripts/tree.ts",
|
|
20
|
+
"list-skills": "bun run scripts/list-skills.ts",
|
|
30
21
|
"format": "biome check --write --unsafe .",
|
|
31
|
-
"lint:mcp": "
|
|
32
|
-
"lint:packaging": "
|
|
22
|
+
"lint:mcp": "bun run scripts/lint-mcp.ts",
|
|
23
|
+
"lint:packaging": "bun run scripts/lint-packaging.ts",
|
|
33
24
|
"publish-mcp": "mcp-publisher login github -token \"$(security find-generic-password -a \"$USER\" -s mcp-publisher-github-pat -w)\" && mcp-publisher publish",
|
|
34
25
|
"bundle": "bun run build && npx -y @anthropic-ai/mcpb pack . dist/libofcongress-mcp-server.mcpb",
|
|
35
|
-
"changelog:build": "
|
|
36
|
-
"changelog:check": "
|
|
37
|
-
"test": "vitest run",
|
|
38
|
-
"start": "
|
|
39
|
-
"start:
|
|
40
|
-
"start:http": "MCP_TRANSPORT_TYPE=http node dist/index.js"
|
|
26
|
+
"changelog:build": "bun run scripts/build-changelog.ts",
|
|
27
|
+
"changelog:check": "bun run scripts/build-changelog.ts --check",
|
|
28
|
+
"test": "bunx vitest run",
|
|
29
|
+
"start:stdio": "MCP_TRANSPORT_TYPE=stdio bun ./dist/index.js",
|
|
30
|
+
"start:http": "MCP_TRANSPORT_TYPE=http bun ./dist/index.js"
|
|
41
31
|
},
|
|
42
32
|
"keywords": [
|
|
43
33
|
"mcp",
|
|
@@ -65,6 +55,16 @@
|
|
|
65
55
|
"type": "git",
|
|
66
56
|
"url": "git+https://github.com/cyanheads/libofcongress-mcp-server.git"
|
|
67
57
|
},
|
|
58
|
+
"funding": [
|
|
59
|
+
{
|
|
60
|
+
"type": "github",
|
|
61
|
+
"url": "https://github.com/sponsors/cyanheads"
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
"type": "buy_me_a_coffee",
|
|
65
|
+
"url": "https://www.buymeacoffee.com/cyanheads"
|
|
66
|
+
}
|
|
67
|
+
],
|
|
68
68
|
"license": "Apache-2.0",
|
|
69
69
|
"packageManager": "bun@1.3.11",
|
|
70
70
|
"engines": {
|
|
@@ -85,7 +85,6 @@
|
|
|
85
85
|
"depcheck": "^1.4.7",
|
|
86
86
|
"ignore": "^7.0.5",
|
|
87
87
|
"tsc-alias": "^1.8.16",
|
|
88
|
-
"tsx": "^4.19.0",
|
|
89
88
|
"typescript": "^5.9.3",
|
|
90
89
|
"vitest": "^4.1.0"
|
|
91
90
|
}
|
package/server.json
CHANGED
|
@@ -6,14 +6,14 @@
|
|
|
6
6
|
"url": "https://github.com/cyanheads/libofcongress-mcp-server",
|
|
7
7
|
"source": "github"
|
|
8
8
|
},
|
|
9
|
-
"version": "0.2.
|
|
9
|
+
"version": "0.2.4",
|
|
10
10
|
"packages": [
|
|
11
11
|
{
|
|
12
12
|
"registryType": "npm",
|
|
13
13
|
"registryBaseUrl": "https://registry.npmjs.org",
|
|
14
14
|
"identifier": "@cyanheads/libofcongress-mcp-server",
|
|
15
15
|
"runtimeHint": "bun",
|
|
16
|
-
"version": "0.2.
|
|
16
|
+
"version": "0.2.4",
|
|
17
17
|
"packageArguments": [
|
|
18
18
|
{
|
|
19
19
|
"type": "positional",
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
"description": "User-Agent header sent with LOC API requests. LOC recommends a descriptive value for polite access.",
|
|
31
31
|
"format": "string",
|
|
32
32
|
"isRequired": false,
|
|
33
|
-
"default": "libofcongress-mcp-server/0.2.
|
|
33
|
+
"default": "libofcongress-mcp-server/0.2.4"
|
|
34
34
|
},
|
|
35
35
|
{
|
|
36
36
|
"name": "LOC_REQUEST_DELAY_MS",
|
|
@@ -56,7 +56,7 @@
|
|
|
56
56
|
"registryBaseUrl": "https://registry.npmjs.org",
|
|
57
57
|
"identifier": "@cyanheads/libofcongress-mcp-server",
|
|
58
58
|
"runtimeHint": "bun",
|
|
59
|
-
"version": "0.2.
|
|
59
|
+
"version": "0.2.4",
|
|
60
60
|
"packageArguments": [
|
|
61
61
|
{
|
|
62
62
|
"type": "positional",
|
|
@@ -73,7 +73,7 @@
|
|
|
73
73
|
"description": "User-Agent header sent with LOC API requests. LOC recommends a descriptive value for polite access.",
|
|
74
74
|
"format": "string",
|
|
75
75
|
"isRequired": false,
|
|
76
|
-
"default": "libofcongress-mcp-server/0.2.
|
|
76
|
+
"default": "libofcongress-mcp-server/0.2.4"
|
|
77
77
|
},
|
|
78
78
|
{
|
|
79
79
|
"name": "LOC_REQUEST_DELAY_MS",
|
package/AGENTS.md
DELETED
|
@@ -1,388 +0,0 @@
|
|
|
1
|
-
# Developer Protocol
|
|
2
|
-
|
|
3
|
-
**Server:** libofcongress-mcp-server
|
|
4
|
-
**Version:** 0.2.2
|
|
5
|
-
**Framework:** [@cyanheads/mcp-ts-core](https://www.npmjs.com/package/@cyanheads/mcp-ts-core) `^0.9.9`
|
|
6
|
-
**Engines:** Bun ≥1.3.0, Node ≥24.0.0
|
|
7
|
-
**MCP SDK:** `@modelcontextprotocol/sdk` ^1.29.0
|
|
8
|
-
**Zod:** ^4.4.3
|
|
9
|
-
|
|
10
|
-
> **Read the framework docs first:** `node_modules/@cyanheads/mcp-ts-core/CLAUDE.md` contains the full API reference — builders, Context, error codes, exports, patterns. This file covers server-specific conventions only.
|
|
11
|
-
|
|
12
|
-
---
|
|
13
|
-
|
|
14
|
-
## What's Next?
|
|
15
|
-
|
|
16
|
-
When the user asks what's next or needs direction, suggest options based on the current project state. Common next steps:
|
|
17
|
-
|
|
18
|
-
1. **Re-run the `setup` skill** — ensures CLAUDE.md, skills, structure, and metadata are populated and up to date with the current codebase
|
|
19
|
-
2. **Run the `design-mcp-server` skill** — if the tool/resource surface hasn't been mapped yet, work through domain design
|
|
20
|
-
3. **Add tools/resources/prompts** — scaffold new definitions using the `add-tool`, `add-app-tool`, `add-resource`, `add-prompt` skills
|
|
21
|
-
4. **Add services** — scaffold domain service integrations using the `add-service` skill
|
|
22
|
-
5. **Add tests** — scaffold tests for existing definitions using the `add-test` skill
|
|
23
|
-
6. **Field-test definitions** — exercise tools/resources/prompts with real inputs using the `field-test` skill, get a report of issues and pain points
|
|
24
|
-
7. **Run `devcheck`** — lint, format, typecheck, and security audit
|
|
25
|
-
8. **Run the `security-pass` skill** — audit handlers for MCP-specific security gaps: output injection, scope blast radius, input sinks, tenant isolation
|
|
26
|
-
9. **Run the `polish-docs-meta` skill** — finalize README, CHANGELOG, metadata, and agent protocol for shipping
|
|
27
|
-
10. **Run the `maintenance` skill** — investigate changelogs, adopt upstream changes, and sync skills after `bun update --latest`
|
|
28
|
-
|
|
29
|
-
Tailor suggestions to what's actually missing or stale — don't recite the full list every time.
|
|
30
|
-
|
|
31
|
-
---
|
|
32
|
-
|
|
33
|
-
## Core Rules
|
|
34
|
-
|
|
35
|
-
- **Logic throws, framework catches.** Tool/resource handlers are pure — throw on failure, no `try/catch`. Plain `Error` is fine; the framework catches, classifies, and formats. Use error factories (`notFound()`, `validationError()`, etc.) when the error code matters.
|
|
36
|
-
- **Use `ctx.log`** for request-scoped logging. No `console` calls.
|
|
37
|
-
- **Use `ctx.state`** for tenant-scoped storage. Never access persistence directly.
|
|
38
|
-
- **Check `ctx.elicit` / `ctx.sample`** for presence before calling.
|
|
39
|
-
- **Secrets in env vars only** — never hardcoded.
|
|
40
|
-
- **Close the loop on issues.** When implementing work tracked by a GitHub issue, comment on the issue with what landed before moving on. The comment is for future readers — state the concrete changes, not the conversation that produced them.
|
|
41
|
-
|
|
42
|
-
---
|
|
43
|
-
|
|
44
|
-
## Patterns
|
|
45
|
-
|
|
46
|
-
### Tool
|
|
47
|
-
|
|
48
|
-
```ts
|
|
49
|
-
import { tool, z } from '@cyanheads/mcp-ts-core';
|
|
50
|
-
import { JsonRpcErrorCode } from '@cyanheads/mcp-ts-core/errors';
|
|
51
|
-
import { getLocApiService } from '@/services/loc-api/loc-api-service.js';
|
|
52
|
-
|
|
53
|
-
export const locSearch = tool('libofcongress_search', {
|
|
54
|
-
description: 'Search the Library of Congress digital collections by keyword with format, date range, subject heading, and geographic location filters.',
|
|
55
|
-
annotations: { readOnlyHint: true, openWorldHint: true },
|
|
56
|
-
input: z.object({
|
|
57
|
-
query: z.string().min(1).describe('Full-text search across metadata and available descriptive text.'),
|
|
58
|
-
format: z.enum(['photo', 'map', 'newspaper', 'manuscript', 'audio', 'film', 'book', 'notated-music']).optional().describe('Material type filter.'),
|
|
59
|
-
limit: z.number().int().min(1).max(100).default(25).describe('Results per page. Default 25, max 100.'),
|
|
60
|
-
page: z.number().int().min(1).default(1).describe('1-indexed page number.'),
|
|
61
|
-
}),
|
|
62
|
-
output: z.object({
|
|
63
|
-
items: z.array(z.object({
|
|
64
|
-
id: z.string().describe('LOC item ID — pass to libofcongress_get_item for full metadata.'),
|
|
65
|
-
title: z.string().describe('Item title.'),
|
|
66
|
-
url: z.string().describe('LOC item URL.'),
|
|
67
|
-
})).describe('Item summaries matching the search query and filters.'),
|
|
68
|
-
total: z.number().describe('Total number of matching items across all pages.'),
|
|
69
|
-
has_next: z.boolean().describe('True when more pages are available after this one.'),
|
|
70
|
-
}),
|
|
71
|
-
errors: [
|
|
72
|
-
{ reason: 'empty_results', code: JsonRpcErrorCode.NotFound,
|
|
73
|
-
when: 'No items matched the query and filters.',
|
|
74
|
-
recovery: 'Broaden the query, widen the date range, or use libofcongress_search_subjects to find the correct subject heading spelling.' },
|
|
75
|
-
],
|
|
76
|
-
async handler(input, ctx) {
|
|
77
|
-
ctx.log.info('libofcongress_search', { query: input.query, page: input.page });
|
|
78
|
-
const svc = getLocApiService();
|
|
79
|
-
const result = await svc.search({ query: input.query, limit: input.limit, page: input.page }, ctx);
|
|
80
|
-
return { items: result.items, total: result.pagination.total, has_next: result.pagination.hasNext };
|
|
81
|
-
},
|
|
82
|
-
format: (result) => [{
|
|
83
|
-
type: 'text',
|
|
84
|
-
text: result.items.map(i => `**${i.title}** (${i.id})\n${i.url}`).join('\n\n'),
|
|
85
|
-
}],
|
|
86
|
-
});
|
|
87
|
-
```
|
|
88
|
-
|
|
89
|
-
### Resource
|
|
90
|
-
|
|
91
|
-
```ts
|
|
92
|
-
import { resource, z } from '@cyanheads/mcp-ts-core';
|
|
93
|
-
import { getLocApiService } from '@/services/loc-api/loc-api-service.js';
|
|
94
|
-
|
|
95
|
-
export const locItemResource = resource('libofcongress://item/{item_id}', {
|
|
96
|
-
name: 'loc-item',
|
|
97
|
-
description: 'LOC digital item metadata by ID. Stable URI for injecting item context into agent conversations.',
|
|
98
|
-
mimeType: 'application/json',
|
|
99
|
-
params: z.object({ item_id: z.string().describe('LOC item ID (e.g., "loc.pnp.ppmsc.02404").') }),
|
|
100
|
-
handler(params, ctx) {
|
|
101
|
-
ctx.log.debug('libofcongress://item resource', { item_id: params.item_id });
|
|
102
|
-
const svc = getLocApiService();
|
|
103
|
-
return svc.getItem(params.item_id, ctx);
|
|
104
|
-
},
|
|
105
|
-
});
|
|
106
|
-
```
|
|
107
|
-
|
|
108
|
-
### Server config
|
|
109
|
-
|
|
110
|
-
```ts
|
|
111
|
-
// src/config/server-config.ts
|
|
112
|
-
import { z } from '@cyanheads/mcp-ts-core';
|
|
113
|
-
import { parseEnvConfig } from '@cyanheads/mcp-ts-core/config';
|
|
114
|
-
|
|
115
|
-
const ServerConfigSchema = z.object({
|
|
116
|
-
userAgent: z.string().default('libofcongress-mcp-server/0.2.2').describe('User-Agent header for LOC API requests.'),
|
|
117
|
-
requestDelayMs: z.coerce.number().default(3100).describe('Delay in ms between LOC API requests.'),
|
|
118
|
-
});
|
|
119
|
-
|
|
120
|
-
let _config: z.infer<typeof ServerConfigSchema> | undefined;
|
|
121
|
-
export function getServerConfig() {
|
|
122
|
-
_config ??= parseEnvConfig(ServerConfigSchema, {
|
|
123
|
-
userAgent: 'LOC_USER_AGENT',
|
|
124
|
-
requestDelayMs: 'LOC_REQUEST_DELAY_MS',
|
|
125
|
-
});
|
|
126
|
-
return _config;
|
|
127
|
-
}
|
|
128
|
-
```
|
|
129
|
-
|
|
130
|
-
`parseEnvConfig` maps Zod schema paths → env var names so errors name the variable (`LOC_USER_AGENT`) not the path (`userAgent`). Throws `ConfigurationError`, which the framework prints as a clean startup banner.
|
|
131
|
-
|
|
132
|
-
---
|
|
133
|
-
|
|
134
|
-
## Context
|
|
135
|
-
|
|
136
|
-
Handlers receive a unified `ctx` object. Key properties:
|
|
137
|
-
|
|
138
|
-
| Property | Description |
|
|
139
|
-
|:---------|:------------|
|
|
140
|
-
| `ctx.log` | Request-scoped logger — `.debug()`, `.info()`, `.notice()`, `.warning()`, `.error()`. Auto-correlates requestId, traceId, tenantId. |
|
|
141
|
-
| `ctx.state` | Tenant-scoped KV — `.get(key)`, `.set(key, value, { ttl? })`, `.delete(key)`, `.list(prefix, { cursor, limit })`. Accepts any serializable value. |
|
|
142
|
-
| `ctx.elicit` | Ask user for structured input. **Check for presence first:** `if (ctx.elicit) { ... }` |
|
|
143
|
-
| `ctx.sample` | Request LLM completion from the client. **Check for presence first:** `if (ctx.sample) { ... }` |
|
|
144
|
-
| `ctx.signal` | `AbortSignal` for cancellation. |
|
|
145
|
-
| `ctx.progress` | Task progress (present when `task: true`) — `.setTotal(n)`, `.increment()`, `.update(message)`. |
|
|
146
|
-
| `ctx.requestId` | Unique request ID. |
|
|
147
|
-
| `ctx.tenantId` | Tenant ID from JWT or `'default'` for stdio. |
|
|
148
|
-
|
|
149
|
-
---
|
|
150
|
-
|
|
151
|
-
## Errors
|
|
152
|
-
|
|
153
|
-
Handlers throw — the framework catches, classifies, and formats.
|
|
154
|
-
|
|
155
|
-
**Recommended: typed error contract.** Declare `errors: [{ reason, code, when, recovery, retryable? }]` on `tool()` / `resource()` to receive `ctx.fail(reason, …)` typed against the reason union. TypeScript catches typos at compile time, `data.reason` is auto-populated for observability, linter enforces conformance against the handler body. `recovery` is required descriptive metadata for the agent's next move (≥ 5 words, lint-validated); for the wire `data.recovery.hint` (mirrored into `content[]` text), pass explicitly at the throw site when dynamic context matters: `ctx.fail('reason', msg, { recovery: { hint: '...' } })`. Baseline codes (`InternalError`, `ServiceUnavailable`, `Timeout`, `ValidationError`, `SerializationError`) bubble freely and don't need declaring.
|
|
156
|
-
|
|
157
|
-
```ts
|
|
158
|
-
errors: [
|
|
159
|
-
{ reason: 'no_match', code: JsonRpcErrorCode.NotFound,
|
|
160
|
-
when: 'No item matched the query',
|
|
161
|
-
recovery: 'Broaden the query or check the spelling and try again.' },
|
|
162
|
-
],
|
|
163
|
-
async handler(input, ctx) {
|
|
164
|
-
const item = await db.find(input.id);
|
|
165
|
-
if (!item) throw ctx.fail('no_match', `No item ${input.id}`);
|
|
166
|
-
return item;
|
|
167
|
-
}
|
|
168
|
-
```
|
|
169
|
-
|
|
170
|
-
**Declare contracts inline on each tool.** The contract is part of the tool's public surface — one file should give the full picture. Don't extract a shared `errors[]` constant; per-tool repetition is the intended cost of locality.
|
|
171
|
-
|
|
172
|
-
**Fallback (no contract entry fits):** throw via factories or plain `Error`.
|
|
173
|
-
|
|
174
|
-
```ts
|
|
175
|
-
// Error factories — explicit code
|
|
176
|
-
import { notFound, serviceUnavailable } from '@cyanheads/mcp-ts-core/errors';
|
|
177
|
-
throw notFound('Item not found', { itemId });
|
|
178
|
-
throw serviceUnavailable('API unavailable', { url }, { cause: err });
|
|
179
|
-
|
|
180
|
-
// Plain Error — framework auto-classifies from message patterns
|
|
181
|
-
throw new Error('Item not found'); // → NotFound
|
|
182
|
-
throw new Error('Invalid query format'); // → ValidationError
|
|
183
|
-
|
|
184
|
-
// McpError — when no factory exists for the code
|
|
185
|
-
import { McpError, JsonRpcErrorCode } from '@cyanheads/mcp-ts-core/errors';
|
|
186
|
-
throw new McpError(JsonRpcErrorCode.DatabaseError, 'Connection failed', { pool: 'primary' });
|
|
187
|
-
```
|
|
188
|
-
|
|
189
|
-
See framework CLAUDE.md and the `api-errors` skill for the full auto-classification table, all available factories, and the contract reference.
|
|
190
|
-
|
|
191
|
-
---
|
|
192
|
-
|
|
193
|
-
## Structure
|
|
194
|
-
|
|
195
|
-
```text
|
|
196
|
-
src/
|
|
197
|
-
index.ts # createApp() entry point — registers tools, resource, and initializes services
|
|
198
|
-
config/
|
|
199
|
-
server-config.ts # LOC_USER_AGENT and LOC_REQUEST_DELAY_MS (Zod schema)
|
|
200
|
-
services/
|
|
201
|
-
loc-api/
|
|
202
|
-
loc-api-service.ts # LOC JSON API client — rate pacing, search, item fetch, newspaper page
|
|
203
|
-
types.ts # Raw and normalized LOC API types
|
|
204
|
-
lc-linked-data/
|
|
205
|
-
lc-linked-data-service.ts # id.loc.gov LCSH subject suggest client
|
|
206
|
-
types.ts # Subject heading types
|
|
207
|
-
mcp-server/
|
|
208
|
-
tools/definitions/
|
|
209
|
-
libofcongress-search.tool.ts # libofcongress_search — general LOC collection search
|
|
210
|
-
libofcongress-get-item.tool.ts # libofcongress_get_item — full item metadata
|
|
211
|
-
libofcongress-search-newspapers.tool.ts # libofcongress_search_newspapers — Chronicling America search
|
|
212
|
-
libofcongress-get-newspaper-page.tool.ts # libofcongress_get_newspaper_page — full OCR text
|
|
213
|
-
libofcongress-search-subjects.tool.ts # libofcongress_search_subjects — LCSH subject heading lookup
|
|
214
|
-
libofcongress-browse-collections.tool.ts # libofcongress_browse_collections — curated collection browser
|
|
215
|
-
resources/definitions/
|
|
216
|
-
libofcongress-item.resource.ts # libofcongress://item/{item_id} — stable item URI
|
|
217
|
-
```
|
|
218
|
-
|
|
219
|
-
---
|
|
220
|
-
|
|
221
|
-
## Naming
|
|
222
|
-
|
|
223
|
-
| What | Convention | Example |
|
|
224
|
-
|:-----|:-----------|:--------|
|
|
225
|
-
| Files | kebab-case with suffix | `search-docs.tool.ts` |
|
|
226
|
-
| Tool/resource/prompt names | snake_case | `search_docs` |
|
|
227
|
-
| Directories | kebab-case | `src/services/doc-search/` |
|
|
228
|
-
| Descriptions | Single string or template literal, no `+` concatenation | `'Search items by query and filter.'` |
|
|
229
|
-
|
|
230
|
-
---
|
|
231
|
-
|
|
232
|
-
## Skills
|
|
233
|
-
|
|
234
|
-
Skills are modular instructions in `skills/` at the project root. Read them directly when a task matches — e.g., `skills/add-tool/SKILL.md` when adding a tool.
|
|
235
|
-
|
|
236
|
-
**Agent skill directory:** Copy skills into the directory your agent discovers (Claude Code: `.claude/skills/`, others: equivalent). Skills then load as context without referencing `skills/` paths. After framework updates, run the `maintenance` skill — Phase B re-syncs the agent directory.
|
|
237
|
-
|
|
238
|
-
Available skills:
|
|
239
|
-
|
|
240
|
-
| Skill | Purpose |
|
|
241
|
-
|:------|:--------|
|
|
242
|
-
| `setup` | Post-init project orientation |
|
|
243
|
-
| `design-mcp-server` | Design tool surface, resources, and services for a new server |
|
|
244
|
-
| `add-tool` | Scaffold a new tool definition |
|
|
245
|
-
| `add-app-tool` | Scaffold an MCP App tool + paired UI resource |
|
|
246
|
-
| `add-resource` | Scaffold a new resource definition |
|
|
247
|
-
| `add-prompt` | Scaffold a new prompt definition |
|
|
248
|
-
| `add-service` | Scaffold a new service integration |
|
|
249
|
-
| `add-test` | Scaffold test file for a tool, resource, or service |
|
|
250
|
-
| `field-test` | Exercise tools/resources/prompts with real inputs, verify behavior, report issues |
|
|
251
|
-
| `security-pass` | Audit server for MCP-flavored security gaps: output injection, scope blast radius, input sinks, tenant isolation |
|
|
252
|
-
| `devcheck` | Lint, format, typecheck, audit |
|
|
253
|
-
| `polish-docs-meta` | Finalize docs, README, metadata, and agent protocol for shipping |
|
|
254
|
-
| `maintenance` | Investigate changelogs, adopt upstream changes, sync skills to agent dirs |
|
|
255
|
-
| `report-issue-framework` | File a bug or feature request against `@cyanheads/mcp-ts-core` via `gh` CLI |
|
|
256
|
-
| `report-issue-local` | File a bug or feature request against this server's own repo via `gh` CLI |
|
|
257
|
-
| `api-auth` | Auth modes, scopes, JWT/OAuth |
|
|
258
|
-
| `api-canvas` | DataCanvas: register tabular data, run SQL, export, plus the `spillover()` helper for big result sets — Tier 3 opt-in |
|
|
259
|
-
| `api-config` | AppConfig, parseConfig, env vars |
|
|
260
|
-
| `api-context` | Context interface, logger, state, progress |
|
|
261
|
-
| `api-errors` | McpError, JsonRpcErrorCode, error patterns |
|
|
262
|
-
| `api-services` | LLM, Speech, Graph services |
|
|
263
|
-
| `api-testing` | createMockContext, test patterns |
|
|
264
|
-
| `api-utils` | Formatting, parsing, security, pagination, scheduling, telemetry helpers |
|
|
265
|
-
| `api-telemetry` | OTel catalog: spans, metrics, completion logs, env config, cardinality rules |
|
|
266
|
-
| `api-workers` | Cloudflare Workers runtime |
|
|
267
|
-
|
|
268
|
-
When you complete a skill's checklist, check the boxes and add a completion timestamp at the end (e.g., `Completed: 2026-03-11`).
|
|
269
|
-
|
|
270
|
-
---
|
|
271
|
-
|
|
272
|
-
## Commands
|
|
273
|
-
|
|
274
|
-
**Runtime:** Scripts use `tsx` — both `npm run <cmd>` and `bun run <cmd>` work. `bun` is slightly faster for script invocation but not required.
|
|
275
|
-
|
|
276
|
-
| Command | Purpose |
|
|
277
|
-
|:--------|:--------|
|
|
278
|
-
| `npm run build` | Compile TypeScript |
|
|
279
|
-
| `npm run rebuild` | Clean + build |
|
|
280
|
-
| `npm run clean` | Remove build artifacts |
|
|
281
|
-
| `npm run devcheck` | Lint + format + typecheck + security + changelog sync |
|
|
282
|
-
| `bun run audit:refresh` | Delete `bun.lock`, reinstall, re-audit. Use when `devcheck` flags a transitive advisory — stale lockfile can mask already-patched deps. If advisory survives, it's real. |
|
|
283
|
-
| `npm run tree` | Generate directory structure doc |
|
|
284
|
-
| `npm run format` | Auto-fix formatting |
|
|
285
|
-
| `npm test` | Run tests |
|
|
286
|
-
| `npm run start:stdio` | Production mode (stdio) |
|
|
287
|
-
| `npm run start:http` | Production mode (HTTP) |
|
|
288
|
-
| `npm run changelog:build` | Regenerate `CHANGELOG.md` from `changelog/*.md` |
|
|
289
|
-
| `npm run changelog:check` | Verify `CHANGELOG.md` is in sync (used by devcheck) |
|
|
290
|
-
| `npm run bundle` | Build and pack as `.mcpb` for one-click Claude Desktop install |
|
|
291
|
-
|
|
292
|
-
---
|
|
293
|
-
|
|
294
|
-
## Bundling
|
|
295
|
-
|
|
296
|
-
`npm run bundle` produces a `.mcpb` extension bundle for one-click install in Claude Desktop. MCPB is stdio-only — HTTP and Cloudflare Workers deployments are unaffected. Consumers who don't need it can delete `manifest.json` and `.mcpbignore`; `lint:packaging` skips cleanly.
|
|
297
|
-
|
|
298
|
-
**Adding an env var requires both files:** `server.json` (registry discovery, `environmentVariables[]`) and `manifest.json` (bundle install UX, `mcp_config.env` + `user_config`). `lint:packaging` (run by `devcheck`) verifies the env var names match.
|
|
299
|
-
|
|
300
|
-
**README install badges.** Drop these into the project README to give users one-click install paths. Fill in `<OWNER>` / `<REPO>` / `<PACKAGE_NAME>` and encode the per-server config. Cursor + VS Code badges assume the server is published to npm; Claude Desktop downloads the `.mcpb` directly so npm publishing isn't required.
|
|
301
|
-
|
|
302
|
-
| Client | Mechanism |
|
|
303
|
-
|:-------|:----------|
|
|
304
|
-
| Claude Desktop | Browser downloads the `.mcpb` from the latest GitHub Release; OS file handler routes it to Claude Desktop, which opens the install dialog. No deep-link URL scheme yet — this is the canonical path. |
|
|
305
|
-
| Cursor | Official `https://cursor.com/en/install-mcp` endpoint with base64 JSON config. |
|
|
306
|
-
| VS Code / Insiders | Official `vscode:mcp/install?...` deep link, wrapped in `https://vscode.dev/redirect?url=` so GitHub-rendered markdown doesn't strip the non-HTTP scheme. |
|
|
307
|
-
| Claude Code / Codex | CLI only (`claude mcp add` / `codex mcp add`); no URL scheme. |
|
|
308
|
-
|
|
309
|
-
```markdown
|
|
310
|
-
[](https://github.com/<OWNER>/<REPO>/releases/latest/download/<PACKAGE_NAME>.mcpb)
|
|
311
|
-
[](https://cursor.com/en/install-mcp?name=<PACKAGE_NAME>&config=<BASE64_CONFIG>)
|
|
312
|
-
[](https://vscode.dev/redirect?url=vscode:mcp/install?<URLENCODED_JSON>)
|
|
313
|
-
```
|
|
314
|
-
|
|
315
|
-
Both install links route through HTTPS endpoints (`cursor.com/en/install-mcp` and `vscode.dev/redirect`) — GitHub-rendered markdown strips non-HTTP URL schemes from anchors, so a raw `cursor://` or `vscode:` link won't click through from github.com.
|
|
316
|
-
|
|
317
|
-
Generate the encoded configs (replace `<PACKAGE_NAME>` and add env vars for any required API keys):
|
|
318
|
-
|
|
319
|
-
```bash
|
|
320
|
-
# Cursor: base64-encoded JSON. Split command/args, add env when keys are needed.
|
|
321
|
-
echo -n '{"command":"npx","args":["-y","<PACKAGE_NAME>"],"env":{"API_KEY":"your-api-key"}}' | base64
|
|
322
|
-
# Without env (no required keys):
|
|
323
|
-
echo -n '{"command":"npx","args":["-y","<PACKAGE_NAME>"]}' | base64
|
|
324
|
-
|
|
325
|
-
# VS Code: URL-encoded JSON. Same shape plus a `name` field.
|
|
326
|
-
node -p 'encodeURIComponent(JSON.stringify({name:"<SHORT_NAME>",command:"npx",args:["-y","<PACKAGE_NAME>"],env:{API_KEY:"your-api-key"}}))'
|
|
327
|
-
# Without env:
|
|
328
|
-
node -p 'encodeURIComponent(JSON.stringify({name:"<SHORT_NAME>",command:"npx",args:["-y","<PACKAGE_NAME>"]}))'
|
|
329
|
-
```
|
|
330
|
-
|
|
331
|
-
Both clients use the same `{command, args, env}` shape (matching `mcp.json` schema). VS Code adds a top-level `name` field. Omit `env` entirely when no API keys are needed — don't include empty objects or framework-only vars like `MCP_TRANSPORT_TYPE`.
|
|
332
|
-
|
|
333
|
-
The Claude Desktop badge requires the bundle to ship with a stable filename — `bun run bundle` outputs `dist/<PACKAGE_NAME>.mcpb`, and `release-and-publish` attaches that file to the GitHub Release. `releases/latest/download/<PACKAGE_NAME>.mcpb` then redirects to the most recent release.
|
|
334
|
-
|
|
335
|
-
---
|
|
336
|
-
|
|
337
|
-
## Changelog
|
|
338
|
-
|
|
339
|
-
Directory-based, grouped by minor series via the `.x` semver-wildcard convention. Source of truth: `changelog/<major.minor>.x/<version>.md` (e.g. `changelog/0.1.x/0.1.0.md`) — one file per release, shipped in the npm package. At release, author the per-version file with a concrete version and date, then run `npm run changelog:build` to regenerate the rollup. `changelog/template.md` is a **pristine format reference** — never edited or moved; read it for the frontmatter + section layout when scaffolding. `CHANGELOG.md` is a **navigation index** (header + link + summary per version), regenerated by `npm run changelog:build` — devcheck hard-fails on drift; never hand-edit it.
|
|
340
|
-
|
|
341
|
-
Each per-version file opens with YAML frontmatter:
|
|
342
|
-
|
|
343
|
-
```markdown
|
|
344
|
-
---
|
|
345
|
-
summary: "One-line headline, ≤350 chars" # required — powers the rollup index
|
|
346
|
-
breaking: false # optional — true flags breaking changes
|
|
347
|
-
security: false # optional — true flags security fixes
|
|
348
|
-
---
|
|
349
|
-
|
|
350
|
-
# 0.1.0 — YYYY-MM-DD
|
|
351
|
-
...
|
|
352
|
-
```
|
|
353
|
-
|
|
354
|
-
`breaking: true` renders a `· ⚠️ Breaking` badge — use it when consumers must update code on upgrade (signature changes, removed APIs, config renames). `security: true` renders a `· 🛡️ Security` badge and pairs with a `## Security` body section. When both are set, badges render `· ⚠️ Breaking · 🛡️ Security`.
|
|
355
|
-
|
|
356
|
-
**Section order** (Keep a Changelog): Added, Changed, Deprecated, Removed, Fixed, Security. Include only sections with entries — don't ship empty headers.
|
|
357
|
-
|
|
358
|
-
**Tag annotations** render as GitHub Release bodies via `--notes-from-tag`. They must be structured markdown — never a flat comma-separated string. Subject omits the version number (GitHub prepends it). See `changelog/template.md` for the full format reference.
|
|
359
|
-
|
|
360
|
-
---
|
|
361
|
-
|
|
362
|
-
## Imports
|
|
363
|
-
|
|
364
|
-
```ts
|
|
365
|
-
// Framework — z is re-exported, no separate zod import needed
|
|
366
|
-
import { tool, z } from '@cyanheads/mcp-ts-core';
|
|
367
|
-
import { McpError, JsonRpcErrorCode } from '@cyanheads/mcp-ts-core/errors';
|
|
368
|
-
|
|
369
|
-
// Server's own code — via path alias
|
|
370
|
-
import { getMyService } from '@/services/my-domain/my-service.js';
|
|
371
|
-
```
|
|
372
|
-
|
|
373
|
-
---
|
|
374
|
-
|
|
375
|
-
## Checklist
|
|
376
|
-
|
|
377
|
-
- [ ] Zod schemas: all fields have `.describe()`, only JSON-Schema-serializable types (no `z.custom()`, `z.date()`, `z.transform()`, `z.bigint()`, `z.symbol()`, `z.void()`, `z.map()`, `z.set()`, `z.function()`, `z.nan()`)
|
|
378
|
-
- [ ] Optional nested objects: handler guards for empty inner values from form-based clients (`if (input.obj?.field && ...)`, not just `if (input.obj)`). When regex/length constraints matter, use `z.union([z.literal(''), z.string().regex(...).describe(...)])` — literal variants are exempt from `describe-on-fields`.
|
|
379
|
-
- [ ] JSDoc `@fileoverview` + `@module` on every file
|
|
380
|
-
- [ ] `ctx.log` for logging, `ctx.state` for storage
|
|
381
|
-
- [ ] Handlers throw on failure — error factories or plain `Error`, no try/catch
|
|
382
|
-
- [ ] `format()` renders all data the LLM needs — different clients forward different surfaces (Claude Code → `structuredContent`, Claude Desktop → `content[]`); both must carry the same data
|
|
383
|
-
- [ ] If wrapping external API: raw/domain/output schemas reviewed against real upstream sparsity/nullability before finalizing required vs optional fields
|
|
384
|
-
- [ ] If wrapping external API: normalization and `format()` preserve uncertainty; do not fabricate facts from missing upstream data
|
|
385
|
-
- [ ] If wrapping external API: tests include at least one sparse payload case with omitted upstream fields
|
|
386
|
-
- [ ] Registered in `createApp()` arrays (directly or via barrel exports)
|
|
387
|
-
- [ ] Tests use `createMockContext()` from `@cyanheads/mcp-ts-core/testing`
|
|
388
|
-
- [ ] `npm run devcheck` passes
|
package/changelog/0.1.x/0.1.0.md
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
summary: "Initial release — LOC digital collections, Chronicling America newspaper search with full OCR, LCSH subject heading lookup, and collection browsing via MCP."
|
|
3
|
-
breaking: false
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
# 0.1.0 — 2026-05-24
|
|
7
|
-
|
|
8
|
-
Initial release.
|
|
9
|
-
|
|
10
|
-
## Added
|
|
11
|
-
|
|
12
|
-
- `loc_search` — full-text search across LOC digital collections with format, date range, subject heading, and geographic location filters
|
|
13
|
-
- `loc_get_item` — full metadata for a specific LOC item: contributors, subjects, rights, physical description, resource links, related items
|
|
14
|
-
- `loc_search_newspapers` — historical newspaper page search (Chronicling America corpus) with OCR excerpts, date range, state, and publication title filters
|
|
15
|
-
- `loc_get_newspaper_page` — full OCR text for a specific newspaper page; ALTO XML parsing with graceful `ocr_available: false` for image-only batches
|
|
16
|
-
- `loc_search_subjects` — Library of Congress Subject Headings (LCSH) search via `id.loc.gov` suggest endpoint; returns standardized labels and URIs for use as `loc_search` subject filters
|
|
17
|
-
- `loc_browse_collections` — lists and filters LOC curated digital collections; returns slugs usable as `partof` facet values in `loc_search`
|
|
18
|
-
- `loc://item/{item_id}` resource — stable URI for injecting item metadata into agent context
|
|
19
|
-
- `LocApiService` — LOC JSON API client with module-level rate-limit enforcement (20 req/min, 1-hour block on 429), configurable pacing delay, HTML-response detection, and out-of-range page handling (HTTP 400/520)
|
|
20
|
-
- `LcLinkedDataService` — `id.loc.gov` subject suggest client
|
|
21
|
-
- Server-level agent instructions: recommended tool-call order, two-hop newspaper workflow, rate-limit reminder
|
|
22
|
-
- 81 tests (7 test files) covering all tools and the item resource
|
package/changelog/0.1.x/0.1.1.md
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
summary: "Initial npm publish — 6 tools, 1 resource, 81 tests, field-test fixes, and pre-launch polish"
|
|
3
|
-
breaking: false
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
# 0.1.1 — 2026-05-24
|
|
7
|
-
|
|
8
|
-
First published release. Implements the full server surface, applies field-test fixes, and ships pre-launch polish over the initial scaffold tagged as 0.1.0.
|
|
9
|
-
|
|
10
|
-
## Added
|
|
11
|
-
|
|
12
|
-
- `loc_search` — full-text search across LOC digital collections with format, date range, subject heading, and geographic location filters
|
|
13
|
-
- `loc_get_item` — full metadata for a specific LOC item: contributors, subjects, rights, physical description, resource links, related items
|
|
14
|
-
- `loc_search_newspapers` — historical newspaper page search (Chronicling America corpus) with OCR excerpts, date range, state, and publication title filters
|
|
15
|
-
- `loc_get_newspaper_page` — full OCR text for a specific newspaper page; ALTO XML parsing with graceful `ocr_available: false` for image-only batches
|
|
16
|
-
- `loc_search_subjects` — LCSH subject heading lookup via `id.loc.gov` suggest endpoint; returns standardized labels and URIs
|
|
17
|
-
- `loc_browse_collections` — curated LOC digital collections browser; returns slugs usable as `partof` facet values in `loc_search`
|
|
18
|
-
- `loc://item/{item_id}` resource — stable URI for injecting item metadata into agent context
|
|
19
|
-
- `LocApiService` — LOC JSON API client with module-level rate-limit enforcement (20 req/min, 1-hour block on 429), configurable pacing delay, HTML-response detection, and out-of-range page handling
|
|
20
|
-
- `LcLinkedDataService` — `id.loc.gov` subject suggest client
|
|
21
|
-
- Server-level agent instructions in `AGENTS.md`: recommended tool-call order, two-hop newspaper workflow, rate-limit reminder
|
|
22
|
-
- 81 tests across 7 files covering all tools and the item resource
|
|
23
|
-
|
|
24
|
-
## Fixed
|
|
25
|
-
|
|
26
|
-
- `loc_search` and `loc_search_newspapers` — improved date range validation, field mapping corrections (`newspaper_title` from `partof_title` not `subject`), and sparse result handling
|
|
27
|
-
- `loc_get_newspaper_page` — hardened ALTO XML parsing; added rate-limit detection and configurable retry guidance
|
|
28
|
-
- `loc_get_item` — null-safety improvements for sparse upstream payloads
|
|
29
|
-
- `LocApiService` — corrected field extraction, added structured handling for HTTP 429/400/520 responses
|
package/changelog/0.2.x/0.2.0.md
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
summary: "Tool prefix renamed loc_* → libofcongress_*; resource URI renamed loc:// → libofcongress://"
|
|
3
|
-
breaking: true
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
# 0.2.0 — 2026-05-24
|
|
7
|
-
|
|
8
|
-
## Changed
|
|
9
|
-
|
|
10
|
-
- All six tools renamed: `loc_search` → `libofcongress_search`, `loc_get_item` → `libofcongress_get_item`, `loc_search_newspapers` → `libofcongress_search_newspapers`, `loc_get_newspaper_page` → `libofcongress_get_newspaper_page`, `loc_search_subjects` → `libofcongress_search_subjects`, `loc_browse_collections` → `libofcongress_browse_collections` ([#12](https://github.com/cyanheads/libofcongress-mcp-server/issues/12))
|
|
11
|
-
- Resource URI renamed: `loc://item/{item_id}` → `libofcongress://item/{item_id}`
|
|
12
|
-
- Tool and resource definition files renamed to match: `loc-*.tool.ts` → `libofcongress-*.tool.ts`, `loc-item.resource.ts` → `libofcongress-item.resource.ts`
|
|
13
|
-
- Test files renamed to mirror the new filenames
|
package/changelog/0.2.x/0.2.1.md
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
summary: "npm package scoped to @cyanheads/libofcongress-mcp-server"
|
|
3
|
-
breaking: false
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
# 0.2.1 — 2026-05-24
|
|
7
|
-
|
|
8
|
-
## Fixed
|
|
9
|
-
|
|
10
|
-
- **package name** corrected from bare `libofcongress-mcp-server` to `@cyanheads/libofcongress-mcp-server` — install via `npx -y @cyanheads/libofcongress-mcp-server`
|
|
11
|
-
- **`server.json` identifiers** updated to `@cyanheads/libofcongress-mcp-server` in both stdio and HTTP package entries
|
|
12
|
-
- **Cursor and VS Code install badges** recomputed with the scoped package name
|
|
13
|
-
- **`bundle` script** switched from `npm run build` to `bun run build` for consistency with the rest of the scripts
|
|
14
|
-
- **`author` field** aligned to the cyanheads convention (`cyanheads <casey@caseyjhand.com>`)
|
package/changelog/0.2.x/0.2.2.md
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
summary: "Field-test fixes: rights crash, OCR extraction, out-of-range pagination, URL normalization, and tool-definition improvements"
|
|
3
|
-
breaking: false
|
|
4
|
-
security: false
|
|
5
|
-
---
|
|
6
|
-
|
|
7
|
-
# 0.2.2 — 2026-05-24
|
|
8
|
-
|
|
9
|
-
## Fixed
|
|
10
|
-
|
|
11
|
-
- **`rights` crash** ([#13](https://github.com/cyanheads/libofcongress-mcp-server/issues/13)) — `rights` and `rights_information` typed as `string | string[]`; joined to a single string before return, preventing a type crash when LOC returns an array.
|
|
12
|
-
- **OCR text extraction** ([#14](https://github.com/cyanheads/libofcongress-mcp-server/issues/14)) — `tile.loc.gov` returns JSON (`{ "<key>": { full_text: "..." } }`), not ALTO XML; extraction rewritten to parse the JSON shape. OCR test suite updated to match.
|
|
13
|
-
- **Out-of-range pagination** ([#15](https://github.com/cyanheads/libofcongress-mcp-server/issues/15)) — `libofcongress_search`, `libofcongress_search_newspapers`, and `libofcongress_browse_collections` now return a clear `message` when `page` exceeds the available range, using `pages === 0` as the LOC 400 sentinel.
|
|
14
|
-
- **Protocol-relative URL normalization** ([#16](https://github.com/cyanheads/libofcongress-mcp-server/issues/16)) — LOC sometimes returns `//lccn.loc.gov/...` URLs; normalized to `https:` before surfacing.
|
|
15
|
-
- **`libofcongress_get_newspaper_page` error contract** ([#17](https://github.com/cyanheads/libofcongress-mcp-server/issues/17)) — handler now `async`; `NotFound` errors from the service are re-thrown as typed `page_not_found` failures via `ctx.fail`. Redundant URL-parse validation removed (prefix check is sufficient).
|
|
16
|
-
- **`libofcongress_get_item` error contract** ([#18](https://github.com/cyanheads/libofcongress-mcp-server/issues/18)) — handler converted to `async`; `NotFound` errors re-thrown as typed `item_not_found` failures via `ctx.fail`.
|
|
17
|
-
- **`libofcongress_search` and `libofcongress_search_newspapers` query input** ([#19](https://github.com/cyanheads/libofcongress-mcp-server/issues/19)) — `query` field gains `.trim()` to strip accidental leading/trailing whitespace before hitting the LOC API.
|
|
18
|
-
|
|
19
|
-
## Changed
|
|
20
|
-
|
|
21
|
-
- **`libofcongress_browse_collections` description** — removed incorrect claim that the `slug` value can be passed as a `partof` facet to `libofcongress_search` (that routing does not work); replaced with accurate description of the returned URL.
|
|
22
|
-
- **`slug` output field description** — simplified to reflect actual semantics (identifies the collection in loc.gov URLs).
|
|
23
|
-
- **`libofcongress://item` resource description** — removed redundant "Stable URI for injecting item context into agent conversations" sentence.
|
|
24
|
-
- **`libofcongress_get_newspaper_page` `page_url` description** — replaced vague format description with a concrete example URL.
|
|
25
|
-
- **`HTML_RESPONSE_RE` regex** — extracted to a module-level constant to avoid recompilation on every request.
|
|
26
|
-
- **`normalizePagination` stub replaced** — `fetchSearchJson` returning `null` (LOC 400) now returns an explicit `{ pages: 0 }` sentinel object instead of calling the normalization helper with `undefined`.
|
package/changelog/template.md
DELETED
|
@@ -1,119 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
# FORMAT REFERENCE — do not edit. Copy this file to
|
|
3
|
-
# `changelog/<major.minor>.x/<version>.md` (e.g. `changelog/0.8.x/0.8.6.md`)
|
|
4
|
-
# to author a new release. Set that file's H1 to `# <version> — YYYY-MM-DD`
|
|
5
|
-
# with a concrete date.
|
|
6
|
-
|
|
7
|
-
# Required. One-line GitHub Release-style headline. 350 character cap.
|
|
8
|
-
# Default short and scannable. Don't pad, don't stitch unrelated changes with
|
|
9
|
-
# semicolons — pick the headline. Quotes required: unquoted YAML treats `: `
|
|
10
|
-
# inside the value as a key separator and fails GitHub's strict parser.
|
|
11
|
-
summary: ""
|
|
12
|
-
|
|
13
|
-
# Set `true` when consumers must change code to upgrade: API removals,
|
|
14
|
-
# signature changes, config renames, behavior changes that break existing
|
|
15
|
-
# usage. Flagged as `Breaking` in the rollup.
|
|
16
|
-
breaking: false
|
|
17
|
-
|
|
18
|
-
# Set `true` if this release contains any security fix. Pairs with the
|
|
19
|
-
# `## Security` section below. Flagged as `Security` in the rollup so
|
|
20
|
-
# users can triage upgrade urgency at a glance.
|
|
21
|
-
security: false
|
|
22
|
-
---
|
|
23
|
-
|
|
24
|
-
# <version> — YYYY-MM-DD
|
|
25
|
-
|
|
26
|
-
<!--
|
|
27
|
-
AUTHORING GUIDE — applies to the new per-version file you create from this
|
|
28
|
-
template.
|
|
29
|
-
|
|
30
|
-
Audience: someone scanning release notes to decide what affects them. Lead
|
|
31
|
-
each bullet with the symbol or concept name in **bold** so they can skip
|
|
32
|
-
what's irrelevant and zoom in on what's not.
|
|
33
|
-
|
|
34
|
-
Tone: terse, fact-dense, not verbose. Default to one sentence per bullet —
|
|
35
|
-
name the symbol, state what changed, stop. Use a second sentence only when
|
|
36
|
-
it carries weight. If a bullet feels long, it is.
|
|
37
|
-
|
|
38
|
-
Cut: mechanism walkthroughs (those belong in JSDoc, AGENTS.md, or the
|
|
39
|
-
relevant skill), ceremonial framings ("This release introduces…",
|
|
40
|
-
backwards-compat paragraphs), file-by-file test enumerations, internal
|
|
41
|
-
implementation notes. Prefer code/symbol names over English re-explanations.
|
|
42
|
-
|
|
43
|
-
Narrative intro: skip by default. Add one short sentence only when the
|
|
44
|
-
release theme genuinely needs framing the bullets can't carry.
|
|
45
|
-
|
|
46
|
-
Sections: Keep a Changelog order — Added, Changed, Deprecated, Removed,
|
|
47
|
-
Fixed, Security. Include only sections with entries; delete the rest
|
|
48
|
-
(including the commented-out scaffolding below). Don't ship empty headers.
|
|
49
|
-
|
|
50
|
-
Include: every distinct fact a reader needs to adopt or audit the release —
|
|
51
|
-
new exports, signatures, lint rule IDs, env vars, breaking changes, version
|
|
52
|
-
bumps on shipped skills. Nothing more.
|
|
53
|
-
|
|
54
|
-
Links: link issues, PRs, docs, or skills where they help a reader jump to
|
|
55
|
-
context. Once per item per entry — don't re-link the same issue in summary,
|
|
56
|
-
narrative, and bullet. Skip links for inline symbol names; code spans speak
|
|
57
|
-
for themselves.
|
|
58
|
-
|
|
59
|
-
Issue/PR URLs: use full URLs. GitHub's bare `#NN` auto-link only resolves
|
|
60
|
-
inside its own UI, not in npm reads or local editors.
|
|
61
|
-
|
|
62
|
-
[#38](https://github.com/cyanheads/mcp-ts-core/issues/38) ← issue
|
|
63
|
-
[#42](https://github.com/cyanheads/mcp-ts-core/pull/42) ← PR
|
|
64
|
-
|
|
65
|
-
Verify numbers exist before linking (`gh issue view NN`, `gh pr view NN`).
|
|
66
|
-
Never speculate on a future number — `#42` for an upcoming PR silently
|
|
67
|
-
resolves to whatever real item already owns 42, and timeline previews pull
|
|
68
|
-
in that unrelated item's metadata.
|
|
69
|
-
|
|
70
|
-
TAG ANNOTATIONS — the annotated tag body renders as the GitHub Release body
|
|
71
|
-
via `gh release create --notes-from-tag`. The tag is a derivative of this
|
|
72
|
-
changelog entry — a condensed, scannable version, not a copy. Format:
|
|
73
|
-
|
|
74
|
-
<theme — omit version number, GitHub prepends it>
|
|
75
|
-
← blank line
|
|
76
|
-
<1-2 sentence context: what this release does>
|
|
77
|
-
← blank line
|
|
78
|
-
Dependency bumps: ← section header
|
|
79
|
-
← blank line
|
|
80
|
-
- `@cyanheads/mcp-ts-core` ^0.9.1 → ^0.9.6 ← bullet
|
|
81
|
-
← blank line
|
|
82
|
-
Changed: ← only sections with entries
|
|
83
|
-
← blank line
|
|
84
|
-
- `format()` output includes `query` in text mode
|
|
85
|
-
← blank line
|
|
86
|
-
Added:
|
|
87
|
-
← blank line
|
|
88
|
-
- `manifest.json` scaffolded for MCPB bundle support
|
|
89
|
-
- Install badges (Claude Desktop, Cursor, VS Code)
|
|
90
|
-
← blank line
|
|
91
|
-
<N> tests pass; `bun run devcheck` clean. ← footer
|
|
92
|
-
|
|
93
|
-
Never a flat comma-separated string. Always structured markdown with
|
|
94
|
-
sections. The tag must scan well as a rendered GitHub Release page.
|
|
95
|
-
-->
|
|
96
|
-
|
|
97
|
-
## Added
|
|
98
|
-
|
|
99
|
-
-
|
|
100
|
-
|
|
101
|
-
## Changed
|
|
102
|
-
|
|
103
|
-
-
|
|
104
|
-
|
|
105
|
-
<!-- ## Deprecated
|
|
106
|
-
|
|
107
|
-
- -->
|
|
108
|
-
|
|
109
|
-
<!-- ## Removed
|
|
110
|
-
|
|
111
|
-
- -->
|
|
112
|
-
|
|
113
|
-
## Fixed
|
|
114
|
-
|
|
115
|
-
-
|
|
116
|
-
|
|
117
|
-
<!-- ## Security
|
|
118
|
-
|
|
119
|
-
- -->
|