|
| 1 | +# Using the Synapse MCP Server |
| 2 | + |
| 3 | +The [Synapse MCP server](https://github.com/Sage-Bionetworks/synapse-mcp) implements the [Model Context Protocol (MCP)](https://modelcontextprotocol.io/) and lets AI assistants (Claude, GitHub Copilot, Cursor, and others) directly query Synapse — search for datasets, inspect entity metadata, explore project hierarchies, and trace provenance — without you writing any code. |
| 4 | + |
| 5 | +The server is implemented in Python and built on top of this `synapseclient` package, so its behavior and capabilities mirror what you can do programmatically through the Python client. |
| 6 | + |
| 7 | +!!! warning "Terms of Service" |
| 8 | + Using the Synapse MCP server with consumer AI services that store conversation data may violate the Synapse Terms of Service prohibition on data redistribution. Prefer enterprise deployments with data-residency guarantees or self-hosted models when working with sensitive or restricted datasets. |
| 9 | + |
| 10 | +--- |
| 11 | + |
| 12 | +## Installation |
| 13 | + |
| 14 | +### Remote server (recommended) |
| 15 | + |
| 16 | +The hosted MCP server at `https://mcp.synapse.org/mcp` authenticates via OAuth2 — no token management required. |
| 17 | + |
| 18 | +#### "Claude Code (CLI)" |
| 19 | + |
| 20 | + ```bash |
| 21 | + claude mcp add --transport http synapse -- https://mcp.synapse.org/mcp |
| 22 | + ``` |
| 23 | + |
| 24 | + On first use, Claude Code will open a browser window to complete the OAuth2 login. |
| 25 | + |
| 26 | +#### "Claude Desktop" |
| 27 | + |
| 28 | + 1. Open **Settings → Connectors → Add custom connector** |
| 29 | + 2. Enter the URL: `https://mcp.synapse.org/mcp` |
| 30 | + 3. Save and restart Claude Desktop |
| 31 | + |
| 32 | +#### "VS Code / GitHub Copilot" |
| 33 | + |
| 34 | + Add to your `settings.json` or `.vscode/mcp.json`: |
| 35 | + |
| 36 | + ```json |
| 37 | + { |
| 38 | + "mcp": { |
| 39 | + "servers": { |
| 40 | + "synapse": { |
| 41 | + "type": "http", |
| 42 | + "url": "https://mcp.synapse.org/mcp" |
| 43 | + } |
| 44 | + } |
| 45 | + } |
| 46 | + } |
| 47 | + ``` |
| 48 | + |
| 49 | +### Local installation |
| 50 | + |
| 51 | +For air-gapped environments or development, you can run the server locally using a [Personal Access Token (PAT)](https://www.synapse.org/#!PersonalAccessTokens:0). |
| 52 | + |
| 53 | +```bash |
| 54 | +git clone https://github.com/Sage-Bionetworks/synapse-mcp.git |
| 55 | +cd synapse-mcp |
| 56 | +pip install -e . |
| 57 | +export SYNAPSE_PAT="your_personal_access_token" |
| 58 | +synapse-mcp |
| 59 | +``` |
| 60 | + |
| 61 | +Configure your MCP client to point to `http://localhost:8000/mcp` (or the port shown in the startup output). |
| 62 | + |
| 63 | +--- |
| 64 | + |
| 65 | +## Available tools |
| 66 | + |
| 67 | +For the full and up-to-date list of tools, see the [synapse-mcp repository](https://github.com/Sage-Bionetworks/synapse-mcp). At the time of writing, the server exposes tools including: |
| 68 | + |
| 69 | +- `search_synapse` — full-text search across public and private entities |
| 70 | +- `get_entity` — fetch core metadata for any entity by Synapse ID |
| 71 | +- `get_entity_annotations` — retrieve custom annotation key/value pairs |
| 72 | +- `get_entity_children` — list children within a project or folder |
| 73 | +- `get_entity_provenance` — inspect the activity log and inputs/outputs for an entity version |
| 74 | + |
| 75 | +--- |
| 76 | + |
| 77 | +## Example prompts |
| 78 | + |
| 79 | +Once the MCP server is connected, you can interact with Synapse in natural language. Here are some useful prompts to try: |
| 80 | + |
| 81 | +**Discover data** |
| 82 | + |
| 83 | +``` |
| 84 | +Search Synapse for RNA-seq datasets related to Alzheimer's Disease. |
| 85 | +``` |
| 86 | + |
| 87 | +``` |
| 88 | +What files are in the project syn12345678? |
| 89 | +``` |
| 90 | + |
| 91 | +**Inspect metadata** |
| 92 | + |
| 93 | +``` |
| 94 | +What are the annotations on syn9876543? |
| 95 | +``` |
| 96 | + |
| 97 | +``` |
| 98 | +Show me the provenance for the latest version of syn11223344. |
| 99 | +``` |
| 100 | + |
| 101 | +**Explore a project** |
| 102 | + |
| 103 | +``` |
| 104 | +List all folders and files in syn5678901 and summarize what the project contains. |
| 105 | +``` |
| 106 | + |
| 107 | +**Combine with code generation** |
| 108 | + |
| 109 | +``` |
| 110 | +Find the Synapse ID for the ROSMAP bulk RNA-seq dataset, then write Python code |
| 111 | +using synapseclient to download it and load it into a pandas DataFrame. |
| 112 | +``` |
| 113 | + |
| 114 | +--- |
| 115 | + |
| 116 | +## Feature requests and feedback |
| 117 | + |
| 118 | +Have an idea for a new MCP tool or want to report a bug? [Open a support ticket](https://sagebionetworks.jira.com/servicedesk/customer/portal/9/group/16/create/206) via the Sage Bionetworks service desk. |
0 commit comments