Skip to content

[Enh]: add --mcp-stdio flag to dab start #2890

@JerryNixon

Description

@JerryNixon

What

  1. Allow dab start to switch the MCP protocol to stdio
  2. Add support for setting the context permissions role

Note

The default protocol for MCP in DAB is HTTP. Using this command line switch, we can change the protocol to STDIO. This aligns nicely to how local MCP servers are invoked via command line through files like mcp.json in VS Code.

Why

  1. Local stdio support makes debugging the DAB MCP server easier
  2. With stdio, developers can run DAB as a local MCP server

A sample VS Code mcp.json file

{
  "name": "data-api-builder",
  "command": "dab",
  "args": [
    "start",
    "--mcp-stdio",
    "role:authenticated",
    "--config",
    "dab-config.json"
  ]
}

How

Add the --mcp-stdio flag

Example command:

dab start --mcp-stdio role:anonymous

Important

Any value after the role: prefix is used as the permissions role for stdio. The reason for this behavior is because HTTP headers are not part of stdio. Arbitrarily setting the role for the calling user is ONLY supported in DAB when authentication.provider is set to Simulator in the DAB configuration. As a result, using this command line switch will auto-set the authentication.provider to Simulator (in memory) for this session only.

  1. --mcp-stdio switches the MCP protocol to stdio while starting DAB normally
  2. The optional role:anonymous value forces the MCP permissions role
  3. Auto-set authentication.provider to Simulator with this switch.

Behavior

  1. Without the flag, the MCP server defaults to http
  2. If no value is provided, the MCP server defaults to the anonymous role
  3. REST and GraphQL endpoints are unaffected
  4. http behavior of the MCP endpoint is unaffected

Metadata

Metadata

Assignees

Projects

Status

Review In Progress

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions