|
1 | 1 | --- |
2 | | -title: "MCP Server" |
3 | | -description: "Connect AI agents to Codegen using the Model Context Protocol (MCP) server" |
| 2 | +title: "Remote MCP Server" |
| 3 | +description: "Connect AI agents to Codegen using the hosted Model Context Protocol (MCP) server" |
4 | 4 | icon: "server" |
5 | 5 | --- |
6 | 6 |
|
7 | | -The Codegen MCP server enables AI agents to interact with the Codegen platform through the Model Context Protocol (MCP). This integration allows AI agents to access Codegen APIs, manage agent runs, and interact with your development workflow. |
| 7 | +Codegen provides a hosted MCP server that allows AI agents to interact with the Codegen platform through the Model Context Protocol (MCP). This integration enables AI agents to access Codegen APIs, manage agent runs, and interact with your development workflow without running a local server. |
8 | 8 |
|
9 | 9 | ## Overview |
10 | 10 |
|
11 | | -The MCP server provides: |
| 11 | +The remote MCP server provides: |
12 | 12 |
|
| 13 | +- **Cloud-Based Integration**: Access Codegen services from anywhere without local setup |
13 | 14 | - **API Integration**: Direct access to Codegen platform APIs |
14 | 15 | - **Agent Management**: Create and monitor agent runs |
15 | 16 | - **Organization Management**: Access organization and user information |
16 | 17 | - **Workflow Integration**: Seamless integration with AI development tools |
17 | 18 |
|
18 | | -## Installation |
| 19 | +## Configuration |
| 20 | + |
| 21 | +### For Claude Code |
19 | 22 |
|
20 | | -The MCP server is included with the Codegen CLI. Install it using: |
| 23 | +To configure the remote Codegen MCP server in Claude Code: |
21 | 24 |
|
22 | 25 | ```bash |
23 | | -uv tool install codegen |
| 26 | +claude mcp add --transport http codegen-tools https://mcp.codegen.com/mcp/ --header "Authorization: Bearer <auth token>" |
24 | 27 | ``` |
25 | 28 |
|
26 | | -## Configuration |
| 29 | +Replace `<auth token>` with your Codegen API key. |
27 | 30 |
|
28 | | -### For Cline (VS Code Extension) |
| 31 | +### For Cursor/Windsurf/VSCode Forks |
29 | 32 |
|
30 | | -Add this to your `cline_mcp_settings.json` file: |
| 33 | +Add the following configuration to your settings: |
31 | 34 |
|
32 | 35 | ```json |
33 | 36 | { |
34 | | - "mcpServers": { |
35 | | - "codegen": { |
36 | | - "command": "codegen", |
37 | | - "args": ["mcp"], |
38 | | - "cwd": "<path to your project>" |
| 37 | + "mcp.servers": { |
| 38 | + "codegen-remote": { |
| 39 | + "transport": "http", |
| 40 | + "url": "https://mcp.codegen.com/mcp/", |
| 41 | + "headers": { |
| 42 | + "Authorization": "Bearer <auth token>" |
| 43 | + } |
39 | 44 | } |
40 | 45 | } |
41 | 46 | } |
42 | 47 | ``` |
43 | 48 |
|
44 | | -### For Claude Desktop |
45 | | - |
46 | | -Under the `Settings` > `Feature` > `MCP Servers` section, click "Add New MCP Server" and add the following: |
47 | | - |
48 | | -- **Server Name**: codegen-mcp |
49 | | -- **Command**: `codegen` |
50 | | -- **Arguments**: `["mcp"]` |
51 | | - |
52 | | -### For Cursor |
53 | | - |
54 | | -To configure the Codegen MCP server in Cursor: |
| 49 | +Replace `<auth token>` with your Codegen API key. |
55 | 50 |
|
56 | | -1. Open Cursor Settings (Cmd/Ctrl + ,) |
57 | | -2. Navigate to `Features` > `Model Context Protocol` |
58 | | -3. Click "Add Server" and configure: |
59 | | - - **Server Name**: `codegen-mcp` |
60 | | - - **Command**: `codegen` |
61 | | - - **Arguments**: `["mcp"]` |
62 | | - - **Working Directory**: `<path to your project>` (optional) |
| 51 | +### For VSCode with MCP Extension |
63 | 52 |
|
64 | | -Alternatively, you can add the configuration directly to your Cursor settings file: |
| 53 | +If you're using VSCode with an MCP extension, add this to your settings.json: |
65 | 54 |
|
66 | 55 | ```json |
67 | 56 | { |
68 | | - "mcp.servers": { |
69 | | - "codegen": { |
70 | | - "command": "codegen", |
71 | | - "args": ["mcp"], |
72 | | - "cwd": "<path to your project>" |
| 57 | + "mcp.servers": [ |
| 58 | + { |
| 59 | + "name": "codegen-remote", |
| 60 | + "transport": "http", |
| 61 | + "url": "https://mcp.codegen.com/mcp/", |
| 62 | + "headers": { |
| 63 | + "Authorization": "Bearer <auth token>" |
| 64 | + } |
73 | 65 | } |
74 | | - } |
| 66 | + ] |
75 | 67 | } |
76 | 68 | ``` |
77 | 69 |
|
78 | | -## Usage |
79 | | - |
80 | | -### Starting the Server |
81 | | - |
82 | | -Start the MCP server using the Codegen CLI: |
83 | | - |
84 | | -```bash |
85 | | -# Start with stdio transport (default) |
86 | | -codegen mcp |
87 | | - |
88 | | -# Start with HTTP transport on a specific port |
89 | | -codegen mcp --transport http --port 8080 |
90 | | - |
91 | | -# Start with custom host and port |
92 | | -codegen mcp --transport http --host 0.0.0.0 --port 3000 |
93 | | -``` |
94 | | - |
95 | | -The server will display the transport method and port information when it starts: |
96 | | - |
97 | | -``` |
98 | | -🚀 Starting Codegen MCP server... |
99 | | -📡 Using stdio transport |
100 | | -🚀 MCP server running on stdio transport |
101 | | -``` |
102 | | - |
103 | | -### Environment Variables |
104 | | - |
105 | | -Configure the MCP server using these environment variables: |
106 | | - |
107 | | -- `CODEGEN_API_KEY`: Your Codegen API key for authentication |
108 | | -- `CODEGEN_API_BASE_URL`: Base URL for the Codegen API (defaults to `https://api.codegen.com`) |
109 | | - |
110 | | -## Available Tools |
111 | | - |
112 | | -The MCP server provides the following tools for AI agents: |
113 | | - |
114 | | -### Agent Management |
115 | | - |
116 | | -- **create_agent_run**: Create a new agent run in your organization |
117 | | -- **get_agent_run**: Get details of a specific agent run |
118 | | - |
119 | | -### Organization Management |
120 | | - |
121 | | -- **get_organizations**: List organizations you have access to |
122 | | -- **get_users**: List users in an organization |
123 | | -- **get_user**: Get details of a specific user |
124 | | - |
125 | | -## Transport Options |
126 | | - |
127 | | -The MCP server supports two transport methods: |
128 | | - |
129 | | -### stdio (Default) |
130 | | - |
131 | | -- Best for most AI agents and IDE integrations |
132 | | -- Direct communication through standard input/output |
133 | | -- No network configuration required |
134 | | - |
135 | | -### HTTP |
136 | | - |
137 | | -- Useful for web-based integrations |
138 | | -- Requires specifying host and port |
139 | | -- Currently falls back to stdio (HTTP support coming soon) |
| 70 | +Replace `<auth token>` with your Codegen API key. |
140 | 71 |
|
141 | 72 | ## Authentication |
142 | 73 |
|
143 | | -The MCP server uses your Codegen API key for authentication. You can obtain your API key from the [Codegen dashboard](https://codegen.com/settings). |
144 | | - |
145 | | -Set your API key as an environment variable: |
146 | | - |
147 | | -```bash |
148 | | -export CODEGEN_API_KEY="your-api-key-here" |
149 | | -``` |
150 | | - |
151 | | -## Troubleshooting |
152 | | - |
153 | | -### Common Issues |
154 | | - |
155 | | -**Server won't start** |
156 | | - |
157 | | -- Ensure the Codegen CLI is properly installed |
158 | | -- Check that your API key is set correctly |
159 | | -- Verify network connectivity to the Codegen API |
160 | | - |
161 | | -**Authentication errors** |
162 | | - |
163 | | -- Verify your API key is valid and not expired |
164 | | -- Check that the API key has the necessary permissions |
165 | | -- Ensure the `CODEGEN_API_KEY` environment variable is set |
| 74 | +The remote MCP server uses your Codegen API key for authentication. You can obtain your API key from the [Codegen dashboard](https://codegen.com/settings). |
166 | 75 |
|
167 | | -**Connection issues** |
| 76 | +## Available Tools |
168 | 77 |
|
169 | | -- For stdio transport, ensure your AI agent supports MCP |
170 | | -- For HTTP transport, check firewall settings and port availability |
171 | | -- Verify the host and port configuration |
| 78 | +The remote MCP server provides the following tools for AI agents: |
172 | 79 |
|
173 | 80 | ### Getting Help |
174 | 81 |
|
175 | | -If you encounter issues with the MCP server: |
| 82 | +If you encounter issues with the remote MCP server: |
176 | 83 |
|
177 | 84 | 1. Check the [Codegen documentation](https://docs.codegen.com) |
178 | 85 | 2. Join our [community Slack](https://community.codegen.com) |
179 | 86 | 3. Report issues on [GitHub](https://github.com/codegen-sh/codegen) |
180 | 87 |
|
181 | | -## Examples |
182 | | - |
183 | | -### Creating an Agent Run |
184 | | - |
185 | | -```python |
186 | | -# Example of how an AI agent might use the MCP server |
187 | | -# This would be handled automatically by your AI agent |
188 | | - |
189 | | -{ |
190 | | - "tool": "create_agent_run", |
191 | | - "arguments": { |
192 | | - "org_id": 123, |
193 | | - "prompt": "Review the latest pull request and suggest improvements", |
194 | | - "repo_name": "my-project", |
195 | | - "branch_name": "feature-branch" |
196 | | - } |
197 | | -} |
198 | | -``` |
199 | | - |
200 | | -### Getting Organization Information |
201 | | - |
202 | | -```python |
203 | | -{ |
204 | | - "tool": "get_organizations", |
205 | | - "arguments": { |
206 | | - "page": 1, |
207 | | - "limit": 10 |
208 | | - } |
209 | | -} |
210 | | -``` |
211 | | - |
212 | | -The MCP server makes it easy to integrate Codegen's powerful AI development capabilities into your existing AI agent workflows. |
| 88 | +The remote MCP server makes it easy to integrate Codegen's powerful AI development capabilities into your existing AI agent workflows without the need to run a local server. |
0 commit comments