feat(TRUEREF-0011): implement MCP server with stdio transport
Adds a Model Context Protocol server that exposes resolve-library-id and query-docs tools via stdio, with tool schemas identical to context7 for drop-in compatibility with Claude Code, Cursor, and Zed. - src/mcp/index.ts — server entry point (io.github.trueref/trueref) - src/mcp/client.ts — HTTP client for TrueRef REST API (TRUEREF_API_URL) - src/mcp/tools/resolve-library-id.ts — library search tool handler - src/mcp/tools/query-docs.ts — documentation retrieval tool handler - src/mcp/index.test.ts — integration tests spawning real server subprocess - .claude/rules/trueref.md — Claude Code rule file for MCP usage - package.json: mcp:start script using tsx Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
11
.claude/rules/trueref.md
Normal file
11
.claude/rules/trueref.md
Normal file
@@ -0,0 +1,11 @@
|
||||
---
|
||||
description: Use TrueRef to retrieve documentation for indexed libraries
|
||||
alwaysApply: true
|
||||
---
|
||||
|
||||
When answering questions about indexed libraries, always use the TrueRef MCP tools:
|
||||
1. Call `resolve-library-id` with the library name and the user's question to get the library ID
|
||||
2. Call `query-docs` with the library ID and question to retrieve relevant documentation
|
||||
3. Use the returned documentation to answer the question accurately
|
||||
|
||||
Never rely on training data alone for library APIs that may have changed.
|
||||
Reference in New Issue
Block a user