Skip to main content
The Agent MCP Server is a standalone MCP endpoint that lets AI agents programmatically manage SMKRV MCP Studio configuration. Agents can create connections, build tools, deploy servers, and more — all through the standard MCP protocol.

Quick Start

1. Start Services

docker compose up -d

2. Set Service Token

Add STUDIO_AGENT_SERVICE_TOKEN to your .env file:
STUDIO_AGENT_SERVICE_TOKEN=your-strong-random-secret

3. Create an Agent Token

Open the Studio UI, navigate to Agent Access, click Create Token, enter a name and duration, then copy the generated token.

4. Connect Your MCP Client

{
  "mcpServers": {
    "smkrv-studio": {
      "url": "http://localhost:3000/agent-mcp/",
      "headers": {
        "Authorization": "Bearer smkr_..."
      }
    }
  }
}

Authentication Methods

Temporary Tokens

Best for interactive sessions, testing, and short-lived tasks.
PropertyValue
Duration15 minutes to 3 hours
Formatsmkr_<40-char-random>
RevocationInstant via UI or API
Include the token as a Bearer header:
Authorization: Bearer smkr_aBcDeFgHiJkLmNoPqRsTuVwXyZ0123456789abcd

OAuth2 Client Credentials

Best for automated pipelines, CI/CD, and long-running integrations.
PropertyValue
Idle Timeout15 minutes to 24 hours (sliding window)
Grant Typesclient_credentials, refresh_token
Step 1 — Create client (one-time): Create via the UI (Agent Access > OAuth2 Clients) or API. Save the client_id and client_secret — the secret is shown only once. Step 2 — Exchange credentials for tokens:
curl -X POST http://localhost:3000/agent-mcp/oauth/token \
  -H "Content-Type: application/x-www-form-urlencoded" \
  -d "grant_type=client_credentials&client_id=smkr_cl_...&client_secret=smkr_cs_..."
Step 3 — Use access token:
{
  "mcpServers": {
    "smkrv-studio": {
      "url": "http://localhost:3000/agent-mcp/",
      "headers": {
        "Authorization": "Bearer smkr_at_..."
      }
    }
  }
}
Step 4 — Refresh when expired:
curl -X POST http://localhost:3000/agent-mcp/oauth/token \
  -d "grant_type=refresh_token&refresh_token=smkr_rt_..."

Comparison

FeatureTemporary TokenOAuth2
SetupSingle stepCreate client + exchange
Max lifetime3 hours24 hours (idle)
Auto-renewalNoYes (refresh token)
Best forTesting, interactiveCI/CD, automation

MCP Client Configuration

Claude Code

{
  "mcpServers": {
    "smkrv-studio": {
      "url": "http://localhost:3000/agent-mcp/",
      "headers": {
        "Authorization": "Bearer smkr_..."
      }
    }
  }
}

Cursor

Add to .cursor/mcp.json:
{
  "mcpServers": {
    "smkrv-studio": {
      "url": "http://localhost:3000/agent-mcp/",
      "headers": {
        "Authorization": "Bearer smkr_..."
      }
    }
  }
}

Production (with SSL)

{
  "mcpServers": {
    "smkrv-studio": {
      "url": "https://agent.studio.example.com/",
      "headers": {
        "Authorization": "Bearer smkr_..."
      }
    }
  }
}

Tool Reference

All 37 tools return structured JSON. Pagination uses skip/limit parameters.

Connections (8 tools)

ToolDescription
list_connectionsList all database connections
get_connectionGet connection details
create_connectionCreate a new connection
update_connectionUpdate connection fields
delete_connectionDelete a connection
test_connectionTest database connectivity
list_tablesList tables in database schema
list_columnsList columns of a table

Tools (7 tools)

ToolDescription
list_toolsList MCP tools
get_toolGet tool with parameters
create_toolCreate a tool
update_toolUpdate a tool
delete_toolDelete a tool
duplicate_toolCreate a copy
preview_sqlExecute read-only SQL

Resources (5 tools)

ToolDescription
list_resourcesList MCP resources
get_resourceGet resource details
create_resourceCreate a resource
update_resourceUpdate a resource
delete_resourceDelete a resource

Prompts (5 tools)

ToolDescription
list_promptsList MCP prompts
get_promptGet prompt with template
create_promptCreate a prompt
update_promptUpdate a prompt
delete_promptDelete a prompt

Deploy (3 tools)

ToolDescription
deploy_serverGenerate code and start MCP server
stop_serverStop the running server
get_deploy_statusCheck server status

Export/Import (2 tools)

ToolDescription
export_configExport full configuration as JSON
import_configImport configuration

History (3 tools)

ToolDescription
list_historyList audit trail entries
get_entity_historyHistory for a specific entity
rollbackRollback to a previous snapshot

Monitoring (3 tools)

ToolDescription
get_metrics_statsPer-tool aggregate metrics
get_metrics_timeseriesTime-series data
get_queue_metricsRedis queue status

Flow (1 tool)

ToolDescription
get_flow_layoutComplete configuration snapshot

Rate Limiting

Each token is rate-limited to a configurable number of requests per minute (default: 120). Configure via STUDIO_AGENT_RATE_LIMIT env variable or Studio settings.

Activity Log

All agent tool calls are recorded in Redis with timestamp, token prefix, tool name, client IP, and success status. View in the UI on the Agent Access page or via GET /api/v1/agent-activity.

Security Best Practices

  1. Use short-lived tokens for testing (15-30 minutes)
  2. Rotate OAuth2 client secrets periodically
  3. Set a strong service token (STUDIO_AGENT_SERVICE_TOKEN)
  4. Monitor the activity log for unexpected patterns
  5. Use dedicated domains in production for better isolation
  6. Revoke tokens immediately when compromised

Environment Variables

VariableDefaultDescription
STUDIO_AGENT_SERVICE_TOKENShared secret for agent-mcp to backend auth
STUDIO_AGENT_RATE_LIMIT120Requests per minute per token
STUDIO_AGENT_MCP_PORT8090Agent MCP server port
STUDIO_LOG_LEVELINFOLogging level

Troubleshooting

Agent can’t connect

  • Verify the agent-mcp container is running: docker compose ps
  • Check health: curl http://localhost:3000/agent-mcp/health
  • Verify STUDIO_AGENT_SERVICE_TOKEN is set in both environments
  • Check logs: docker compose logs agent-mcp

Token rejected

  • Confirm the token hasn’t expired
  • Verify it hasn’t been revoked
  • Check rate limits

OAuth flow fails

  • Ensure client_id and client_secret are correct
  • Check the grant_type is client_credentials or refresh_token
  • Verify the OAuth client hasn’t been revoked

See Also