Context Processor
An MCP server for saving, managing, and enhancing context with pre-processing strategies like clarification, analysis, and search optimization.
README
Context Processor
⚠️ DISCLAIMER: This MCP server is entirely written and maintained by AI (Claude/Gemini) with manual supervision. It is a personal test project created to explore AI-assisted development. Use at your own discretion.
An intelligent Model Context Protocol (MCP) server for saving, managing, and enhancing context with pre-processing strategies. This server helps you organize information efficiently by applying smart transformations like clarification, analysis, and search optimization.
Features
-
Intelligent Context Storage: Save and organize contexts with metadata and tags
-
Pre-processing Strategies: Multiple configurable strategies to enhance context quality:
- Clarify: Improve content clarity by detecting and fixing ambiguous language
- Analyze: Comprehensive content analysis (word count, complexity, structure)
- Search: Extract keywords and enhance searchability
- Fetch: Detect and manage URLs and external data references
- Custom: Support for custom processing strategies
-
Context Models: Pre-configured models combining multiple strategies:
clarify: Focus on clarity improvementsearch_optimized: Optimize for searchabilityanalysis: Detailed content analysiscomprehensive: All strategies enabledweb_enhanced: For web content with URL handling
-
Context Management Tools:
- Save contexts with automatic or model-based processing
- Load contexts and discover related content
- List contexts with filtering by tags
- Delete contexts
- Query available models
Installation
npm install context-processor
Building
npm run build
Running
npm start
Or in development mode:
npm run dev
Configuration
Models Configuration
Create a context-models.json file in the project root to define custom models:
{
"models": [
{
"name": "my_model",
"description": "My custom context model",
"strategies": [
{
"name": "clarify",
"type": "clarify",
"enabled": true,
"config": {}
},
{
"name": "search",
"type": "search",
"enabled": true,
"config": {
"maxKeywords": 10
}
}
]
}
]
}
Available Tools
save_context
Save content as context with optional pre-processing.
Parameters:
title(string, required): Title for the contextcontent(string, required): Content to savetags(string[], optional): Tags for organizing contextmetadata(object, optional): Additional metadatamodelName(string, optional): Context model to use for pre-processing
Example:
{
"title": "API Documentation",
"content": "This is an API with multiple endpoints...",
"tags": ["api", "documentation"],
"metadata": { "version": "1.0" },
"modelName": "comprehensive"
}
load_context
Load a previously saved context and discover related contexts.
Parameters:
contextId(string, required): ID of the context to load
Response:
{
"context": { /* ContextItem */ },
"relatedContexts": [ /* ContextItem[] */ ]
}
list_contexts
List all saved contexts with optional filtering.
Parameters:
tags(string[], optional): Filter by tagslimit(number, optional): Maximum number of contextsoffset(number, optional): Number of contexts to skip
list_models
List all available context models.
Response:
{
"models": [
{
"name": "clarify",
"description": "Model focused on clarifying content",
"strategyCount": 1
}
],
"total": 5
}
get_model_info
Get detailed information about a specific model.
Parameters:
modelName(string, required): Name of the model
delete_context
Delete a context by ID.
Parameters:
contextId(string, required): ID of the context to delete
Processing Strategies
Clarify Strategy
Analyzes content for:
- Ambiguous pronouns (it, this, that)
- Passive voice usage
- Vague language (basically, kind of, sort of)
Provides a clarity score and suggestions for improvement.
Search Strategy
- Extracts 10 most frequent meaningful keywords
- Filters out common stop words
- Recommends search queries for the content
Analyze Strategy
Provides metrics:
- Word count and average word length
- Sentence and paragraph counts
- Content complexity assessment (low/medium/high)
Fetch Strategy
- Detects URLs in content
- Identifies up to 5 external references
- Metadata about data sources
Storage
Contexts are stored as JSON files in the ./contexts directory. Each context file is named using its UUID:
contexts/
├── a1b2c3d4-e5f6-7g8h-9i0j-1k2l3m4n5o6p.json
├── b2c3d4e5-f6g7-h8i9-j0k1-l2m3n4o5p6q.json
└── ...
Example Usage
Saving a context with comprehensive processing:
{
"title": "User Authentication Design",
"content": "The authentication system basically allows users to log in with their credentials. This approach is generally more secure than storing passwords in plain text. That said, the system needs better error handling.",
"tags": ["security", "authentication"],
"modelName": "comprehensive"
}
This will:
- Clarify the vague language
- Analyze the content structure
- Extract key topics (authentication, security, passwords, etc.)
- Save all results to context storage
Loading and discovering related contexts:
{
"contextId": "a1b2c3d4-e5f6-7g8h-9i0j-1k2l3m4n5o6p"
}
Returns the saved context plus up to 5 related contexts that share tags.
Architecture
ContextMCPServer
├── ContextStorage: File-based persistence
├── ContextPreprocessor: Strategy execution engine
└── MCP Protocol Handler: Tool definitions and execution
Data Flow
User Request
↓
MCP Server (Tool Handler)
↓
ContextPreprocessor (if model specified)
├─→ Strategy 1 (Clarify)
├─→ Strategy 2 (Analyze)
└─→ Strategy 3 (Search)
↓
ContextStorage (Save/Load)
↓
Response
Development
Type Definitions
All types are defined in src/types.ts:
ContextItem: Core context data structurePreProcessingStrategy: Strategy configurationContextModel: Model definition- Request/Response types for each tool
Adding Custom Strategies
- Define the strategy type in
types.ts - Add a handler method in
ContextPreprocessor - Add the strategy to a model in
context-models.json
Example:
private customStrategy(
content: string,
config?: Record<string, unknown>
): PreProcessingResult {
// Your custom logic here
return {
strategy: "custom",
processed: true,
result: transformedContent,
};
}
File Structure
.
├── src/
│ ├── index.ts # Main MCP server
│ ├── types.ts # Type definitions
│ ├── storage.ts # Context persistence
│ └── preprocessor.ts # Processing strategies
├── contexts/ # Stored contexts (auto-created)
├── dist/ # Compiled output
├── context-models.json # Model configurations
├── package.json # Dependencies
└── tsconfig.json # TypeScript config
Testing
Run the built-in tests:
npm test
Future Enhancements
- Database backend support (MongoDB, PostgreSQL)
- Vector embeddings for semantic search
- Machine learning-based categorization
- Multi-user context sharing
- Version control for contexts
- Integration with external APIs
- Real-time collaboration features
License
MIT
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。