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

MCP Server

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 workspace operations as tools for AI-powered IDEs. This enables you to manage prompts, run agents, 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
  • Find executions paused for human approval
  • 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

Prompts

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

Data Sources

ToolDescription
list_data_sourcesList data sources
get_data_sourceGet data source details
create_data_sourceCreate a data source
update_data_sourceUpdate a data source
delete_data_sourceDelete a data source
query_data_sourceExecute a data source query

Chat

ToolDescription
list_chat_sessionsList chat sessions
get_chat_sessionGet a chat session
create_chat_sessionCreate a chat session
delete_chat_sessionDelete a chat session
list_chat_messagesList session messages
send_chat_messageSend a chat message

Credentials

ToolDescription
list_credentialsList credentials (masked)
get_credentialGet credential metadata
create_credentialCreate a credential
update_credentialUpdate a credential
delete_credentialDelete a credential

MCP Templates

ToolDescription
list_mcp_templatesBrowse integration templates
get_mcp_templateGet a template by ID
get_mcp_template_by_slugGet a template by slug
install_mcp_templateInstall a configured workspace tool

MCP Tools

ToolDescription
list_mcp_toolsList MCP tools
get_mcp_toolGet MCP tool details
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

Executions

ToolDescription
list_executionsList executions
get_executionGet execution details

Traces

ToolDescription
list_tracesList trace spans
get_traceGet span details
get_trace_summarySummarize a trace

Scores

ToolDescription
list_scoresList scores
get_scoreGet score details
create_scoreCreate a score
delete_scoreDelete a score
get_score_aggregatesGet aggregate score metrics
list_score_configsList score configurations
create_score_configCreate a score configuration
delete_score_configDelete a score configuration

Approval-gated runs appear through list_executions with status waiting_approval. Decisions are made through the execution approval surface in PromptRails or the execution approve/deny API; the MCP server does not expose legacy approval-request tools.

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 (agent, active)
2. Data Pipeline (workflow, 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