@metaneutrons/doc-tools-mcp 0.1.0
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/LICENSE +674 -0
- package/README.md +118 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +116 -0
- package/dist/index.js.map +1 -0
- package/dist/providers/bib/index.d.ts +2 -0
- package/dist/providers/bib/index.js +166 -0
- package/dist/providers/bib/index.js.map +1 -0
- package/dist/providers/bib/schema.d.ts +44 -0
- package/dist/providers/bib/schema.js +89 -0
- package/dist/providers/bib/schema.js.map +1 -0
- package/dist/providers/bib/store.d.ts +17 -0
- package/dist/providers/bib/store.js +90 -0
- package/dist/providers/bib/store.js.map +1 -0
- package/dist/providers/bib/tools/index.d.ts +2 -0
- package/dist/providers/bib/tools/index.js +4 -0
- package/dist/providers/bib/tools/index.js.map +1 -0
- package/dist/providers/bib/tools/read.d.ts +5 -0
- package/dist/providers/bib/tools/read.js +48 -0
- package/dist/providers/bib/tools/read.js.map +1 -0
- package/dist/providers/bib/tools/write.d.ts +2 -0
- package/dist/providers/bib/tools/write.js +66 -0
- package/dist/providers/bib/tools/write.js.map +1 -0
- package/dist/shared/errors.d.ts +34 -0
- package/dist/shared/errors.js +60 -0
- package/dist/shared/errors.js.map +1 -0
- package/dist/shared/logger.d.ts +17 -0
- package/dist/shared/logger.js +40 -0
- package/dist/shared/logger.js.map +1 -0
- package/dist/shared/types.d.ts +23 -0
- package/dist/shared/types.js +2 -0
- package/dist/shared/types.js.map +1 -0
- package/package.json +84 -0
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { readFile, writeFile, copyFile } from 'fs/promises';
|
|
2
|
+
import { existsSync } from 'fs';
|
|
3
|
+
import yaml from 'js-yaml';
|
|
4
|
+
import { cslEntrySchema } from './schema.js';
|
|
5
|
+
import { FileError } from '../../shared/errors.js';
|
|
6
|
+
import { rootLogger } from '../../shared/logger.js';
|
|
7
|
+
const logger = rootLogger.child({ module: 'bib-store' });
|
|
8
|
+
export class BibStore {
|
|
9
|
+
/** Read and parse a CSL-YAML file */
|
|
10
|
+
async read(filePath) {
|
|
11
|
+
if (!existsSync(filePath)) {
|
|
12
|
+
throw new FileError(`File not found: ${filePath}`, filePath);
|
|
13
|
+
}
|
|
14
|
+
try {
|
|
15
|
+
const content = await readFile(filePath, 'utf-8');
|
|
16
|
+
const doc = yaml.load(content);
|
|
17
|
+
if (!doc || !Array.isArray(doc.references)) {
|
|
18
|
+
throw new FileError('Invalid CSL-YAML: missing "references" array', filePath);
|
|
19
|
+
}
|
|
20
|
+
return doc.references.map((entry) => {
|
|
21
|
+
const result = cslEntrySchema.safeParse(entry);
|
|
22
|
+
if (!result.success) {
|
|
23
|
+
logger.warn('Entry failed schema validation', { id: entry?.id, errors: result.error.issues });
|
|
24
|
+
return entry;
|
|
25
|
+
}
|
|
26
|
+
return result.data;
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
catch (error) {
|
|
30
|
+
if (error instanceof FileError)
|
|
31
|
+
throw error;
|
|
32
|
+
throw new FileError(`Failed to parse YAML: ${error instanceof Error ? error.message : String(error)}`, filePath, error instanceof Error ? error : undefined);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
/** Write entries back to a CSL-YAML file, creating a .bak backup first */
|
|
36
|
+
async write(filePath, entries) {
|
|
37
|
+
// Backup
|
|
38
|
+
if (existsSync(filePath)) {
|
|
39
|
+
const backupPath = `${filePath}.bak`;
|
|
40
|
+
await copyFile(filePath, backupPath);
|
|
41
|
+
logger.info('Backup created', { backupPath });
|
|
42
|
+
}
|
|
43
|
+
const doc = { references: entries };
|
|
44
|
+
const content = '---\n' + yaml.dump(doc, {
|
|
45
|
+
indent: 2,
|
|
46
|
+
lineWidth: -1,
|
|
47
|
+
noRefs: true,
|
|
48
|
+
quotingType: '"',
|
|
49
|
+
forceQuotes: false,
|
|
50
|
+
sortKeys: false,
|
|
51
|
+
});
|
|
52
|
+
await writeFile(filePath, content, 'utf-8');
|
|
53
|
+
logger.info('File written', { filePath, count: entries.length });
|
|
54
|
+
}
|
|
55
|
+
/** Get a single entry by ID */
|
|
56
|
+
async get(filePath, id) {
|
|
57
|
+
const entries = await this.read(filePath);
|
|
58
|
+
return entries.find((e) => e.id === id);
|
|
59
|
+
}
|
|
60
|
+
/** Check if an ID exists */
|
|
61
|
+
async exists(filePath, id) {
|
|
62
|
+
const entries = await this.read(filePath);
|
|
63
|
+
return entries.some((e) => e.id === id);
|
|
64
|
+
}
|
|
65
|
+
/** Add a new entry (appends to end) */
|
|
66
|
+
async add(filePath, entry) {
|
|
67
|
+
const entries = await this.read(filePath);
|
|
68
|
+
entries.push(entry);
|
|
69
|
+
await this.write(filePath, entries);
|
|
70
|
+
}
|
|
71
|
+
/** Update fields of an existing entry */
|
|
72
|
+
async update(filePath, id, fields) {
|
|
73
|
+
const entries = await this.read(filePath);
|
|
74
|
+
const index = entries.findIndex((e) => e.id === id);
|
|
75
|
+
if (index === -1)
|
|
76
|
+
throw new Error(`Entry '${id}' not found`);
|
|
77
|
+
entries[index] = { ...entries[index], ...fields, id };
|
|
78
|
+
await this.write(filePath, entries);
|
|
79
|
+
return entries[index];
|
|
80
|
+
}
|
|
81
|
+
/** Delete an entry by ID */
|
|
82
|
+
async delete(filePath, id) {
|
|
83
|
+
const entries = await this.read(filePath);
|
|
84
|
+
const filtered = entries.filter((e) => e.id !== id);
|
|
85
|
+
if (filtered.length === entries.length)
|
|
86
|
+
throw new Error(`Entry '${id}' not found`);
|
|
87
|
+
await this.write(filePath, filtered);
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
//# sourceMappingURL=store.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"store.js","sourceRoot":"","sources":["../../../src/providers/bib/store.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAC5D,OAAO,EAAE,UAAU,EAAE,M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AAM,EAAE,EAAE,EAAc,CAAC;QAClE,MAAM,IAAI,CAAC,KAAK,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;QACpC,OAAO,OAAO,CAAC,KAAK,CAAC,CAAC;IACxB,CAAC;IAED,4BAA4B;IAC5B,KAAK,CAAC,MAAM,CAAC,QAAgB,EAAE,EAAU;QACvC,MAAM,OAAO,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QAC1C,MAAM,QAAQ,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC;QACpD,IAAI,QAAQ,CAAC,MAAM,KAAK,OAAO,CAAC,MAAM;YAAE,MAAM,IAAI,KAAK,CAAC,UAAU,EAAE,aAAa,CAAC,CAAC;QACnF,MAAM,IAAI,CAAC,KAAK,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;IACvC,CAAC;CACF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/providers/bib/tools/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AACtC,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAGxC,MAAM,CAAC,MAAM,QAAQ,GAAqB,CAAC,GAAG,SAAS,EAAE,GAAG,UAAU,CAAC,CAAC"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
/** Shared file parameter — every bib tool needs this */
|
|
3
|
+
export const fileParam = z.string().describe('Absolute path to the CSL-YAML bibliography file. ' +
|
|
4
|
+
'Look for "bibliography:" in pandoc.yaml or the YAML frontmatter of .md files to find the path.');
|
|
5
|
+
export const readTools = [
|
|
6
|
+
{
|
|
7
|
+
name: 'bib:get',
|
|
8
|
+
description: 'Retrieve a single bibliography entry by ID. Returns the full YAML block.',
|
|
9
|
+
inputSchema: z.object({
|
|
10
|
+
file: fileParam,
|
|
11
|
+
id: z.string().describe('The citation ID (e.g., "BGH_I_ZR_73_79")'),
|
|
12
|
+
}),
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
name: 'bib:search',
|
|
16
|
+
description: 'Search bibliography entries across all fields: author, title, type, year, editor, container-title. Returns matching entries.',
|
|
17
|
+
inputSchema: z.object({
|
|
18
|
+
file: fileParam,
|
|
19
|
+
query: z.string().describe('Search term (case-insensitive, matches any field)'),
|
|
20
|
+
limit: z.number().optional().default(20).describe('Maximum results to return (default: 20)'),
|
|
21
|
+
}),
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
name: 'bib:list',
|
|
25
|
+
description: 'List all bibliography entries of a given CSL type (e.g., "legal_case", "book", "article-journal", "chapter").',
|
|
26
|
+
inputSchema: z.object({
|
|
27
|
+
file: fileParam,
|
|
28
|
+
type: z.string().describe('CSL type to filter by (e.g., "legal_case", "book", "article-journal")'),
|
|
29
|
+
limit: z.number().optional().default(50).describe('Maximum results to return (default: 50)'),
|
|
30
|
+
}),
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
name: 'bib:exists',
|
|
34
|
+
description: 'Check if a citation ID exists in the bibliography. Fast boolean check before citing.',
|
|
35
|
+
inputSchema: z.object({
|
|
36
|
+
file: fileParam,
|
|
37
|
+
id: z.string().describe('The citation ID to check'),
|
|
38
|
+
}),
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
name: 'bib:stats',
|
|
42
|
+
description: 'Get bibliography statistics: total entry count and breakdown by CSL type.',
|
|
43
|
+
inputSchema: z.object({
|
|
44
|
+
file: fileParam,
|
|
45
|
+
}),
|
|
46
|
+
},
|
|
47
|
+
];
|
|
48
|
+
//# sourceMappingURL=read.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"read.js","sourceRoot":"","sources":["../../../../src/providers/bib/tools/read.ts"],"names":[],"mappings":"AAAA,OAA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AE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,0BAA0B,CAAC;SACpD,CAAC;KACH;IACD;QACE,IAAI,EAAE,WAAW;QACjB,WAAW,EAAE,2EAA2E;QACxF,WAAW,EAAE,CAAC,CAAC,MAAM,CAAC;YACpB,IAAI,EAAE,SAAS;SAChB,CAAC;KACH;CACF,CAAC"}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { fileParam } from './read.js';
|
|
3
|
+
export const writeTools = [
|
|
4
|
+
{
|
|
5
|
+
name: 'bib:add',
|
|
6
|
+
description: 'Add a new bibliography entry. Validates required fields per CSL type, checks for duplicate IDs, ' +
|
|
7
|
+
'and creates a .bak backup before writing. Returns the created YAML block for confirmation.',
|
|
8
|
+
inputSchema: z.object({
|
|
9
|
+
file: fileParam,
|
|
10
|
+
entry: z.object({
|
|
11
|
+
id: z.string().describe('Unique citation ID (e.g., "BGH_I_ZR_42_22")'),
|
|
12
|
+
type: z.string().describe('CSL type (e.g., "legal_case", "book", "article-journal", "chapter")'),
|
|
13
|
+
title: z.string().optional().describe('Title of the work'),
|
|
14
|
+
author: z.array(z.object({
|
|
15
|
+
family: z.string(),
|
|
16
|
+
given: z.string().optional(),
|
|
17
|
+
})).optional().describe('Author(s)'),
|
|
18
|
+
editor: z.array(z.object({
|
|
19
|
+
family: z.string(),
|
|
20
|
+
given: z.string().optional(),
|
|
21
|
+
})).optional().describe('Editor(s)'),
|
|
22
|
+
issued: z.object({
|
|
23
|
+
'date-parts': z.array(z.array(z.number())).optional(),
|
|
24
|
+
}).optional().describe('Publication date, e.g., {"date-parts": [[2024]]}'),
|
|
25
|
+
'container-title': z.string().optional().describe('Journal, reporter, or book title'),
|
|
26
|
+
volume: z.string().optional(),
|
|
27
|
+
page: z.string().optional(),
|
|
28
|
+
publisher: z.string().optional(),
|
|
29
|
+
'publisher-place': z.string().optional(),
|
|
30
|
+
edition: z.string().optional(),
|
|
31
|
+
authority: z.string().optional().describe('Court name (for legal_case)'),
|
|
32
|
+
number: z.string().optional().describe('Case number or report number'),
|
|
33
|
+
genre: z.string().optional().describe('e.g., "Urt.", "Beschl."'),
|
|
34
|
+
url: z.string().optional(),
|
|
35
|
+
note: z.string().optional(),
|
|
36
|
+
}).passthrough().describe('The CSL-YAML entry to add'),
|
|
37
|
+
}),
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
name: 'bib:update',
|
|
41
|
+
description: 'Update fields of an existing bibliography entry. Only the specified fields are changed; ' +
|
|
42
|
+
'all other fields remain untouched. Creates a .bak backup before writing.',
|
|
43
|
+
inputSchema: z.object({
|
|
44
|
+
file: fileParam,
|
|
45
|
+
id: z.string().describe('The citation ID to update'),
|
|
46
|
+
fields: z.record(z.string(), z.unknown()).describe('Fields to update (e.g., {"url": "https://...", "page": "123"})'),
|
|
47
|
+
}),
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
name: 'bib:delete',
|
|
51
|
+
description: 'Remove a bibliography entry by ID. Creates a .bak backup before writing.',
|
|
52
|
+
inputSchema: z.object({
|
|
53
|
+
file: fileParam,
|
|
54
|
+
id: z.string().describe('The citation ID to delete'),
|
|
55
|
+
}),
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
name: 'bib:validate',
|
|
59
|
+
description: 'Validate the entire bibliography file: YAML syntax, required fields per CSL type, ' +
|
|
60
|
+
'duplicate IDs, and missing issued dates. Returns a list of errors and warnings.',
|
|
61
|
+
inputSchema: z.object({
|
|
62
|
+
file: fileParam,
|
|
63
|
+
}),
|
|
64
|
+
},
|
|
65
|
+
];
|
|
66
|
+
//# sourceMappingURL=write.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"write.js","sourceRoot":"","sources":["../../../../src/providers/bib/tools/write.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CA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ACH;IACD;QACE,IAAI,EAAE,YAAY;QAClB,WAAW,EAAE,0EAA0E;QACvF,WAAW,EAAE,CAAC,CAAC,MAAM,CAAC;YACpB,IAAI,EAAE,SAAS;YACf,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,2BAA2B,CAAC;SACrD,CAAC;KACH;IACD;QACE,IAAI,EAAE,cAAc;QACpB,WAAW,EACT,oFAAoF;YACpF,iFAAiF;QACnF,WAAW,EAAE,CAAC,CAAC,MAAM,CAAC;YACpB,IAAI,EAAE,SAAS;SAChB,CAAC;KACH;CACF,CAAC"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
export declare abstract class BaseError extends Error {
|
|
2
|
+
readonly cause?: Error | undefined;
|
|
3
|
+
abstract readonly code: string;
|
|
4
|
+
abstract readonly userMessage: string;
|
|
5
|
+
abstract readonly recoveryHint?: string;
|
|
6
|
+
constructor(message: string, cause?: Error | undefined);
|
|
7
|
+
toString(): string;
|
|
8
|
+
}
|
|
9
|
+
export declare class ValidationError extends BaseError {
|
|
10
|
+
readonly field?: string | undefined;
|
|
11
|
+
readonly code = "VALIDATION_ERROR";
|
|
12
|
+
readonly userMessage: string;
|
|
13
|
+
readonly recoveryHint: string;
|
|
14
|
+
constructor(message: string, field?: string | undefined, cause?: Error);
|
|
15
|
+
}
|
|
16
|
+
export declare class FileError extends BaseError {
|
|
17
|
+
readonly filePath: string;
|
|
18
|
+
readonly code = "FILE_ERROR";
|
|
19
|
+
readonly userMessage: string;
|
|
20
|
+
readonly recoveryHint: string;
|
|
21
|
+
constructor(message: string, filePath: string, cause?: Error);
|
|
22
|
+
}
|
|
23
|
+
export declare class NotFoundError extends BaseError {
|
|
24
|
+
readonly code = "NOT_FOUND";
|
|
25
|
+
readonly userMessage: string;
|
|
26
|
+
readonly recoveryHint = "Use bib:search or bib:list to find available entries.";
|
|
27
|
+
constructor(id: string);
|
|
28
|
+
}
|
|
29
|
+
export declare class DuplicateError extends BaseError {
|
|
30
|
+
readonly code = "DUPLICATE_ID";
|
|
31
|
+
readonly userMessage: string;
|
|
32
|
+
readonly recoveryHint = "Use a different ID or update the existing entry with bib:update.";
|
|
33
|
+
constructor(id: string);
|
|
34
|
+
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
export class BaseError extends Error {
|
|
2
|
+
cause;
|
|
3
|
+
constructor(message, cause) {
|
|
4
|
+
super(message);
|
|
5
|
+
this.cause = cause;
|
|
6
|
+
this.name = this.constructor.name;
|
|
7
|
+
Error.captureStackTrace(this, this.constructor);
|
|
8
|
+
}
|
|
9
|
+
toString() {
|
|
10
|
+
let msg = `${this.userMessage}\n\nError Code: ${this.code}`;
|
|
11
|
+
if (this.recoveryHint)
|
|
12
|
+
msg += `\n\nHow to fix: ${this.recoveryHint}`;
|
|
13
|
+
if (this.cause)
|
|
14
|
+
msg += `\n\nTechnical details: ${this.cause.message}`;
|
|
15
|
+
return msg;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
export class ValidationError extends BaseError {
|
|
19
|
+
field;
|
|
20
|
+
code = 'VALIDATION_ERROR';
|
|
21
|
+
userMessage;
|
|
22
|
+
recoveryHint;
|
|
23
|
+
constructor(message, field, cause) {
|
|
24
|
+
super(message, cause);
|
|
25
|
+
this.field = field;
|
|
26
|
+
this.userMessage = message;
|
|
27
|
+
this.recoveryHint = field ? `Check the '${field}' parameter.` : 'Check your input parameters.';
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
export class FileError extends BaseError {
|
|
31
|
+
filePath;
|
|
32
|
+
code = 'FILE_ERROR';
|
|
33
|
+
userMessage;
|
|
34
|
+
recoveryHint;
|
|
35
|
+
constructor(message, filePath, cause) {
|
|
36
|
+
super(message, cause);
|
|
37
|
+
this.filePath = filePath;
|
|
38
|
+
this.userMessage = message;
|
|
39
|
+
this.recoveryHint = `Check that '${filePath}' exists and is readable.`;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
export class NotFoundError extends BaseError {
|
|
43
|
+
code = 'NOT_FOUND';
|
|
44
|
+
userMessage;
|
|
45
|
+
recoveryHint = 'Use bib:search or bib:list to find available entries.';
|
|
46
|
+
constructor(id) {
|
|
47
|
+
super(`Entry '${id}' not found`);
|
|
48
|
+
this.userMessage = `Entry '${id}' not found in the bibliography.`;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
export class DuplicateError extends BaseError {
|
|
52
|
+
code = 'DUPLICATE_ID';
|
|
53
|
+
userMessage;
|
|
54
|
+
recoveryHint = 'Use a different ID or update the existing entry with bib:update.';
|
|
55
|
+
constructor(id) {
|
|
56
|
+
super(`Entry '${id}' already exists`);
|
|
57
|
+
this.userMessage = `Entry '${id}' already exists in the bibliography.`;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
//# sourceMappingURL=errors.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../../src/shared/errors.ts"],"names":[],"mappings":"AAAA,MAAM,OAAgB,SAAU,SAAQ,KAAK;IAKE;IAA7C,YAAY,OAAe,EAAkB,KAAa;QACxD,KAAK,CAAC,OAAO,CAAC,CAAC;QAD4B,UAAK,GAAL,KAAK,CAAQ;QAExD,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC;QAClC,KAAK,CAAC,iBAAiB,CAAC,IAAI,EAAE,IAAI,CAAC,WAAW,CAAC,CAAC;IAClD,CAAC;IAED,QAAQ;QACN,IAAI,GAAG,GAAG,GAAG,IAAI,CAAC,WAAW,mBAAmB,IAAI,CAAC,IAAI,EAAE,CAAC;QAC5D,IAAI,IAAI,CAAC,YAAY;YAAE,GAAG,IAAI,mBAAmB,IAAI,CAAC,YAAY,EAAE,CAAC;QACrE,IAAI,IAAI,CAAC,KAAK;YAAE,GAAG,IAAI,0BAA0B,IAAI,CAAC,KAAK,CAAC,OAAO,EAAE,CAAC;QACtE,OAAO,GAAG,CAAC;IACb,CA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AAW,GAAG,UAAU,EAAE,uCAAuC,CAAC;IACzE,CAAC;CACF"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export type LogContext = {
|
|
2
|
+
requestId?: string;
|
|
3
|
+
operation?: string;
|
|
4
|
+
file?: string;
|
|
5
|
+
duration?: number;
|
|
6
|
+
[key: string]: unknown;
|
|
7
|
+
};
|
|
8
|
+
export declare class Logger {
|
|
9
|
+
private context;
|
|
10
|
+
constructor(context?: LogContext);
|
|
11
|
+
child(additionalContext: LogContext): Logger;
|
|
12
|
+
debug(msg: string, context?: LogContext): void;
|
|
13
|
+
info(msg: string, context?: LogContext): void;
|
|
14
|
+
warn(msg: string, context?: LogContext): void;
|
|
15
|
+
error(msg: string, error?: Error | unknown, context?: LogContext): void;
|
|
16
|
+
}
|
|
17
|
+
export declare const rootLogger: Logger;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import pino from 'pino';
|
|
2
|
+
const level = process.env.LOG_LEVEL ?? 'info';
|
|
3
|
+
const logger = pino({
|
|
4
|
+
level,
|
|
5
|
+
transport: process.env.NODE_ENV !== 'production' ? {
|
|
6
|
+
target: 'pino-pretty',
|
|
7
|
+
options: {
|
|
8
|
+
colorize: true,
|
|
9
|
+
translateTime: 'SYS:standard',
|
|
10
|
+
ignore: 'pid,hostname',
|
|
11
|
+
destination: 2,
|
|
12
|
+
},
|
|
13
|
+
} : undefined,
|
|
14
|
+
}, pino.destination({ dest: 2, sync: false }));
|
|
15
|
+
export class Logger {
|
|
16
|
+
context;
|
|
17
|
+
constructor(context = {}) {
|
|
18
|
+
this.context = context;
|
|
19
|
+
}
|
|
20
|
+
child(additionalContext) {
|
|
21
|
+
return new Logger({ ...this.context, ...additionalContext });
|
|
22
|
+
}
|
|
23
|
+
debug(msg, context) {
|
|
24
|
+
logger.debug({ ...this.context, ...context }, msg);
|
|
25
|
+
}
|
|
26
|
+
info(msg, context) {
|
|
27
|
+
logger.info({ ...this.context, ...context }, msg);
|
|
28
|
+
}
|
|
29
|
+
warn(msg, context) {
|
|
30
|
+
logger.warn({ ...this.context, ...context }, msg);
|
|
31
|
+
}
|
|
32
|
+
error(msg, error, context) {
|
|
33
|
+
const errorContext = error instanceof Error
|
|
34
|
+
? { error: { message: error.message, stack: error.stack, name: error.name } }
|
|
35
|
+
: { error };
|
|
36
|
+
logger.error({ ...this.context, ...context, ...errorContext }, msg);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
export const rootLogger = new Logger();
|
|
40
|
+
//# sourceMappingURL=logger.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"logger.js","sourceRoot":"","sources":["../../src/shared/logger.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,MAAM,KAAK,GAAG,OAAO,CAAC,GAAG,CAAC,SAAS,IAAI,MAAM,CAAC;AAE9C,MAAM,MAAM,GAAG,IAAI,CAAC;IAClB,KAAK;IACL,SAAS,EAAE,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,YAAY,CAAC,CAAC,CAAC;QACjD,MAAM,EAAE,aAAa;QACrB,OAAO,EAAE;YACP,QAAQ,EAAE,IAAI;YACd,aAAa,EAAE,cAAc;YAC7B,MAAM,EAAE,cAAc;YACtB,WAAW,EAAE,CAAC;SACf;KACF,CAAC,CAAC,CAAC,SAAS;CACd,EAAE,IAAI,CAAC,WAAW,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC;AAU/C,MAAM,OAAO,MAAM;IACT,OAAO,CAAa;IAE5B,YAAY,UAAsB,EAAE;QAClC,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;IACzB,CAAC;IAED,KAAK,CAAC,iBAA6B;QACjC,OAAO,IAAI,MAAM,CAAC,EAAE,GAAG,IAAI,CAAC,OAAO,EAAE,GAAG,iBAAiB,EAAE,CAAC,CAAC;IAC/D,CAAC;IAED,KAAK,CAAC,GAAW,EAAE,OAAoB;QACrC,MAAM,CAAC,KAAK,CAAC,EAAE,GAAG,IAAI,CAAC,OAAO,EAAE,GAAG,OAAO,EAAE,EAAE,GAAG,CAAC,CAAC;IACrD,CAAC;IAED,IAAI,CAAC,GAAW,EAAE,OAAoB;QACpC,MAAM,CAAC,IAAI,CAAC,EAAE,GAAG,IAAI,CAAC,OAAO,EAAE,GAAG,OAAO,EAAE,EAAE,GAAG,CAAC,CAAC;IACpD,CAAC;IAED,IAAI,CAAC,GAAW,EAAE,OAAoB;QACpC,MAAM,CAAC,IAAI,CAAC,EAAE,GAAG,IAAI,CAAC,OAAO,EAAE,GAAG,OAAO,EAAE,EAAE,GAAG,CAAC,CAAC;IACpD,CAAC;IAED,KAAK,CAAC,GAAW,EAAE,KAAuB,EAAE,OAAoB;QAC9D,MAAM,YAAY,GAAG,KAAK,YAAY,KAAK;YACzC,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE,OAAO,EAAE,KAAK,CAAC,OAAO,EAAE,KAAK,EAAE,KAAK,CAAC,KAAK,EAAE,IAAI,EAAE,KAAK,CAAC,IAAI,EAAE,EAAE;YAC7E,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC;QACd,MAAM,CAAC,KAAK,CAAC,EAAE,GAAG,IAAI,CAAC,OAAO,EAAE,GAAG,OAAO,EAAE,GAAG,YAAY,EAAE,EAAE,GAAG,CAAC,CAAC;IACtE,CAAC;CACF;AAED,MAAM,CAAC,MAAM,UAAU,GAAG,IAAI,MAAM,EAAE,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
/** MCP tool definition with Zod input schema */
|
|
3
|
+
export interface ToolDefinition {
|
|
4
|
+
name: string;
|
|
5
|
+
description: string;
|
|
6
|
+
inputSchema: z.ZodTypeAny;
|
|
7
|
+
}
|
|
8
|
+
/** MCP tool result */
|
|
9
|
+
export interface ToolResult {
|
|
10
|
+
content: Array<{
|
|
11
|
+
type: string;
|
|
12
|
+
text: string;
|
|
13
|
+
}>;
|
|
14
|
+
isError?: boolean;
|
|
15
|
+
}
|
|
16
|
+
/** Provider interface — all tool providers must implement this */
|
|
17
|
+
export interface Provider {
|
|
18
|
+
readonly name: string;
|
|
19
|
+
getTools(): ToolDefinition[];
|
|
20
|
+
handleToolCall(toolName: string, args: Record<string, unknown>): Promise<ToolResult>;
|
|
21
|
+
initialize?(): Promise<void>;
|
|
22
|
+
shutdown(): Promise<void>;
|
|
23
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/shared/types.ts"],"names":[],"mappings":""}
|
package/package.json
ADDED
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@metaneutrons/doc-tools-mcp",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "MCP server for managing pandoc/CSL-YAML bibliographies",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"bin": {
|
|
7
|
+
"doc-tools-mcp": "dist/index.js"
|
|
8
|
+
},
|
|
9
|
+
"files": [
|
|
10
|
+
"dist",
|
|
11
|
+
"LICENSE",
|
|
12
|
+
"README.md"
|
|
13
|
+
],
|
|
14
|
+
"publishConfig": {
|
|
15
|
+
"registry": "https://npm.pkg.github.com"
|
|
16
|
+
},
|
|
17
|
+
"repository": {
|
|
18
|
+
"type": "git",
|
|
19
|
+
"url": "git+https://github.com/metaneutrons/doc-tools-mcp.git"
|
|
20
|
+
},
|
|
21
|
+
"bugs": {
|
|
22
|
+
"url": "https://github.com/metaneutrons/doc-tools-mcp/issues"
|
|
23
|
+
},
|
|
24
|
+
"homepage": "https://github.com/metaneutrons/doc-tools-mcp#readme",
|
|
25
|
+
"scripts": {
|
|
26
|
+
"build": "tsc",
|
|
27
|
+
"start": "node dist/index.js",
|
|
28
|
+
"dev": "tsc --watch",
|
|
29
|
+
"prepublishOnly": "npm run build",
|
|
30
|
+
"lint": "eslint src/",
|
|
31
|
+
"lint:fix": "eslint src/ --fix",
|
|
32
|
+
"test": "vitest run",
|
|
33
|
+
"test:watch": "vitest",
|
|
34
|
+
"test:coverage": "vitest run --coverage",
|
|
35
|
+
"prepare": "husky"
|
|
36
|
+
},
|
|
37
|
+
"engines": {
|
|
38
|
+
"node": ">=22.0.0"
|
|
39
|
+
},
|
|
40
|
+
"keywords": [
|
|
41
|
+
"mcp",
|
|
42
|
+
"bibliography",
|
|
43
|
+
"csl",
|
|
44
|
+
"yaml",
|
|
45
|
+
"pandoc",
|
|
46
|
+
"citations"
|
|
47
|
+
],
|
|
48
|
+
"author": {
|
|
49
|
+
"name": "Fabian Schmieder"
|
|
50
|
+
},
|
|
51
|
+
"license": "GPL-3.0",
|
|
52
|
+
"type": "module",
|
|
53
|
+
"lint-staged": {
|
|
54
|
+
"package.json": [
|
|
55
|
+
"npm audit --audit-level=moderate"
|
|
56
|
+
],
|
|
57
|
+
"*.ts": [
|
|
58
|
+
"eslint --fix",
|
|
59
|
+
"vitest related --run"
|
|
60
|
+
]
|
|
61
|
+
},
|
|
62
|
+
"dependencies": {
|
|
63
|
+
"@modelcontextprotocol/sdk": "^1.26.0",
|
|
64
|
+
"@types/node": "^22.0.0",
|
|
65
|
+
"js-yaml": "^4.1.0",
|
|
66
|
+
"pino": "^9.6.0",
|
|
67
|
+
"pino-pretty": "^13.0.0",
|
|
68
|
+
"zod": "^4.3.6"
|
|
69
|
+
},
|
|
70
|
+
"devDependencies": {
|
|
71
|
+
"@commitlint/cli": "^19.0.0",
|
|
72
|
+
"@commitlint/config-conventional": "^19.0.0",
|
|
73
|
+
"@eslint/js": "^9.0.0",
|
|
74
|
+
"@types/js-yaml": "^4.0.9",
|
|
75
|
+
"@typescript-eslint/eslint-plugin": "^8.0.0",
|
|
76
|
+
"@typescript-eslint/parser": "^8.0.0",
|
|
77
|
+
"@vitest/coverage-v8": "^3.0.0",
|
|
78
|
+
"eslint": "^9.0.0",
|
|
79
|
+
"husky": "^9.0.0",
|
|
80
|
+
"lint-staged": "^15.0.0",
|
|
81
|
+
"typescript": "^5.7.0",
|
|
82
|
+
"vitest": "^3.0.0"
|
|
83
|
+
}
|
|
84
|
+
}
|