- Role-Specific Context MCP Server
Role-Specific Context MCP Server
Content
Role-Specific Context MCP Server
A Model Context Protocol (MCP) server that defines and governs contextual boundaries based on agent roles in your system.
Overview
This MCP server enables role-based context management for AI agents, allowing you to:
- Establish clear instructions, objectives, and domain knowledge for each AI agent (Marketing Expert, Songwriter, Executive Assistant, etc.)
- Keep role-relevant memory partitioned and scoped, preventing cross-contamination between different agent roles
- Adapt tone and style dynamically (serious, witty, sarcastic) per role, with tone profiles baked into the prompt
Features
Role Management
- Create, update, and delete custom roles
- Pre-defined roles with specific expertise domains
- Role-specific system prompts and instructions
- Customizable tone profiles
Memory Management
- Role-specific memory storage
- Memory retrieval based on relevance to current query
- Time-to-live (TTL) for memories
- Memory limits per role
MCP Integration
- Exposes roles as MCP resources
- Provides tools for role management and query processing
- Offers prompts for role-based interactions
Getting Started
Prerequisites
- Node.js 18+
- OpenAI API key
Installation
# Clone the repository
git clone https://github.com/yourusername/role-context-mcp.git
cd role-context-mcp
# Install dependencies
npm install
# Set up environment variables
echo "OPENAI_API_KEY=your_api_key_here" > .env
# Build the project
npm run build
Running the Server
# Run the MCP server
npm start
# Run the HTTP server for testing
npm run start:http
Configuration
The server can be configured by modifying src/config.ts. Key configuration options include:
- Default roles and their properties
- Available tone profiles
- Memory management settings
- OpenAI model selection
MCP Integration
Resources
The server exposes the following resources:
role://{roleId}- Information about a specific rolerole://tones- Available tone profiles
Tools
The server provides the following tools:
process-with-role- Process a query using a specific rolecreate-role- Create a new roleupdate-role- Update an existing roledelete-role- Delete a custom rolechange-role-tone- Change the tone of a rolestore-memory- Store a memory for a specific roleclear-role-memories- Clear all memories for a role
Prompts
The server provides the following prompts:
role-{roleId}- Use a specific role to process a requestcreate-custom-role- Create a new custom role
Example Usage
Processing a Query with a Role (MCP)
// Example of using the process-with-role tool
const result = await client.executeToolRequest({
name: 'process-with-role',
parameters: {
roleId: 'marketing-expert',
query: 'How can I improve my social media engagement?',
customInstructions: 'Focus on B2B strategies'
}
});
Processing a Query with a Role (HTTP API)
// Example of using the HTTP API
const response = await axios.post('http://localhost:3000/process', {
roleId: 'marketing-expert',
query: 'How can I improve my social media engagement?',
customInstructions: 'Focus on B2B strategies'
});
console.log(response.data.response);
Creating a Custom Role
// Example of using the create-role tool
const result = await client.executeToolRequest({
name: 'create-role',
parameters: {
id: 'tech-writer',
name: 'Technical Writer',
description: 'Specializes in clear, concise technical documentation',
instructions: 'Create documentation that is accessible to both technical and non-technical audiences',
domains: ['technical-writing', 'documentation', 'tutorials'],
tone: 'technical',
systemPrompt: 'You are an experienced technical writer with expertise in creating clear, concise documentation for complex systems.'
}
});
License
MIT
Recommend Servers
TraeBuild with Free GPT-4.1 & Claude 3.7. Fully MCP-Ready.
EdgeOne Pages MCPAn MCP service designed for deploying HTML content to EdgeOne Pages and obtaining an accessible public URL.
CursorThe AI Code Editor
Amap Maps高德地图官方 MCP Server
Visual Studio Code - Open Source ("Code - OSS")Visual Studio Code
TimeA Model Context Protocol server that provides time and timezone conversion capabilities. This server enables LLMs to get current time information and perform timezone conversions using IANA timezone names, with automatic system timezone detection.
Playwright McpPlaywright MCP server
Howtocook Mcp基于Anduin2017 / HowToCook (程序员在家做饭指南)的mcp server,帮你推荐菜谱、规划膳食,解决“今天吃什么“的世纪难题;
Based on Anduin2017/HowToCook (Programmer's Guide to Cooking at Home), MCP Server helps you recommend recipes, plan meals, and solve the century old problem of "what to eat today"
MCP AdvisorMCP Advisor & Installation - Use the right MCP server for your needs
AiimagemultistyleA Model Context Protocol (MCP) server for image generation and manipulation using fal.ai's Stable Diffusion model.
Baidu Map百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Zhipu Web SearchZhipu Web Search MCP Server is a search engine specifically designed for large models. It integrates four search engines, allowing users to flexibly compare and switch between them. Building upon the web crawling and ranking capabilities of traditional search engines, it enhances intent recognition capabilities, returning results more suitable for large model processing (such as webpage titles, URLs, summaries, site names, site icons, etc.). This helps AI applications achieve "dynamic knowledge acquisition" and "precise scenario adaptation" capabilities.
Serper MCP ServerA Serper MCP Server
WindsurfThe new purpose-built IDE to harness magic
Jina AI MCP ToolsA Model Context Protocol (MCP) server that integrates with Jina AI Search Foundation APIs.
ChatWiseThe second fastest AI chatbot™
BlenderBlenderMCP connects Blender to Claude AI through the Model Context Protocol (MCP), allowing Claude to directly interact with and control Blender. This integration enables prompt assisted 3D modeling, scene creation, and manipulation.
Tavily Mcp
DeepChatYour AI Partner on Desktop
Y GuiA web-based graphical interface for AI chat interactions with support for multiple AI models and MCP (Model Context Protocol) servers.
MiniMax MCPOfficial MiniMax Model Context Protocol (MCP) server that enables interaction with powerful Text to Speech, image generation and video generation APIs.