Skip to content

Adds an MCP sidecar for TrailBase with Docker/Portainer support and a documented release flow.#262

Open
brigon-dev wants to merge 19 commits into
trailbaseio:mainfrom
brigon-dev:trailbase-mcp
Open

Adds an MCP sidecar for TrailBase with Docker/Portainer support and a documented release flow.#262
brigon-dev wants to merge 19 commits into
trailbaseio:mainfrom
brigon-dev:trailbase-mcp

Conversation

@brigon-dev

Copy link
Copy Markdown

What’s included

  • MCP server for TrailBase admin/runtime info
  • Record API CRUD, list, schema, and file upload/download support
  • Generic TrailBase HTTP request tool for custom/WASM/auth endpoints
  • TrailBase OpenAPI operation catalog and call-by-operation-id support
  • Login/password startup flow for Portainer quick start
  • Auth token + refresh token support
  • Safe table teardown helper that removes Record API config before dropping a table
  • Docker Hub documentation and 0.3 release metadata

Validation

  • pytest mcp
  • docker build -t frostbite4456/trailbase-mcp:0.3 mcp

Notes

  • The MCP endpoint is served over HTTP and expects text/event-stream clients.
  • Long-running SSE subscription endpoints are cataloged but not proxied as a normal request/response MCP tool.

@ignatz ignatz left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks jumping into the cold water - much appreciated 🙏

To reduce churn, maybe its best if first work out some of the highlevel questions.

Comment thread .cargo/config.toml
CLANG_PATH = { value = "./.dev-tools/libclang-18/usr/bin/clang-18", relative = true }
PKG_CONFIG_PATH = { value = "./.dev-tools/geos/usr/lib/x86_64-linux-gnu/pkgconfig", relative = true }
PKG_CONFIG_SYSROOT_DIR = { value = "./.dev-tools/geos", relative = true }
PROTOC = { value = "./.cargo/protoc-wrapper.sh", relative = true }

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm going to assume that his is an artifact

Comment thread .cargo/protoc-wrapper.sh
export LD_LIBRARY_PATH="${PROTOBUF_DIR}/usr/lib/x86_64-linux-gnu${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}"
exec "${PROTOBUF_DIR}/usr/bin/protoc" \
-I"${PROTOBUF_DIR}/usr/include" \
"$@"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as above?

Comment thread README.md
```sh
scripts/bootstrap-local-dev-tools.sh
cargo check --workspace --all-targets
```

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, so the above files are not artifacts.

This is a bit surprising since, I would expect most devs to have access to their machines (seems like a reasonable requirement). Otherwise, this is also very deb centric. If you don't have full access, wouldn't one rather develop inside a container? Would love to hear more about the reasoning.

"summary": "Exchange authorization code for auth tokens.",
"mcp_support": "call_trailbase_api_operation or trailbase_request",
"requires_write_permission": True,
},

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just guessing, wouldn't the MCP also need a POST request definition?

from typing import Any
from urllib.parse import quote

TRAILBASE_API_OPERATIONS: tuple[dict[str, Any], ...] = (

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm a bit worried that this will get out of sync. Naively, I would have expected the MCP implementation to be part of the main binary running in some dev mode.

from urllib.parse import quote

TRAILBASE_API_OPERATIONS: tuple[dict[str, Any], ...] = (
{

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm also a bit surprised over the selection of methods. Naively, I would have expected only or mostly admin APIs to be used in dev mode basically as an alternative to the dashboard. Isn't exposing only the public APIs with access protection inherently limiting maybe even useless for dev tasks.

As an example, i would have expected this to be used to drive schema changes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants