Role-Specific Context MCP Server

Role-Specific Context MCP Server

A Model Context Protocol server that enables role-based context management for AI agents, allowing users to establish specific instructions, maintain partitioned memory, and adapt tone for different agent roles in their system.

Chris-June

Developer Tools
Visit Server

README

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 role
  • role://tones - Available tone profiles

Tools

The server provides the following tools:

  • process-with-role - Process a query using a specific role
  • create-role - Create a new role
  • update-role - Update an existing role
  • delete-role - Delete a custom role
  • change-role-tone - Change the tone of a role
  • store-memory - Store a memory for a specific role
  • clear-role-memories - Clear all memories for a role

Prompts

The server provides the following prompts:

  • role-{roleId} - Use a specific role to process a request
  • create-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

Recommended Servers

playwright-mcp

playwright-mcp

A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.

Official
Featured
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.

Official
Featured
Local
TypeScript
MCP Package Docs Server

MCP Package Docs Server

Facilitates LLMs to efficiently access and fetch structured documentation for packages in Go, Python, and NPM, enhancing software development with multi-language support and performance optimization.

Featured
Local
TypeScript
Claude Code MCP

Claude Code MCP

An implementation of Claude Code as a Model Context Protocol server that enables using Claude's software engineering capabilities (code generation, editing, reviewing, and file operations) through the standardized MCP interface.

Featured
Local
JavaScript
@kazuph/mcp-taskmanager

@kazuph/mcp-taskmanager

Model Context Protocol server for Task Management. This allows Claude Desktop (or any MCP client) to manage and execute tasks in a queue-based system.

Featured
Local
JavaScript
Linear MCP Server

Linear MCP Server

Enables interaction with Linear's API for managing issues, teams, and projects programmatically through the Model Context Protocol.

Featured
JavaScript
mermaid-mcp-server

mermaid-mcp-server

A Model Context Protocol (MCP) server that converts Mermaid diagrams to PNG images.

Featured
JavaScript
Jira-Context-MCP

Jira-Context-MCP

MCP server to provide Jira Tickets information to AI coding agents like Cursor

Featured
TypeScript
Linear MCP Server

Linear MCP Server

A Model Context Protocol server that integrates with Linear's issue tracking system, allowing LLMs to create, update, search, and comment on Linear issues through natural language interactions.

Featured
JavaScript
Sequential Thinking MCP Server

Sequential Thinking MCP Server

This server facilitates structured problem-solving by breaking down complex issues into sequential steps, supporting revisions, and enabling multiple solution paths through full MCP integration.

Featured
Python