How yugaaank/needle-mcp works
Needle MCP exposes local Needle-model capabilities as read-only MCP tools over stdio. A client lists tools or calls one; the server dispatches extraction, classification, summarization, tool selection/ranking, and context filtering, returning structured JSON. Startup prepares the platform engine, and repeated identical requests use a local SQLite cache. The README documents chunking, JSON repair, and local-only operation; those details are not all visible in the sampled implementation, so their internal wiring is not asserted here.
Main entry points: mcp.py Tool dispatch · cache.py Response cache
Components 14
MCP interface
- Stdio MCP server
src/needle_mcp/mcp.py - Tool dispatch
src/needle_mcp/mcp.py
Local inference
- Engine setup
src/needle_mcp/mcp.py - Needle inference
Tool capabilities
- Structured extraction
src/needle_mcp/mcp.py - Classification
src/needle_mcp/mcp.py - Summarization
src/needle_mcp/mcp.py - Tool calling
src/needle_mcp/mcp.py - Tool ranking
src/needle_mcp/mcp.py - Context filtering
src/needle_mcp/mcp.py - JSON repair
src/needle_mcp/mcp.py
Local state
- Response cache
src/needle_mcp/cache.py
Other components
- MCP client
- Needle engine wheel
Connections 17
- MCP client → Stdio MCP server: sends MCP requests
README.md - Stdio MCP server → Tool dispatch: dispatches calls
src/needle_mcp/mcp.py - Stdio MCP server → Engine setup: prepares at startup
README.md - Engine setup → Needle engine wheel: downloads or reuses
README.md - Tool dispatch → Structured extraction: handles tool
README.md - Tool dispatch → Classification: handles tool
README.md - Tool dispatch → Summarization: handles tool
README.md - Tool dispatch → Tool calling: handles tool
README.md - Tool dispatch → Tool ranking: handles tool
README.md - Tool dispatch → Context filtering: handles tool
README.md - Structured extraction → Needle inference: runs inference
src/needle_mcp/mcp.py - Classification → Needle inference: runs inference
src/needle_mcp/mcp.py - Summarization → Needle inference: runs inference
src/needle_mcp/mcp.py - Tool calling → Needle inference: runs inference
- Context filtering → Needle inference: selects relevant chunks
- Tool dispatch → Response cache: reads and writes
src/needle_mcp/mcp.py - Tool dispatch → JSON repair: repairs JSON
src/needle_mcp/mcp.py