Add: basic FastMCP server for analytics tools with similar input-outp… - #238
Draft
VirajAgarwal-couchbase wants to merge 9 commits into
Draft
Add: basic FastMCP server for analytics tools with similar input-outp…#238VirajAgarwal-couchbase wants to merge 9 commits into
VirajAgarwal-couchbase wants to merge 9 commits into
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
Adds a minimal Enterprise Analytics (EA) FastMCP prototype server plus query/metadata tools, along with unit/integration tests and packaging scaffolding to run against a live EA cluster.
Changes:
- Introduces EA MCP server entrypoint, cluster connection handling, and standard tool response envelopes.
- Adds query + metadata tool implementations and registers them with FastMCP.
- Adds unit tests (mocked cluster) and integration tests (live cluster via subprocess), plus pyproject/README for running.
Reviewed changes
Copilot reviewed 14 out of 15 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| analytics-mcp/src/ea_mcp_server.py | Adds the stdio FastMCP server entrypoint and tool registration. |
| analytics-mcp/src/ea_mcp/connection.py | Implements minimal “connect once” cluster lifecycle and context access. |
| analytics-mcp/src/ea_mcp/tools/query.py | Adds a write-style query tool returning success/error envelopes. |
| analytics-mcp/src/ea_mcp/tools/metadata.py | Adds read-only metadata introspection tools querying System.Metadata. |
| analytics-mcp/src/ea_mcp/tools/init.py | Exposes the tool list + annotations for registration. |
| analytics-mcp/src/ea_mcp/responses.py | Adds shared success/error envelope helpers. |
| analytics-mcp/tests/unit/test_query_tools_unit.py | Unit-tests query tool envelope behavior with mocked SDK errors. |
| analytics-mcp/tests/unit/test_metadata_tools_unit.py | Unit-tests metadata tools query execution and raise-on-error behavior. |
| analytics-mcp/tests/integration/conftest.py | Adds subprocess-based MCP session fixture + response payload extraction. |
| analytics-mcp/tests/integration/test_query_tools.py | Adds live-cluster integration tests for the query tool. |
| analytics-mcp/tests/integration/test_metadata_tools.py | Adds live-cluster integration tests for metadata tools with setup/teardown DDL. |
| analytics-mcp/pyproject.toml | Adds project metadata, deps, lint/test config, and dev dependency pins. |
| analytics-mcp/README.md | Documents how to run the server and execute unit/integration tests. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
VirajAgarwal-couchbase
marked this pull request as draft
August 31, 2026 04:59
Co-authored-by: Viraj Agarwal <virajagarwal15@gmail.com>
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com> Co-authored-by: Viraj Agarwal <viraj.agarwal@couchbase.com>
Co-authored-by: Viraj Agarwal <virajagarwal15@gmail.com>
Co-authored-by: Viraj Agarwal <virajagarwal15@gmail.com>
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.
Add prototype Enterprise Analytics MCP server (analytics-mcp)
Related Issue
Resolves: https://jira.issues.couchbase.com/browse/IDEA-1036
Related: https://jira.issues.couchbase.com/browse/DA-2027
What does this change do?
Adds a small, standalone FastMCP server under
analytics-mcp/exposing 5 P0 tools forCouchbase Enterprise Analytics (EA), built on the
couchbase-analyticsPython SDK:get_databases_in_cluster,get_scopes_in_database,get_collections_in_scope,get_schema_for_collection, andrun_query_sync.Why is this change needed?
There's customer interest in MCP tooling for Enterprise Analytics, a separate service from
operational Couchbase Server that requires a different SDK. This is a prototype to validate
the tool set and input/output conventions against a live EA cluster before deciding on final
architecture (separate server vs. merged into the main MCP server). It's intentionally minimal
— no OAuth, no scope enforcement, no read-only-mode toggle — so the tool bodies and tests can
be copy-pasted wholesale once that architecture decision is made.
Evidence of Testing
Automated tests — commands run and results summary:
uv run pytest tests/unit/ -v → 10 passed
uv run pytest tests/integration/ -v → 5 passed
Environments tested:
couchbase/enterprise-analytics:2.2.0, via Docker — single node, per the quick-install guide)Manual verification — ran
uv run ea-mcp-serverover stdio against the local Docker EAcluster (
http://localhost:8095,Administrator/password), confirmed all 5 tools registerand each was exercised directly (create scope/collection, insert, list, infer schema,
run_query_sync happy path + error envelope) with resultstring.
Compatibility Considerations
New, independent package (
analytics-mcp/) with its owanges tocb_mcp.core, the existingmcp-server-couchbasetool set, CLI flags, or dependencies of theparent server. Enterprise Analytics is self-managed-onld.
Checklist
couchbase-analytics, the EA-specific SDK)cb_mcp.corecontracts / managed MCP interfaces (or discussed first)ToolAnnotationsset per toolanalytics-mcp/README.md; parent README/DOCKER.md untouched (separate package)