MCP Server

The Tensoras MCP (Model Context Protocol) server exposes Tensoras.ai capabilities as tools for AI agents. Use it with Claude Desktop, Cursor, or any MCP-compatible client.

Installation

npm install -g @tensoras/mcp

Authentication

Set your API key as an environment variable:

export TENSORAS_API_KEY="tns_your_key_here"

Quick Start

Run the MCP server:

tensoras-mcp

The server starts on stdio by default, ready for MCP client connections.

Available Tools

The MCP server exposes the following tools:

ToolDescription
tensoras_chatSend a chat completion request
tensoras_chat_with_ragChat with Knowledge Base retrieval
tensoras_retrieveRetrieve documents from a Knowledge Base
tensoras_embedGenerate text embeddings
tensoras_rerankRerank a list of documents
tensoras_list_modelsList available models
tensoras_list_knowledge_basesList Knowledge Bases
tensoras_create_knowledge_baseCreate a new Knowledge Base

tensoras_chat

Send a chat completion request to any Tensoras model:

{
  "name": "tensoras_chat",
  "arguments": {
    "model": "llama-3.3-70b",
    "messages": [
      { "role": "user", "content": "What is RAG?" }
    ],
    "temperature": 0.7,
    "max_tokens": 512
  }
}

tensoras_chat_with_rag

Chat with automatic retrieval from Knowledge Bases:

{
  "name": "tensoras_chat_with_rag",
  "arguments": {
    "model": "llama-3.3-70b",
    "messages": [
      { "role": "user", "content": "How do I configure SSO?" }
    ],
    "knowledge_base_ids": ["kb_a1b2c3d4"]
  }
}

tensoras_retrieve

Retrieve relevant documents without generating a response:

{
  "name": "tensoras_retrieve",
  "arguments": {
    "knowledge_base_id": "kb_a1b2c3d4",
    "query": "password reset instructions",
    "top_k": 5
  }
}

Claude Desktop Configuration

Add the Tensoras MCP server to your Claude Desktop configuration.

macOS

Edit ~/Library/Application Support/Claude/claude_desktop_config.json:

{
  "mcpServers": {
    "tensoras": {
      "command": "tensoras-mcp",
      "env": {
        "TENSORAS_API_KEY": "tns_your_key_here"
      }
    }
  }
}

Windows

Edit %APPDATA%\Claude\claude_desktop_config.json:

{
  "mcpServers": {
    "tensoras": {
      "command": "tensoras-mcp",
      "env": {
        "TENSORAS_API_KEY": "tns_your_key_here"
      }
    }
  }
}

After saving the configuration, restart Claude Desktop. The Tensoras tools will appear in the tools menu.

Cursor Configuration

Add the MCP server to your Cursor settings. Open .cursor/mcp.json in your project root:

{
  "mcpServers": {
    "tensoras": {
      "command": "tensoras-mcp",
      "env": {
        "TENSORAS_API_KEY": "tns_your_key_here"
      }
    }
  }
}

Programmatic Usage

Use the MCP server programmatically with the MCP SDK:

import { Client } from "@modelcontextprotocol/sdk/client/index.js";
import { StdioClientTransport } from "@modelcontextprotocol/sdk/client/stdio.js";
 
const transport = new StdioClientTransport({
  command: "tensoras-mcp",
  env: {
    TENSORAS_API_KEY: "tns_your_key_here",
  },
});
 
const client = new Client({ name: "my-app", version: "1.0.0" });
await client.connect(transport);
 
// List available tools
const tools = await client.listTools();
console.log(tools);
 
// Call a tool
const result = await client.callTool({
  name: "tensoras_chat",
  arguments: {
    model: "llama-3.3-70b",
    messages: [
      { role: "user", content: "What is retrieval-augmented generation?" },
    ],
  },
});
 
console.log(result.content[0].text);

Custom Configuration

Pass options when starting the server:

# Custom API base URL
TENSORAS_BASE_URL="http://localhost:8000/v1" tensoras-mcp
 
# Verbose logging
tensoras-mcp --verbose
 
# Restrict available tools
tensoras-mcp --tools tensoras_chat,tensoras_retrieve

Docker

Run the MCP server in a Docker container:

docker run -e TENSORAS_API_KEY="tns_..." tensoras/mcp:latest

For Claude Desktop, configure with the Docker command:

{
  "mcpServers": {
    "tensoras": {
      "command": "docker",
      "args": ["run", "-i", "--rm", "-e", "TENSORAS_API_KEY=tns_...", "tensoras/mcp:latest"]
    }
  }
}

Next Steps