@devries-cameron20 / composio Mirror · read-only / commits / a15bb7908
Fork 0

Composio powers 1000+ toolkits, tool search, context management, authentication, and a sandboxed workbench to help you build AI agents that turn intent into action.

Mirrored from https://github.com/Camo67/composio.git

Synced Nov 22, 15:45 UTC

chore(PLEN-930): add changelog for MCP API key enforcement feature

- Document the new require_mcp_api_key project setting - Include examples for Dashboard, API, and SDK usage - Explain backward compatibility and opt-in nature - Add request examples showing behavior with/without API key

Anshu Garg committed Dec 30, 2025 at 14:52 UTC a15bb79088569551b06cc6c78001a6f87e201eb4
1 file changed +158
fern/pages/src/changelog/12-29-25-mcp-api-key-enforcement.md new
+158
@@ -0,0 +1,158 @@
1 +# Optional API Key Enforcement for MCP Servers
2 +
3 +We've introduced a new project-level security setting that allows you to require API key authentication for all MCP server requests. This opt-in feature gives you fine-grained control over who can access your MCP endpoints.
4 +
5 +## What's New
6 +
7 +A new **"Require API Key for MCP"** toggle is now available in your Project Settings. When enabled, all requests to your MCP servers must include a valid Composio API key in the request headers.
8 +
9 +| Setting | Default | Impact |
10 +|---------|---------|--------|
11 +| `require_mcp_api_key` | `false` | Opt-in; no changes to existing behavior |
12 +
13 +<Note>
14 +This is an **opt-in security feature**. Your existing MCP integrations will continue to work without any changes unless you explicitly enable this setting.
15 +</Note>
16 +
17 +## How It Works
18 +
19 +When the setting is **disabled** (default):
20 +- MCP servers work without API key authentication
21 +- Existing integrations continue to function unchanged
22 +
23 +When the setting is **enabled**:
24 +- All MCP requests must include the `x-api-key` header with a valid Composio API key
25 +- Requests without a valid API key receive `401 Unauthorized`
26 +- Only API keys belonging to the same project are accepted
27 +
28 +### Request Examples
29 +
30 +**Without API key (when enforcement is enabled):**
31 +```bash
32 +curl -X POST "https://mcp.composio.dev/{mcp_url}" \
33 + -H "Content-Type: application/json" \
34 + -d '{"jsonrpc":"2.0","id":1,"method":"initialize",...}'
35 +
36 +# Response: 401 Unauthorized
37 +# {"error": "API key is required in headers for security reasons"}
38 +```
39 +
40 +**With API key:**
41 +```bash
42 +curl -X POST "https://mcp.composio.dev/{mcp_url}" \
43 + -H "Content-Type: application/json" \
44 + -H "x-api-key: ak_your_api_key" \
45 + -d '{"jsonrpc":"2.0","id":1,"method":"initialize",...}'
46 +
47 +# Response: 200 OK
48 +```
49 +
50 +## Enabling the Setting
51 +
52 +### Via Dashboard
53 +
54 +1. Navigate to [Project Settings](https://platform.composio.dev/settings)
55 +2. Find the **"Require API Key for MCP"** toggle under Security settings
56 +3. Enable the toggle
57 +4. Save your changes
58 +
59 +### Via API
60 +
61 +Update your project configuration using the API:
62 +
63 +```bash
64 +curl -X PATCH "https://backend.composio.dev/api/v3/org/project/config" \
65 + -H "Content-Type: application/json" \
66 + -H "x-api-key: ak_your_api_key" \
67 + -d '{"require_mcp_api_key": true}'
68 +```
69 +
70 +**Response:**
71 +```json
72 +{
73 + "require_mcp_api_key": true,
74 + "is_2FA_enabled": true,
75 + "mask_secret_keys_in_connected_account": true,
76 + "log_visibility_setting": "show_all"
77 +}
78 +```
79 +
80 +### Via SDK
81 +
82 +<CodeGroup>
83 +```python title="Python"
84 +# Update project config to require MCP API key
85 +import requests
86 +
87 +response = requests.patch(
88 + "https://backend.composio.dev/api/v3/org/project/config",
89 + headers={
90 + "Content-Type": "application/json",
91 + "x-api-key": "ak_your_api_key"
92 + },
93 + json={"require_mcp_api_key": True}
94 +)
95 +
96 +print(response.json())
97 +```
98 +```typescript title="TypeScript"
99 +// Update project config to require MCP API key
100 +const response = await fetch(
101 + "https://backend.composio.dev/api/v3/org/project/config",
102 + {
103 + method: "PATCH",
104 + headers: {
105 + "Content-Type": "application/json",
106 + "x-api-key": "ak_your_api_key"
107 + },
108 + body: JSON.stringify({ require_mcp_api_key: true })
109 + }
110 +);
111 +
112 +console.log(await response.json());
113 +```
114 +</CodeGroup>
115 +
116 +## When to Use This
117 +
118 +Enable API key enforcement when you need to:
119 +
120 +- **Prevent unauthorized access** to your MCP servers
121 +- **Control which applications** can interact with your MCP endpoints
122 +- **Add an extra security layer** for production deployments
123 +- **Audit and track** MCP server usage through API key attribution
124 +
125 +## Backward Compatibility
126 +
127 +This is a **fully opt-in feature** with no impact on existing integrations:
128 +
129 +- Default value is `false` — no changes to current behavior
130 +- Existing MCP servers continue to work without modification
131 +- You can enable/disable the setting at any time
132 +- The setting applies project-wide to all MCP servers in that project
133 +
134 +## API Reference
135 +
136 +### Get Current Setting
137 +
138 +```http
139 +GET /api/v3/org/project/config
140 +```
141 +
142 +### Update Setting
143 +
144 +```http
145 +PATCH /api/v3/org/project/config
146 +
147 +{
148 + "require_mcp_api_key": true | false
149 +}
150 +```
151 +
152 +## Need Help?
153 +
154 +If you have questions about implementing API key enforcement for your MCP servers:
155 +- Join our [Discord community](https://discord.gg/composio)
156 +- Check our [MCP documentation](/docs/mcp/quickstart)
157 +- Contact support at support@composio.dev
158 +