Contrast MCP Server
以下摘录自该仓库的 README(片段) · 在 GitHub 读完整 README →
The Contrast MCP Server connects Contrast Security to your AI coding agent so you can remediate vulnerabilities, update insecure libraries, and analyze security coverage through natural language.
It comes in two forms.
- **Hosted MCP Server** is a remote MCP server that Contrast runs for you. It is the simplest path for Contrast SaaS customers, with browser-based OAuth sign-in and nothing to install. **Recommended for most users.**
- **Local MCP Server** is the open-source server in this repository that you run yourself with API keys. It is the right choice for on-premises and EOP (Enterprise On-Premises) instances.
> [!WARNING]
> **CRITICAL SECURITY WARNING:** Exposing Contrast vulnerability data to an AI service that trains on your prompts can leak sensitive information. Only use the Contrast MCP Server with environments that contractually guarantee data isolation and prohibit model training on your inputs.
>
> **Verify AI Data Privacy:** Confirm that your service agreement prevents model training on your prompts and consult your security team before sharing Contrast data.
>
> **UNSAFE:** Public consumer LLM sites (e.g., free ChatGPT, Gemini, Claude) that use prompts for training.
>
> **POTENTIALLY SAFE:** Enterprise services with contractual privacy guarantees (e.g., Google Cloud AI, AWS Bedrock, Azure OpenAI).
Contents
- Hosted MCP Server (recommended)
- Prerequisites
- Connect
- Connection details
- Supported clients
- Security and privacy
- Available tools
- Local MCP Server
- Quick start
- More setup and troubleshooting
- Sample prompts
- Data privacy
Hosted MCP Server (recommended)
The Hosted MCP Server, a remote MCP server that Contrast operates for you, is the easiest way to connect an AI agent to Contrast. You point your client at one URL, sign in through your browser, and your agent can start asking questions about your security data. There are no API keys to copy around, no container or JAR to keep updated, and no local process to run.
The hosted server is read-only and is available now for Contrast SaaS.
Prerequisites
- A Contrast SaaS account with access to at least one organization
- An MCP client that supports Streamable HTTP transport and OAuth 2.0 with PKCE (see Supported clients)
- A modern web browser for the OAuth sign-in
Connect
Add the server to Claude Code by pointing it at your Contrast host followed by /mcp.
Replace app.contrastsecurity.com with your organization's Contrast URL if you use a dedicated instance. The first time your agent calls a tool, your browser opens for sign-in. If sign-in does not start automatically, run /mcp in Claude Code and choose Authenticate for contrast-hosted-mcp. You log in with your existing Contrast credentials, choose an organization, and approve read access. Your session refreshes on its own, so you typically sign in once and keep working.
For step-by-step setup for Claude Code, Claude Desktop, the Codex CLI, the GitHub Copilot CLI, and opencode, see the Hosted MCP Server installation guide.
Connection details
Any MCP client that supports Streamable HTTP transport and OAuth 2.0 with PKCE can connect.
| Setting | Value |
|---------|-------|
| Endpoint URL | https:// /mcp (for example https://app.contrastsecurity.com/mcp) |
| Transport | Streamable HTTP (stateless) |
| HTTP method | POST |
| Authentication | OAuth 2.0 with PKCE (S256) |
| OAuth scopes | openid, profile, offline_access |
Your client discovers the OAuth configuration automatically through the WWW-Authenticate response header, which points to the standard /.well-known/oauth-protected-resource metadata document. Clients that support Dynamic Client Registration can register at /oauth2/connect/register on the Contrast origin.
These OAuth scopes cover identity only, and that is deliberate. The token grants no data permissions of its own. Authorization is decided by the Contrast platform on every request, using the signed-in user's existing role-based access control. This means there is no broadly-scoped token for an agent to hold or leak, and no authorization scope to get wrong at connection time. See Security and privacy for the full model.