The MCP Conversation Server provides a standardized interface for applications to interact with OpenRouter's language models through a unified conversation management system, supporting features like conversation tracking, real-time streaming, and persistence.
Install the package using npm:
npm install mcp-conversation-server
The server requires configuration via a YAML file. Create or update config/models.yaml
with your settings:
# MCP Server Configuration
openRouter:
apiKey: "YOUR_OPENROUTER_API_KEY" # Replace with your actual OpenRouter API key
persistence:
path: "./conversations" # Directory for storing conversation data
models:
# Define your models here
'provider/model-name':
id: 'provider/model-name'
contextWindow: 123456
streaming: true
temperature: 0.7
description: 'Model description'
# Default model to use if none specified
defaultModel: 'provider/model-name'
In your application, load the configuration file:
const config = await loadModelsConfig(); // Loads settings from 'config/models.yaml'
Create and run the server with your configuration:
import { ConversationServer } from 'mcp-conversation-server';
const server = new ConversationServer(config);
server.run().catch(console.error);
The MCP Conversation Server exposes several tools for interacting with language models:
Use the create-conversation tool:
{
provider: 'openrouter', // Provider is always 'openrouter'
model: string, // OpenRouter model ID (e.g., 'anthropic/claude-3-opus-20240229')
title?: string; // Optional conversation title
}
Use the send-message tool:
{
conversationId: string; // Conversation ID
content: string; // Message content
stream?: boolean; // Enable streaming responses
}
Use the list-conversations tool:
{
filter?: {
model?: string; // Filter by model
startDate?: string; // Filter by start date
endDate?: string; // Filter by end date
}
}
The server provides access to resources for retrieving information:
Access individual conversation data via conversation://{id}
to view:
Access conversation://list
to:
If you experience connection problems:
For streaming problems:
If persistence fails:
There are two ways to add an MCP server to Cursor. The most common way is to add the server globally in the ~/.cursor/mcp.json
file so that it is available in all of your projects.
If you only need the server in a single project, you can add it to the project instead by creating or adding it to the .cursor/mcp.json
file.
To add a global MCP server go to Cursor Settings > MCP and click "Add new global MCP server".
When you click that button the ~/.cursor/mcp.json
file will be opened and you can add your server like this:
{
"mcpServers": {
"cursor-rules-mcp": {
"command": "npx",
"args": [
"-y",
"cursor-rules-mcp"
]
}
}
}
To add an MCP server to a project you can create a new .cursor/mcp.json
file or add it to the existing one. This will look exactly the same as the global MCP server example above.
Once the server is installed, you might need to head back to Settings > MCP and click the refresh button.
The Cursor agent will then be able to see the available tools the added MCP server has available and will call them when it needs to.
You can also explictly ask the agent to use the tool by mentioning the tool name and describing what the function does.