Prem AI MCP server

Provides direct access to Prem AI's chat completions and RAG capabilities through tools for chat interactions, document uploads, and template-based prompting for knowledge retrieval and contextual responses.
Back to servers
Provider
Sayantan Das
Release date
Mar 22, 2025
Language
TypeScript

Prem MCP Server is a Model Context Protocol implementation for Prem AI that enables seamless integration with Claude and other MCP-compatible clients. It provides features like chat completions, RAG support, document management, templates, and streaming responses through a standard interface.

Prerequisites

  • Node.js (v16 or higher)
  • A Prem AI account with API key
  • A Prem project ID

Installation

Via Smithery

For automatic installation with Claude Desktop:

npx -y @smithery/cli install @ucalyptus/prem-mcp-server --client claude

Manual Installation

# Using npm
npm install prem-mcp-server

# Using yarn
yarn add prem-mcp-server

# Using pnpm
pnpm add prem-mcp-server

Configuration

Environment Variables

Create a .env file in your project root:

PREM_API_KEY=your_api_key_here
PREM_PROJECT_ID=your_project_id_here

Cursor Configuration

Add the following to your ~/.cursor/mcp.json:

{
  "mcpServers": {
    "PremAI": {
      "command": "node",
      "args": ["/path/to/your/prem-mcp/build/index.js", "--stdio"],
      "env": {
        "PREM_API_KEY": "your_api_key_here",
        "PREM_PROJECT_ID": "your_project_id_here"
      }
    }
  }
}

Claude Desktop Configuration

Add to your claude_desktop_config.json:

{
  "mcpServers": {
    "PremAI": {
      "command": "npx",
      "args": ["prem-mcp-server", "--stdio"],
      "env": {
        "PREM_API_KEY": "your_api_key_here",
        "PREM_PROJECT_ID": "your_project_id_here"
      }
    }
  }
}

Usage

Starting the Server

npx prem-mcp-server

Example Prompts

  1. Basic Chat

    Let's have a conversation about artificial intelligence.
    
  2. RAG with Documents

    Based on the documents in repository XYZ, what are the key points about [topic]?
    
  3. Using Templates

    Use template ABC to generate [specific type of content].
    

Document Management

The server supports uploading documents to Prem AI repositories for RAG operations. Supported formats:

  • .txt
  • .pdf
  • .docx

API Parameters

Chat Completion Parameters

  • query: The input text
  • system_prompt: Custom system prompt
  • model: Model identifier
  • temperature: Response randomness (0-1)
  • max_tokens: Maximum response length
  • repository_ids: Array of repository IDs for RAG
  • similarity_threshold: Threshold for document similarity
  • limit: Maximum number of document chunks

Template Parameters

  • template_id: ID of the prompt template
  • params: Template-specific parameters
  • temperature: Response randomness (0-1)
  • max_tokens: Maximum response length

Troubleshooting

Common Issues

  1. Server Not Found

    • Verify the server path in claude_desktop_config.json
    • Check if the server is running
  2. API Key Invalid

    • Ensure your Prem AI API key is valid
    • Check if the API key has the required permissions
  3. Document Upload Failed

    • Verify file format is supported
    • Check file permissions
    • Ensure repository ID is correct

How to add this MCP server to Cursor

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.

Adding an MCP server to Cursor globally

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"
            ]
        }
    }
}

Adding an MCP server to a project

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.

How to use the MCP server

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.

Want to 10x your AI skills?

Get a free account and learn to code + market your apps using AI (with or without vibes!).

Nah, maybe later