New tools (8 → 12 total): - compare_versions(from, to): diff Claude Code releases between two versions, aggregating highlights and breaking changes across the range - get_threat(id): look up any CVE or attack technique (T-code) with full details, severity, mitigation, and source references - list_threats(category?): browse the threat database — summary table or detailed view by section (cves, authors, skills, techniques, mitigations, sources) - search_examples(query, limit?): semantic search across 199 templates with token-aware scoring and get_example() hints Infrastructure: - content.ts: add loadThreatDb() with memory cache and dual-mode loading (GUIDE_ROOT filesystem in dev, GitHub fetch in production) - Threat DB interface with correct Record<string, string> type for minimum_safe_versions Docs: - mcp-server/README.md: document all 12 tools with usage examples - mcp-server/IDEAS.md: future ideas (quiz, methodology, workflow, diff resource) - CHANGELOG.md: [Unreleased] entry for all 4 tools - README.md: promote MCP section to standalone ## after Quick Start (was ### inside Quick Start) - guide/architecture.md: add MCP server to Extended Tool Ecosystem Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
56 lines
2.1 KiB
TypeScript
56 lines
2.1 KiB
TypeScript
import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
import { registerSearchGuide } from './tools/search-guide.js';
|
|
import { registerReadSection } from './tools/read-section.js';
|
|
import { registerListTopics } from './tools/list-topics.js';
|
|
import { registerGetExample } from './tools/get-example.js';
|
|
import { registerChangelog } from './tools/changelog.js';
|
|
import { registerCheatsheet } from './tools/cheatsheet.js';
|
|
import { registerListExamples } from './tools/list-examples.js';
|
|
import { registerReleases } from './tools/releases.js';
|
|
import { registerCompareVersions } from './tools/compare-versions.js';
|
|
import { registerGetThreat, registerListThreats } from './tools/threats.js';
|
|
import { registerSearchExamples } from './tools/search-examples.js';
|
|
import { registerResources } from './resources/index.js';
|
|
import { registerPrompts } from './prompts/index.js';
|
|
import { loadReference, loadReleases, isDevMode } from './lib/content.js';
|
|
|
|
export function createServer(): McpServer {
|
|
const server = new McpServer({
|
|
name: 'claude-code-ultimate-guide',
|
|
version: '1.0.0',
|
|
});
|
|
|
|
// Pre-load YAML indexes into memory at startup
|
|
try {
|
|
const ref = loadReference();
|
|
const releases = loadReleases();
|
|
const mode = isDevMode() ? 'dev (local files)' : 'production (GitHub lazy fetch)';
|
|
process.stderr.write(
|
|
`[claude-code-guide] Loaded ${ref.entries.length} index entries | ${releases.releases.length} releases | mode: ${mode}\n`,
|
|
);
|
|
} catch (err) {
|
|
process.stderr.write(`[claude-code-guide] Warning: Failed to pre-load indexes: ${err}\n`);
|
|
}
|
|
|
|
// Register all tools
|
|
registerSearchGuide(server);
|
|
registerReadSection(server);
|
|
registerListTopics(server);
|
|
registerGetExample(server);
|
|
registerChangelog(server);
|
|
registerCheatsheet(server);
|
|
registerListExamples(server);
|
|
registerReleases(server);
|
|
registerCompareVersions(server);
|
|
registerGetThreat(server);
|
|
registerListThreats(server);
|
|
registerSearchExamples(server);
|
|
|
|
// Register resources
|
|
registerResources(server);
|
|
|
|
// Register prompts
|
|
registerPrompts(server);
|
|
|
|
return server;
|
|
}
|