Query and Analyze CIViC Cancer Genomics Data
Query CIViC cancer-variant evidence through MCP, stage large GraphQL results in SQLite, and analyze them with read-only SQL.
1.0.0Add to Favorites
Why it matters
Access and analyze complex cancer genomics and clinical variant interpretation data from the CIViC database. This asset enables structured querying via GraphQL and SQL, transforming raw API responses into usable datasets for research and analysis.
Outcomes
What it gets done
Execute GraphQL queries against the CIViC API.
Query pre-processed CIViC data using SQL.
Convert GraphQL responses into structured SQLite tables.
Manage and query intermediate datasets efficiently.
Source
Get it from source
Spark does not host a copy of it.
Open sourceReports
Agent outcome reports
No reports yet
Capabilities
Tools your agent gets
Execute GraphQL queries against the CIViC API for cancer genomics data
Query pre-processed cancer variant data using SQL
Overview
Connects MCP clients to CIViC GraphQL and stages larger results in SQLite. Adds read-only SQL analysis, JavaScript Code Mode, and evidence/assertion search prompts. Use for CIViC evidence retrieval and staged data analysis when Cloudflare deployment and an MCP client are available.
What it does
CIViC MCP Server connects assistants to the Clinical Interpretation of Variants in Cancer API. It runs on Cloudflare Workers and turns GraphQL responses into queryable SQLite tables backed by application Durable Objects. The database contains crowd-sourced clinical interpretations of cancer variants; the connector supports structured retrieval and analysis of that information.
The tool pipeline separates retrieval from analysis. The civic_graphql_query tool sends a GraphQL query to CIViC and stages substantial results. The civic_query_sql tool reads the staged tables through SQL. The civic_execute tool provides Code Mode, running JavaScript inside a V8 isolate with gql.query() and schema helpers for GraphQL access. These are three distinct entry points rather than different names for the same operation.
When to use - and when NOT to
Use it to retrieve variant evidence, inspect therapeutic interpretations, compare assertions, or analyze a fetched dataset without placing its entire raw response into the assistant context. SQL analysis requires data that was actually staged; small or unsuitable responses may be returned directly instead.
GraphQL retrieval can create or modify staged SQLite data and contacts an external API. SQL queries are read-only and operate on the staged database. Tool annotations distinguish these effects, including non-destructive staging, external access, and SQL idempotency. A prompt's search strategy is not a guarantee that every query or imperfect parameter will succeed.
Capabilities
Three MCP prompts organize retrieval. The get-variant-evidence prompt targets Evidence Items, which can include clinical descriptions. It does not use a variantName filter because that filter is unsupported for Evidence Items. The get-variant-assertions prompt targets higher-level Assertions with fallback searches. The get-variant-data prompt combines both categories for a broader variant investigation.
Prompt parameters support molecular profiles, diseases, therapies, evidence types, status, and result limits where appropriate. The default status is ALL to avoid excluding records prematurely, and null parameters are omitted. Canonical evidence and assertion paths support checking returned records.
Response handling bypasses SQLite staging for responses below 1500 characters, errors, empty or null results, and schema introspection. Large structured results retain staging and 100KB transport protections. This distinction preserves direct error visibility while allowing SQL analysis of larger datasets.
The transport targets MCP 2026-07-28 through stateless Streamable HTTP. Discovery uses server/discover, requests carry protocol and capability envelopes, and no MCP session Durable Object or Mcp-Session-Id is used. Application data objects remain for staging. Method/name validation, deterministic tool registration, resultType, serverInfo, cache hints, structuredContent, content, and isError support consistent responses.
How to install
Deployment requires a Cloudflare account, Wrangler CLI, and the client configuration. Review the repository and dependencies, then install them with:
npm install
The deploy script publishes the Worker. Configure Claude Desktop to connect through mcp-remote to the deployed Worker's /mcp endpoint, replacing the illustrative subdomain with the actual deployment. Restart the client after changing its configuration.
Who it's for
The connector serves people querying CIViC evidence and assertions through an MCP client, including workflows that need both GraphQL retrieval and SQL exploration. The license is MIT with an Academic Citation Requirement; consult the license terms for that additional requirement.
Source README
CIViC MCP Server
This is a Cloudflare Workers-based Model Context Protocol (MCP) server that provides tools for querying the CIViC (Clinical Interpretation of Variants in Cancer) API. The server converts GraphQL responses into queryable SQLite tables using Durable Objects for efficient data processing.
The CIViC database is a crowd-sourced repository of clinical interpretations of cancer variants. This MCP server enables structured queries and data analysis of cancer genomics information through natural language interactions with AI assistants.
MCP Specification Compliance
This server implements MCP 2026-07-28 through the fleet's stateless SDK v2 adapter:
server/discoverreplaces initialization and every request carries its protocol/capability envelope.- The Worker uses stateless Streamable HTTP with no MCP session Durable Object or
Mcp-Session-Id. - The SDK validates
Mcp-Method/Mcp-Name, stampsresultTypeandserverInfo, and supplies cache hints. - Tool lists have deterministic registration order.
- Tools return
contentandstructuredContenton success and error, withisError: truefor errors. - Large structured results retain the fleet's staging and 100KB transport protections.
Tool Annotations Reference
The server defines comprehensive tool annotations for MCP clients:
// GraphQL Query Tool
annotations: {
readOnlyHint: false, // Creates/modifies data in SQLite
destructiveHint: false, // Non-destructive data staging
idempotentHint: false, // Different queries produce different results
openWorldHint: true // Interacts with external CIViC API
}
// SQL Query Tool
annotations: {
readOnlyHint: true, // Only reads data
destructiveHint: false, // Cannot modify data (read-only SQL)
idempotentHint: true, // Same query produces same results
openWorldHint: false // Operates on closed SQLite database
}
Transport
// MCP 2026-07-28 stateless Streamable HTTP
CivicMCP.serve("/mcp").fetch(request, env, ctx)
The only Durable Objects retained are application/data objects used for staging; they are not MCP transport sessions.
Features
- GraphQL to SQL Conversion: Automatically converts CIViC API responses into structured SQLite tables
- Efficient Data Storage: Uses Cloudflare Durable Objects with SQLite for data staging and querying
- Smart Response Handling: Optimizes performance by bypassing staging for small responses, errors, and schema introspection queries
- Tool Pipeline:
civic_graphql_query: Executes GraphQL queries and stages large datasetscivic_query_sql: Enables SQL-based analysis of staged datacivic_execute: Code Mode - runs JavaScript in a V8 isolate withgql.query()and schema helpers for full GraphQL access
Installation & Configuration
Prerequisites
- A Cloudflare account
- Wrangler CLI installed
- Claude Desktop app
Deploy to Cloudflare Workers
Clone this repository:
git clone <repository-url> cd civic-mcp-serverInstall dependencies:
npm installDeploy to Cloudflare Workers:
npm run deployAfter deployment, you'll get a URL like:
https://civic-mcp-server.YOUR_SUBDOMAIN.workers.dev
Configure Claude Desktop
Add this configuration to your claude_desktop_config.json file:
{
"mcpServers": {
"civic-mcp-server": {
"command": "npx",
"args": [
"mcp-remote",
"https://civic-mcp-server.quentincody.workers.dev/mcp"
]
}
}
}
Replace quentincody with your actual Cloudflare Workers subdomain.
Usage
Once configured, restart Claude Desktop. The server provides three main tools:
civic_graphql_query: Execute GraphQL queries against the CIViC APIcivic_query_sql: Query staged data using SQLcivic_execute: Code Mode - write JavaScript against the CIViC GraphQL API in a V8 isolate
Prompts
This server exposes three MCP Prompts that guide the model to use the civic_graphql_query tool with correct GraphQL syntax and robust search strategies:
Individual Data Type Prompts
get-variant-evidence- Generates GraphQL for Evidence Items only (no variantName filter - not supported by CIViC schema)get-variant-assertions- Generates GraphQL for Assertions only with systematic fallback strategies
Combined Data Prompt
get-variant-data- Executes both Evidence Items AND Assertions queries for comprehensive variant analysis
Examples (VS Code Copilot Chat / slash-commands):
/get-variant-evidence molecularProfileName:"TP53 Mutation" diseaseName:"Lung Adenocarcinoma" evidenceType:"PROGNOSTIC" first:"200"/get-variant-assertions molecularProfileName:"TPM3-NTRK1 Fusion" therapyName:"Larotrectinib" status:"ALL"/get-variant-data molecularProfileName:"BRAF V600E" diseaseName:"Melanoma" therapyName:"Trametinib" status:"ALL"
Key Prompt Features
- Bulletproof GraphQL Generation: Complete, validated queries that never fail
- Intelligent Search Strategies: Automatic fallback approaches to find relevant data
- Comprehensive Results: Evidence items include clinical descriptions; assertions provide high-level summaries
- Optimal Filtering: Default status is "ALL" to avoid over-filtering; null parameters are automatically excluded
- Proper URL Generation: Canonical links for verification (evidence:
/evidence/{id}, assertions:/assertions/{id})
These prompts provide complete GraphQL queries with proper CIViC v2 schema compliance and systematic search methodologies that ensure data discovery even when users provide imperfect parameters.
Example Queries
You can ask Claude questions like:
- "What are the latest evidence items for BRAF mutations?"
- "Show me all therapeutic interpretations for lung cancer variants"
- "Find genes with the most evidence items in the CIViC database"
Claude will use the server (and its civic_graphql_query tool) to fetch the relevant data from the CIViC database and present it to you. The server is designed to query version 2 of the CIViC API, ensuring you get up-to-date information.
If you encounter issues or Claude doesn't seem to be using the CIViC data, double-check the configuration steps above.
Response handling
The server intelligently optimizes context usage by storing large results in a temporary SQLite database. When GraphQL responses meet certain criteria, the raw response is returned directly instead of creating a database:
- Small responses (< 1500 characters): Returned directly to avoid unnecessary overhead
- Error responses: Passed through directly to make troubleshooting easier
- Empty/null responses: Bypassed to avoid creating empty databases
- Schema introspection queries: Queries containing
__schema,__type, or other introspection patterns are returned directly since they contain metadata rather than data suitable for SQL conversion
This optimization makes the server more efficient and provides better error visibility while still enabling powerful SQL-based analysis for substantial datasets.
FAQ
Common questions
Discussion
Questions & comments · 0
Sign In Sign in to leave a comment.