Skip to content
Menu

MCP

View .md

Beacon serves a Model Context Protocol (MCP) server at /beacon/mcp. Through it, AI assistants (Claude, Claude Desktop, Claude Code, Cursor, VS Code and any other MCP client) work with your data and your application under the same rules as people: they reach only the projects they are given, run read-only SQL only, see masked values only, and every call they make is audited.

Beacon’s MCP server over your databasesMCP gateway for your own application
Agents reachYour data: the catalog, documentation, read-only SQL, approved saved queries, and optionally your endpointsYour application: a set of its endpoints, run as the signed-in person, and its documents
Who connectsAPI keys with the Execute scope, limited to projects, or mapped Microsoft Entra callersYour application’s own users, signed in with Microsoft Entra (delegated tokens)
SQLYes, read-only, through the execution gateNone: no data sources, no SQL tools
PackageMoberg.Beacon.MCP on a full BeaconMoberg.Beacon.Gateway, about thirty lines of Program.cs
Start withConnect a coding agentMCP gateway for your application

Both run the same server, filters and audit. They combine: a full Beacon can expose host endpoints as tools, and a gateway host can add Beacon’s data product later.

Eight built-in tools, plus the ones you add. Every tool is published with a title and safety annotations, so clients can show what a call does before it runs.

ToolWhat it doesTypical use
get_contextProject overview: data sources, schemas, tables, documentation statusFirst call of a session
searchKeyword search over tables, columns and documentation, fused with semantic matching when local embeddings are on”Where do we keep refunds?”
get_documentationDocumentation at project, data-source or table levelReading what a table means
get_query_contextThe grounding ask uses: schema with join paths, glossary and verified examplesBefore an agent writes its own SQL
dry_runValidates SQL through every gate without running itChecking SQL before query
queryRuns read-only SQL against one data source, row-capped and maskedGetting the numbers
askAnswers a natural-language question: routing, grounded SQL generation, gated executionOne-shot business questions
feedbackRates an answer; a correct verdict becomes a verified example only after an Admin reviews itTeaching Beacon what good looks like
q_<name>An approved saved query published as a tool, with typed parametersRepeatable, reviewed reports
api_<name>One of your own HTTP endpoints, run as the caller through its own authorizationActions and reads in your application

The gateway serves your api_<name> tools plus get_context, search and get_documentation over your documents. Every tool, argument and limit is described on Server & tools.

flowchart LR
  C["MCP client<br/>Claude · Cursor · VS Code"] -->|"Bearer API key<br/>or Entra token"| A["Caller<br/>Execute scope<br/>no browser sessions"]
  A --> P["Project access<br/>evaluated on every call"]
  P --> T["Tool"]
  T --> G["SQL gate<br/>read-only · AST validator<br/>cross-database · row cap"]
  G --> X["Execution<br/>READ ONLY transaction<br/>statement timeout"]
  X --> M["PII masking"]
  M --> R["Result"]
  T -.-> AU[("MCP audit<br/>every call, refusals included")]
  • Credentials, not sessions. /beacon/mcp accepts an API key with the Execute scope or a mapped bearer token. A signed-in browser session gets 403; people try the tools in the MCP playground inside Beacon instead.
  • Projects are the boundary. The caller’s projects are decided on every call, so a revoked membership takes effect on the next call. A call that names a project outside them is refused, and the refusal is audited.
  • Read-only, enforced twice. Every statement passes the SQL execution gate, and PostgreSQL and MySQL also run it in a read-only transaction. Read-only enforcement and PII detection are deployment locks, on by default, that even an Admin cannot switch off at runtime.
  • Audited, including refusals. Every tool call is recorded with its caller, timing and outcome. What is kept (questions, SQL, error text) is a per-project setting that the host can pin.

The full model is on Security.

With an API key (sk-sem_…, Execute scope, created under API Keys in Beacon):

Terminal window
claude mcp add --transport http beacon https://beacon.example.com/beacon/mcp \
--header "Authorization: Bearer $BEACON_MCP_API_KEY"
ClientHow
Claude Code, Cursor, VS CodeAn API key in a header: Connect a coding agent
claude.ai, Claude Desktop, CoworkA custom connector that signs in with Microsoft Entra: Claude connector with Entra
Agent platforms and servicesEntra tokens mapped to user or system callers: Entra ID callers
Anything elseStreamable HTTP and JSON-RPC by hand: Connect AI clients

Then ask it something. Example prompts for the first session are in the prompt library.

You want agents toUse
Run a reviewed report with parameters, not free SQLSaved query tools
Call your application’s endpoints as the signed-in personHost endpoint tools, or the whole gateway
Understand your EF Core modelHost DbContext
Read your own Markdown documentationHost docs
Write better SQL from your glossary and verified examplesGrounding & knowledge base
Use fewer built-in tools, or other server instructionsAddBeaconMcp(x => …): see Connect AI clients
PackageFor
Moberg.Beacon.MCPThe MCP server on a full Beacon (AddBeaconMcp, MapBeaconMcp, MapMcpDiscovery)
Moberg.Beacon.GatewayThe MCP gateway for your own application (AddBeaconMcpGateway, UseBeaconMcpGateway, MapBeaconMcpGateway)
Moberg.Beacon.TestingTest tokens, test users and an MCP client for a gateway host’s tests
Moberg.Beacon.DoctorThe beacon-doctor .NET tool that checks a deployed endpoint