Skip to content

[integrations] Enhanced MCP server with alpha tool suite#6

Open
alanshurafa wants to merge 315 commits into
mainfrom
contrib/alanshurafa/enhanced-mcp
Open

[integrations] Enhanced MCP server with alpha tool suite#6
alanshurafa wants to merge 315 commits into
mainfrom
contrib/alanshurafa/enhanced-mcp

Conversation

@alanshurafa

Copy link
Copy Markdown
Owner

Summary

  • Adds a production-grade remote MCP server in integrations/enhanced-mcp/ expanding the tool surface from 4 to 14 tools
  • Includes enhanced search (semantic + full-text), full CRUD, content dedup via SHA-256 fingerprinting, automatic LLM classification, sensitivity detection, and operational monitoring
  • Schema-backed tools (graph_search, entity_detail, ops_capture_status, ops_source_monitor) gracefully degrade when optional schemas (smart-ingest, knowledge-graph) are absent
  • Original server/ is untouched — this deploys as a second remote connector

Dependencies

Files

integrations/enhanced-mcp/
  README.md              — Setup guide with 5 numbered steps
  metadata.json          — Passes .github/metadata.schema.json validation
  deno.json              — Import map matching server/ versions
  index.ts               — 14-tool MCP server (Hono + StreamableHTTPTransport)
  _shared/config.ts      — Constants, classifier prompt, sensitivity patterns
  _shared/helpers.ts     — embedText, extractMetadata, detectSensitivity, prepareThoughtPayload

Tool Surface (14 tools)

# Tool Schema
1-7 search_thoughts, list_thoughts, get_thought, update_thought, delete_thought, capture_thought, thought_stats Enhanced Thoughts
8-10 search_thoughts_text, count_thoughts, related_thoughts Enhanced Thoughts
11 ops_capture_status Smart Ingest
12-13 graph_search, entity_detail Knowledge Graph
14 ops_source_monitor Ops Views

Test Plan

  • All 15 OB1 PR Gate checks pass
  • metadata.json validates against .github/metadata.schema.json
  • README links resolve (../../docs/01-getting-started.md, ../../docs/05-tool-audit.md)
  • No credentials, no local MCP patterns
  • Deploy to test Supabase project and smoke-test core tools

Generated with Claude Code

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 7633681f7b

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +114 to +116
if (!response.ok) {
throw new Error(`OpenRouter embedding failed (${response.status}): ${await response.text()}`);
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Use OpenAI fallback when OpenRouter embeddings fail

The embedText helper currently throws as soon as OpenRouter returns a non-2xx response, which prevents execution from ever reaching the documented OpenAI fallback branch even when OPENAI_API_KEY is configured. In environments with both providers enabled, any transient OpenRouter failure will hard-fail embedding-dependent tools (search_thoughts semantic mode, capture_thought, update_thought) instead of degrading gracefully to OpenAI.

Useful? React with 👍 / 👎.

supabase: { from: (name: string) => { select: (cols: string) => { limit: (n: number) => Promise<{ error: unknown }> } } },
tableName: string,
): Promise<boolean> {
const { error } = await supabase.from(tableName).select("id").limit(0);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Make table existence checks column-agnostic

The schema guard utility claims to test whether a relation exists, but it probes by selecting id, which incorrectly returns false for any valid table/view that does not expose an id column. Because this helper is used to gate optional tools, a deployed schema can be present yet reported unavailable purely due to column shape. The existence check should not assume a specific column name.

Useful? React with 👍 / 👎.

@github-actions github-actions Bot added documentation Improvements or additions to documentation recipe labels Apr 6, 2026
@alanshurafa alanshurafa force-pushed the contrib/alanshurafa/enhanced-mcp branch from 14515a9 to 7e2598b Compare April 18, 2026 02:52
alanshurafa and others added 21 commits April 18, 2026 15:03
…test_path + traverse_graph)

The previous recursive-CTE implementations enumerated every path to every
reachable node, which exploded on densely connected graphs (a hub with 1k+
neighbours at depth 2 produced tens of thousands of rows) and depended on
the per-path ANY(path) check to break cycles. On a cyclic graph that
exceeded the statement_timeout the planner never actually pruned the walk.

Replace both functions with iterative plpgsql BFS:

- Global seen-set (UUID[]) so each node is visited at most once
- JSONB parent-pointer map records the first (parent, relation) that
  reached each node; BFS's "first discovery wins" invariant is enforced
  with DISTINCT ON (next_id)
- Shared reconstruct_bfs_path() helper walks the parent map end -> start
  with a safety guard against malformed maps
- find_shortest_path keeps bidirectional edge traversal; traverse_graph
  keeps outgoing-only with optional relationship_type filter
- Signatures, argument order, RETURNS shape, and language (plpgsql, no
  SECURITY DEFINER) match the original so this is a body-only rewrite
- All queries scope by p_user_id to preserve the multi-tenant isolation
  the edge function relies on (service_role bypasses RLS)

Update the README's "How It Works" section and function table to describe
the new implementation so the docs don't contradict the SQL.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Standalone Node script that exercises traverse_graph and find_shortest_path
against a live Supabase project with ob-graph installed. Picks an arbitrary
edge, calls both RPCs at depth 1/2/6, and prints row counts + timings so
maintainers can confirm the iterative-BFS rewrite stays inside the
statement_timeout and returns sensible shapes before shipping.

Reads SUPABASE_PROJECT_REF, SUPABASE_SERVICE_ROLE_KEY, and OB_GRAPH_USER_ID
from recipes/ob-graph/.env.local so the service-role key never lands in
repo history. Sets process.exitCode=1 on any RPC failure so CI or shell
chaining picks up a non-zero exit.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…gth === 2 to protect bidirectional shortest-path
justfinethanku and others added 30 commits June 7, 2026 20:46
…-agent-memory

feat(integrations): add hermes-agent-memory native provider for OB1
…lanshurafa/smart-ingest

[integrations] Smart ingest Edge Function
…wicegood/dashboard-open-next-cloudflare

[dashboards] open-brain-dashboard-next: add Cloudflare Workers deploy support
…lanshurafa/enhanced-thoughts

[schemas] Enhanced thoughts columns and utility RPCs
…lanshurafa/brain-backup

[recipes] Brain backup and export
…lanshurafa/brain-health-monitoring

[recipes] Brain health monitoring views
…ns1002/per-request-mcp

[integrations] Fix per-request McpServer instantiation for stable MCP connections
…xcfi-scott/delete-thought-mcp

[integrations] delete_thought MCP
…er/typed-reasoning-edges-comment-syntax-fix

[schemas] Fix typed-reasoning-edges COMMENT ON syntax error
…lanshurafa/auto-capture-claude-code

[skills] Auto-capture Claude Code adapter
Document that MCP_ACCESS_KEY should be high-entropy (single shared
secret, single-tenant) and that the wildcard CORS is deliberate and
safe given header-based auth.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.