feat: production MCP server with Israeli legislation (multi-source)
Complete production implementation with shell+adapter architecture, 13 MCP tools, SQLite FTS5 search, and multi-source ingestion pipeline. Ingestion fetches from UCI mirror, UNODC SHERLOC PDFs, and Knesset mobile PDFs (135 provisions, 33 definitions). 3 acts with full text, 7 acts metadata-only due to gov.il/nevo.co.il access restrictions. Knesset OData API used for metadata enrichment. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
55
src/tools/about.ts
Normal file
55
src/tools/about.ts
Normal file
@@ -0,0 +1,55 @@
|
||||
/**
|
||||
* about -- Server metadata, dataset statistics, and provenance.
|
||||
*/
|
||||
|
||||
import type Database from '@ansvar/mcp-sqlite';
|
||||
import { detectCapabilities, readDbMetadata } from '../capabilities.js';
|
||||
import { SERVER_NAME, SERVER_VERSION, REPOSITORY_URL } from '../constants.js';
|
||||
|
||||
export interface AboutContext {
|
||||
version: string;
|
||||
fingerprint: string;
|
||||
dbBuilt: string;
|
||||
}
|
||||
|
||||
function safeCount(db: InstanceType<typeof Database>, sql: string): number {
|
||||
try {
|
||||
const row = db.prepare(sql).get() as { count: number } | undefined;
|
||||
return row ? Number(row.count) : 0;
|
||||
} catch {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
export function getAbout(db: InstanceType<typeof Database>, context: AboutContext) {
|
||||
const caps = detectCapabilities(db);
|
||||
const meta = readDbMetadata(db);
|
||||
|
||||
return {
|
||||
server: SERVER_NAME,
|
||||
version: context.version,
|
||||
repository: REPOSITORY_URL,
|
||||
database: {
|
||||
fingerprint: context.fingerprint,
|
||||
built_at: context.dbBuilt,
|
||||
tier: meta.tier,
|
||||
schema_version: meta.schema_version,
|
||||
capabilities: [...caps],
|
||||
},
|
||||
statistics: {
|
||||
documents: safeCount(db, 'SELECT COUNT(*) as count FROM legal_documents'),
|
||||
provisions: safeCount(db, 'SELECT COUNT(*) as count FROM legal_provisions'),
|
||||
definitions: safeCount(db, 'SELECT COUNT(*) as count FROM definitions'),
|
||||
eu_documents: safeCount(db, 'SELECT COUNT(*) as count FROM eu_documents'),
|
||||
eu_references: safeCount(db, 'SELECT COUNT(*) as count FROM eu_references'),
|
||||
},
|
||||
data_source: {
|
||||
name: 'Knesset Legislation Database',
|
||||
authority: 'The Knesset (Israeli Parliament)',
|
||||
url: 'https://main.knesset.gov.il/Activity/Legislation',
|
||||
license: 'Government Open Data',
|
||||
jurisdiction: 'IL',
|
||||
languages: ['he', 'en'],
|
||||
},
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user