feat(mcp): MCP endpoint (/api/mcp) reusing chat tools + Bearer-key auth - #16
Closed
jcfrei wants to merge 1 commit into
Closed
feat(mcp): MCP endpoint (/api/mcp) reusing chat tools + Bearer-key auth#16jcfrei wants to merge 1 commit into
jcfrei wants to merge 1 commit into
Conversation
Exposes the ERP's fine-grained tool surface to LLM agents over MCP Streamable HTTP (JSON-RPC). Reuses build_tools() schemas + TOOL_HANDLERS (validated) and get_current_user (Bearer key acts as its user at the key's role), gated by rest_api_enabled. Role-scoped: viewer=read, manager=write, admin=delete; chat-session tools excluded. Registry-driven, so plugin doctypes/masters are exposed automatically. Settings shows the MCP URL + Claude/Codex config after key creation. tests/test_mcp.py (SQLite + Postgres in CI). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
jcfrei
added a commit
that referenced
this pull request
Jul 31, 2026
feat(mcp): MCP endpoint (/api/mcp) reusing chat tools + Bearer-key auth (#16) Fine-grained ERP tool surface for LLM agents over MCP Streamable HTTP. Reuses build_tools() + TOOL_HANDLERS (validated) and Bearer-key auth (key acts as its user at its role), gated by rest_api_enabled. Registry-driven → plugin doctypes exposed automatically. Settings shows MCP URL + Claude/Codex config. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Contributor
Author
|
Released as v0.6.12. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
A
POST /api/mcpendpoint exposing the ERP's fine-grained tool surface to LLM agents (Claude, Codex) over MCP's Streamable HTTP transport (JSON-RPC 2.0:initialize/tools/list/tools/call/ notifications).How it reuses everything
build_tools()— the live, plugin-widened tool list.TOOL_HANDLERS(so every write runsvalidate()).get_current_user— a Bearer API key acts as its user at the key's role, exactly like REST, gated by the samerest_api_enabledflag. No separate MCP credential.Role scoping (mirrors REST)
viewer = reads; manager = writes; admin =
delete_master. Enforced on bothtools/list(filtered) andtools/call(defence in depth). Chat-session-only tools are excluded.Modularity
The tool list is built from the live registries, so a plugin that registers doctypes/masters (e.g. the internal CRM's
lead/contact/activity) is exposed automatically — no MCP-specific code in the plugin. The endpoint lives in core; its surface composes from core + whatever plugins are loaded.Settings UX
Right after a key is created, the API-keys page shows the MCP URL (
<origin>/api/mcp) and ready-to-paste Claude and Codex config, noting the key's role governs access.Tests
tests/test_mcp.py— initialize, role-scopedtools/list, read + writetools/call, viewer write-denial, notifications, no-key rejection, unknown tool/method errors. SQLite + Postgres in CI.🤖 Generated with Claude Code