MCP Server for Multi-File Task Management
Manage multi-file tasks with an efficient MCP server—budget-optimized, multi-format, searchable, real-time updates and safe TypeScript-backed operations
npx -y @flesler/mcp-tasksOverview
This MCP (Model Context Protocol) server provides a lightweight backend for managing multi-file tasks and the context that LLMs need to operate on them. It centralizes storage, indexing and retrieval for sets of files (code, docs, data), exposing a predictable API for adding, updating and querying task contexts. The server is designed to be budget-aware, reducing token and embedding costs by chunking and prioritizing context material based on relevance.
Beyond storage and search, the server supports real-time updates (so clients can subscribe to changes) and a TypeScript-backed execution endpoint that validates and safely runs small, typed operations against a task’s files. That makes it suitable for workflows like multi-file QA, codebase summarization, incremental editing and agentic workflows where contextual accuracy and cost control matter.
Features
- Multi-file task model: group related files under a single task identifier.
- Multi-format support: text, Markdown, code, JSON, CSV and other plain-text formats.
- Budget-optimized context: chunking and prioritization to minimize token/embedding usage.
- Searchable context: vector and text-search over chunks to retrieve relevant context for prompts.
- Real-time updates: subscribe to task changes (WebSocket/SSE) to reflect edits immediately.
- Safe TypeScript-backed operations: type-checked, sandboxed execution for file-aware transformations and queries.
- Multiple storage adapters: in-memory and disk-backed stores (pluggable).
- REST API and CLI-friendly endpoints for easy integration.
Installation / Configuration
Install from npm and run the server (example):
# Install (if published) or clone and install locally
# or if running from repo
# Start with default config
Environment variables (example):
# Port to listen on
MCP_PORT=8080
# Storage location (for disk adapter)
MCP_STORAGE_PATH=./data
# Embeddings provider config (optional)
EMBEDDINGS_PROVIDER=openai
EMBEDDINGS_API_KEY=sk-...
# Budget settings (tokens/requests)
MCP_MAX_TOKENS=2000
Example minimal configuration file (mcp.config.ts):
;
Available Resources
The server exposes multiple integration surfaces:
- REST API for CRUD operations on tasks and files.
- Search endpoint for text/vector queries against a task’s chunks.
- Real-time subscriptions via WebSocket or Server-Sent Events to get update notifications.
- TypeScript-backed endpoint for safe, typed operations against task data.
- CLI utilities for quick task creation, file imports, and local debugging.
Common endpoints (table):
| Method | Path | Purpose |
|---|---|---|
| POST | /tasks | Create a new task |
| GET | /tasks/:id | Get task metadata |
| POST | /tasks/:id/files | Upload or update a file |
| GET | /tasks/:id/files/:file | Download file contents |
| POST | /tasks/:id/search | Search (text or vector) |
| GET | /subscribe?taskId= | Subscribe to updates (WS/SSE) |
| POST | /tasks/:id/typescript | Run a typed operation against files |
Request and response payloads use JSON; file uploads accept multipart/form-data.
Use Cases
Multi-file Q&A for a repository
- Upload project files under a task. Use the search endpoint to fetch the most relevant chunks for a user question, then pass those chunks into an LLM. Real-time updates let the UI refresh context after edits.
Incremental code editing assistant
- Store code files and run TypeScript-backed checks or transformations that are type-checked before applying. The server ensures operations are sandboxed and only operate on the task’s files.
Budget-optimized summarization pipeline
- Configure chunk size and budget thresholds so long files are summarized first and only the most relevant chunks are embedded and sent to the model.
Data curation and review
- Import CSV/JSON files, index them as text chunks, and let reviewers query, annotate and patch entries while keeping a searchable audit trail.
Getting Started Tips
- Start with the disk storage adapter for persistence in development; switch to an in-memory store for ephemeral or test runs.
- Tune chunkSize and maxTokens to match your LLM pricing and latency tradeoffs.
- Use the TypeScript endpoint for safe, automated refactors or typed queries rather than letting client-provided code run on the server.
- Subscribe to real-time updates from clients to maintain a responsive editor or dashboard.
If you need to integrate with a specific embedding provider or vector store, the server was designed to allow swapping providers via configuration. Check the repo for adapter examples and tests to guide customization.