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/mcpAuthentication
Set your API key as an environment variable:
export TENSORAS_API_KEY="tns_your_key_here"Quick Start
Run the MCP server:
tensoras-mcpThe server starts on stdio by default, ready for MCP client connections.
Available Tools
The MCP server exposes the following tools:
| Tool | Description |
|---|---|
tensoras_chat | Send a chat completion request |
tensoras_chat_with_rag | Chat with Knowledge Base retrieval |
tensoras_retrieve | Retrieve documents from a Knowledge Base |
tensoras_embed | Generate text embeddings |
tensoras_rerank | Rerank a list of documents |
tensoras_list_models | List available models |
tensoras_list_knowledge_bases | List Knowledge Bases |
tensoras_create_knowledge_base | Create 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_retrieveDocker
Run the MCP server in a Docker container:
docker run -e TENSORAS_API_KEY="tns_..." tensoras/mcp:latestFor 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
- Node.js SDK — full Tensoras Node.js client
- Python SDK — full Tensoras Python client
- RAG Overview — how Tensoras RAG works
- Tool Calling — how tool calling works in Tensoras