PromptRails

MCP Server

Connect coding assistants and MCP-compatible tools to your PromptRails workspace.

Best for

Engineers building against the API, SDKs, CLI, MCP, or local tooling

The MCP server lets external AI tools work with your PromptRails workspace. Instead of copying API calls by hand, a coding assistant can inspect agents, prompts, executions, traces, and other resources through a controlled local server.

This page is mainly for engineers setting up Claude Desktop, Cursor, Windsurf, or another MCP-compatible client.

PromptRails includes a built-in MCP (Model Context Protocol) server that exposes the full platform API as tools for AI-powered IDEs. This enables you to manage agents, execute prompts, review traces, and more directly from Claude Desktop, Cursor, Windsurf, or any MCP-compatible client.

What is the MCP Server?

The MCP server translates PromptRails API operations into MCP tools that AI assistants can invoke. When connected, your IDE's AI assistant can:

  • Create and manage agents, prompts, and data sources
  • Execute agents and view results
  • Browse execution traces and costs
  • Manage credentials, guardrails, and memories
  • Handle approval requests
  • Send chat messages
Technical detailsClient connection snippets

Connection Configuration

Claude Desktop

Add to your Claude Desktop configuration file (~/Library/Application Support/Claude/claude_desktop_config.json on macOS):

{
  "mcpServers": {
    "promptrails": {
      "command": "promptrails",
      "args": ["mcp", "serve"],
      "env": {
        "PROMPTRAILS_API_KEY": "your-api-key",
        "PROMPTRAILS_WORKSPACE_ID": "your-workspace-id",
        "PROMPTRAILS_API_URL": "https://api.promptrails.ai"
      }
    }
  }
}

Cursor

Add to your Cursor MCP settings (.cursor/mcp.json in your project root):

{
  "mcpServers": {
    "promptrails": {
      "command": "promptrails",
      "args": ["mcp", "serve"],
      "env": {
        "PROMPTRAILS_API_KEY": "your-api-key",
        "PROMPTRAILS_WORKSPACE_ID": "your-workspace-id",
        "PROMPTRAILS_API_URL": "https://api.promptrails.ai"
      }
    }
  }
}

Windsurf

Add to your Windsurf MCP configuration:

{
  "mcpServers": {
    "promptrails": {
      "command": "promptrails",
      "args": ["mcp", "serve"],
      "env": {
        "PROMPTRAILS_API_KEY": "your-api-key",
        "PROMPTRAILS_WORKSPACE_ID": "your-workspace-id",
        "PROMPTRAILS_API_URL": "https://api.promptrails.ai"
      }
    }
  }
}
Technical detailsAvailable MCP tool reference

Available Tools

The MCP server exposes tools across all major PromptRails resource categories:

Agents

ToolDescription
list_agentsList all agents in the workspace
get_agentGet agent details by ID
create_agentCreate a new agent
update_agentUpdate agent properties
delete_agentDelete an agent
execute_agentExecute an agent with input
list_agent_versionsList versions of an agent
create_agent_versionCreate a new agent version
promote_agent_versionPromote a version to current

Prompts

ToolDescription
list_promptsList all prompts
get_promptGet prompt details
create_promptCreate a new prompt
update_promptUpdate prompt properties
delete_promptDelete a prompt
execute_promptExecute a prompt
list_prompt_versionsList prompt versions
create_prompt_versionCreate a prompt version
promote_prompt_versionPromote a prompt version

Data Sources

ToolDescription
list_data_sourcesList data sources
get_data_sourceGet data source details
create_data_sourceCreate a data source
execute_data_sourceExecute a data source query

Chat

ToolDescription
list_sessionsList chat sessions
create_sessionCreate a chat session
send_messageSend a chat message

Credentials

ToolDescription
list_credentialsList credentials (masked)
create_credentialCreate a credential
validate_credentialTest a credential

MCP Tools

ToolDescription
list_mcp_toolsList MCP tools
create_mcp_toolCreate an MCP tool
update_mcp_toolUpdate an MCP tool
delete_mcp_toolDelete an MCP tool

Guardrails

ToolDescription
list_guardrailsList guardrails for an agent
create_guardrailAdd a guardrail to an agent
update_guardrailUpdate guardrail config
delete_guardrailRemove a guardrail

Memories

ToolDescription
list_memoriesList agent memories
create_memoryCreate a memory
search_memoriesSemantic memory search
delete_memoryDelete a memory

Approvals

ToolDescription
list_approvalsList approval requests
decide_approvalApprove or reject

Executions

ToolDescription
list_executionsList executions
get_executionGet execution details

Traces

ToolDescription
list_tracesList trace spans
get_traceGet span details

API Key Authentication

The MCP server authenticates using the same API keys used by the SDKs. The key's scopes determine which tools are available:

  • An API key with agents:read scope enables list_agents and get_agent
  • An API key with * scope enables all tools

Example Usage

Once connected, you can interact with PromptRails naturally through your IDE's AI assistant:

Technical detailsExample MCP assistant interaction
User: "List my agents"
Assistant: [calls list_agents] You have 5 agents:
1. Customer Support Bot (simple, active)
2. Data Pipeline (chain, active)
...

User: "Execute the Customer Support Bot with message 'What are your hours?'"
Assistant: [calls execute_agent] The agent responded:
"Our support hours are Monday-Friday, 9am-5pm EST..."
Cost: $0.002, Duration: 1.2s

User: "Show me the trace for that execution"
Assistant: [calls list_traces] The execution trace shows:
1. [agent] Customer Support Bot (1200ms)
   - [guardrail] prompt_injection scan (15ms) - OK
   - [prompt] Render main prompt (2ms)
   - [llm] gpt-4o call (1150ms, 340 tokens, $0.002)
   - [guardrail] pii output scan (8ms) - OK