← Back to directory
B

BGTS Context Engine

Community
Deterministic code graph context for AI coding agents.
Category
Dev Tools #357 of 751
Stars
★ 180 Popular
Transport
stdio (local process)
Runtime
Python · Docker
Credentials
No credential needed
License
MIT
Last commit
Tools
2
51FMRS · D

This is a code graph context server for AI coding agents, offering an stdio MCP interface backed by PostgreSQL, Apache AGE, and pgvector. It suits developers who can manage a database and code index and want deterministic code retrieval. Two read-only tools are enabled by default; the server has no built-in authentication, and repository scope enforcement applies only to some endpoints.

Strongest · Documentation 14/20 Weakest · Reliability 7/20

Reliability
7/20
Security and permissions
7/20
Maintenance
11/20
Documentation
14/20
Setup experience
12/20
Why each score
Reliability 7/20
The README and manifest describe stdio startup, default and optional tool sets, and PostgreSQL configuration, but these are unverified claims. No server implementation, CI workflow, or test contents were available to confirm initialization, tool behavior, or error handling. The score therefore reflects only limited plausibility.
Security and permissions 7/20
The materials describe database credentials configured through environment variables and marked as secrets, and disclose that the Jev selector sends task text and code excerpts to a third party. The README also says the service has no built-in authentication and that user-level repository scoping is not applied on every layer, recommending deployment behind a proxy. With no source to inspect access controls, data flows, or side effects, deductions are warranted; the supplied material does not establish a red-line condition.
Maintenance 11/20
The supplied metadata says the project is not archived, has 180 stars and 22 open issues, and declares an MIT license. The README mentions contribution guidance, a roadmap, and a private vulnerability reporting channel. There is no evidence here about commit history, release cadence, issue response, dependency updates, or actual security-response practices, so sustained maintenance cannot be established.
Documentation 14/20
The README provides a quick start, configuration examples for several mainstream clients, environment-variable descriptions, retrieval behavior, limitations, and benchmark caveats. It also states that the benchmark task set is not yet public and identifies a scope-enforcement gap. Points are deducted because complete tool parameters and error behavior are not verifiable from the supplied source, and the documented capabilities and data handling cannot be checked against implementation.
Setup experience 12/20
The materials give steps for installation, migration, indexing, and MCP connection, with configuration examples for Cursor, VS Code, Claude, OpenCode, Codex, and Copilot. Users must prepare PostgreSQL 16 with Apache AGE and pgvector, and the supplied content contains no verifiable execution evidence confirming installation or a successful client handshake, so the score remains below the high range.

Static review · not runReviewed 2026-11-29

Read the FMRS scoring method →

Fit and risk

What it can accessReads local filesConnects to a database

Best for

  • Development teams that can run PostgreSQL with Apache AGE and pgvector to index repositories.
  • Users who want reproducible code graph context for coding agents.
  • Local or internal deployments with the capacity to manage a database and code index.

Not for

  • Users who do not want to run or connect to PostgreSQL with Apache AGE and pgvector.
  • Teams that require remote MCP transport; this server provides stdio.
  • Deployments requiring built-in server authentication or user-level repository scope enforcement on every interface.

Required permissions

  • Requires access to the configured PostgreSQL database; database credentials are supplied through BCE_DB_* environment variables.
  • Indexing a repository requires reading the target codebase according to its workflow; indexing tools are enabled only when BCE_MCP_ALLOW_WRITE=true.
  • The default toolset is read-only; the full read-only toolset can be enabled with BCE_MCP_TOOLSET=full.

Risks and side effects

  • The server has no built-in authentication; the README recommends placing it behind an authenticated proxy before exposing a port.
  • Only Layer 3 endpoints apply per-user repository scope; other layers may not enforce that scope.
  • Enabling the Jev context selector sends task text and code excerpts to a third-party service.
  • The index may lag behind the working tree; responses report coverage information such as commit_mismatch.

Setup

Before you start

Runtime:Python · Docker

BCE_DB_HOST required Host for PostgreSQL with Apache AGE and pgvector; defaults to localhost.
BCE_DB_PASSWORD optionalsecret Database password; defaults to bce.
BCE_VOYAGE_API_KEY optionalsecret Voyage AI key required when using the Voyage embedding provider.
BCE_EMBEDDING_API_KEY optionalsecret Bearer token for the embedding server; leave empty if it has no authentication.
OPENROUTER_API_KEY optionalsecret OpenRouter key required when BCE_SELECTOR is jev.
Other optional settings (11)
BCE_DB_PORT optional PostgreSQL port; defaults to 5432.
BCE_DB_NAME optional Database containing the code graph; defaults to bce.
BCE_DB_USER optional Database user; defaults to bce.
BCE_ENV_FILE optional Optional .env file path for BCE_* settings; environment values override file values.
BCE_EMBEDDING_PROVIDER optional Encoder used to build the index: voyage, openai, or offline hashing; should match the index configuration.
BCE_EMBEDDING_MODEL optional Embedding model ID used to build the index.
BCE_EMBEDDING_DIM optional Vector width used by the index.
BCE_EMBEDDING_BASE_URL optional Base URL of an OpenAI-compatible embedding server when using the openai provider.
BCE_AGENT_MODE optional Controls how the agent uses get_context_for_task results; defaults to hint and can be set to trust.
BCE_SELECTOR optional Optional context selector: jev, decider-4b, or decider-2b; unset means off.
BCE_SELECTOR_URL optional Decider server endpoint for the decider-4b or decider-2b selector.

Prepare a PostgreSQL database running Apache AGE and pgvector, and install bgts-context-engine with its MCP extra. Configure the MCP client to run uvx --from bgts-context-engine[mcp] bce serve-mcp over stdio, setting BCE_DB_HOST, BCE_DB_PORT, BCE_DB_NAME, BCE_DB_USER, and BCE_DB_PASSWORD. Migrate the database and index the target repository before use, then restart the client to load the server. The default toolset has two read-only tools; set BCE_MCP_TOOLSET=full to enable all read-only tools or BCE_MCP_ALLOW_WRITE=true to enable indexing tools.

claude_desktop_config.json
{
  "mcpServers": {
    "bgts-context-engine": {
      "command": "uvx",
      "args": ["--from", "bgts-context-engine[mcp]", "bce", "serve-mcp"],
      "env": {
        "BCE_DB_HOST": "localhost",
        "BCE_DB_PORT": "5432",
        "BCE_DB_NAME": "bce",
        "BCE_DB_USER": "bce",
        "BCE_DB_PASSWORD": "bce"
      }
    }
  }
}

Shown for Claude Desktop. Other clients may use a different file or key (VS Code uses "servers") — the configurator below converts it.

.vscode/mcp.json
{
  "servers": {
    "bgts-context-engine": {
      "command": "uvx",
      "args": [
        "--from",
        "bgts-context-engine[mcp]",
        "bce",
        "serve-mcp"
      ],
      "env": {
        "BCE_DB_HOST": "localhost",
        "BCE_DB_PORT": "5432",
        "BCE_DB_NAME": "bce",
        "BCE_DB_USER": "bce",
        "BCE_DB_PASSWORD": "bce"
      }
    }
  }
}

Goes in your project's .vscode/mcp.json (VS Code uses a "servers" key).

~/.codex/config.toml
[mcp_servers.bgts-context-engine]
command = "uvx"
args = ["--from", "bgts-context-engine[mcp]", "bce", "serve-mcp"]

[mcp_servers.bgts-context-engine.env]
BCE_DB_HOST = "localhost"
BCE_DB_PORT = "5432"
BCE_DB_NAME = "bce"
BCE_DB_USER = "bce"
BCE_DB_PASSWORD = "bce"

Append to ~/.codex/config.toml (OpenAI Codex CLI uses TOML).

Terminal
claude mcp add bgts-context-engine -e BCE_DB_HOST=localhost -e BCE_DB_PORT=5432 -e BCE_DB_NAME=bce -e BCE_DB_USER=bce -e BCE_DB_PASSWORD=bce -- uvx --from 'bgts-context-engine[mcp]' bce serve-mcp

Run it in a terminal; replace any <…> placeholders with your own values first.

Check that it works

Restart the MCP client and confirm get_context_for_task and inspect_symbol_graph appear in its tool list. Ask a question about the indexed codebase and confirm the server returns code context.

Troubleshooting

  1. Check that PostgreSQL is running, database credentials and port are correct, and Apache AGE and pgvector are available.
  2. Check whether the MCP client can find uvx; alternatively, install bce on a PATH visible to the client as documented.
  3. After changing MCP configuration, restart Cursor or VS Code, or reload the window; check that the server is enabled.
  4. Confirm the `[mcp]` extra is installed and that the database has been migrated and the target repository indexed.
  5. For indexing tools, confirm BCE_MCP_ALLOW_WRITE=true; for all read-only tools, confirm BCE_MCP_TOOLSET=full.

Things to try

Once connected, you can ask your AI assistant things like:

  • Find the code relevant to fixing the login timeout in the meeting webhook.
  • What functions and references could be affected by changing the session TTL?

Tools 2

get_context_for_task read-only
Retrieve ranked code context for a task, with coverage information.
inspect_symbol_graph read-only
Inspect symbols and their relationships in the code graph.

Use cases

Locate relevant code symbols and repository locations from a task description.
Inspect calls and other graph relationships between symbols.
Provide reproducible code context for change impact analysis and AI coding agents.

Supported clients

Claude Desktop
Cursor
VS Code
Claude Code
OpenCode
Codex
GitHub Copilot

Listed from the project's documentation, not tested by this site.

Overview

BGTS Context Engine indexes repositories as code graphs and provides ranked, budgeted context with coverage information to AI coding agents over MCP. It uses PostgreSQL, Apache AGE, and pgvector; no LLM is used in the retrieval path. The MCP server exposes get_context_for_task and inspect_symbol_graph by default. Additional read-only and indexing tools can be enabled through configuration.

Similar servers

Source revision 0d31785f16a5 Data synced 2026-12-05 Read the FMRS scoring method Markdown

Maintainer badge: embed FMRS score

Paste this Markdown into your repository README to display a live score badge:

README.md
[![FollowMCP](https://followmcp.com/badges/bgts-context-engine.svg)](https://followmcp.com/en/servers/bgts-context-engine)