|
| 1 | +@MCP |
| 2 | +Feature: MCP Server Management API tests |
| 3 | + |
| 4 | + Tests for the dynamic MCP server management endpoints: |
| 5 | + POST /v1/mcp-servers, GET /v1/mcp-servers, DELETE /v1/mcp-servers/{name} |
| 6 | + |
| 7 | + Background: |
| 8 | + Given The service is started locally |
| 9 | + And REST API service prefix is /v1 |
| 10 | + |
| 11 | + Scenario: List MCP servers returns pre-configured servers |
| 12 | + Given The system is in default state |
| 13 | + When I access REST API endpoint "mcp-servers" using HTTP GET method |
| 14 | + Then The status code of the response is 200 |
| 15 | + And The body of the response contains mcp-oauth |
| 16 | + And The body of the response contains config |
| 17 | + |
| 18 | + Scenario: List MCP servers response has expected structure |
| 19 | + Given The system is in default state |
| 20 | + When I access REST API endpoint "mcp-servers" using HTTP GET method |
| 21 | + Then The status code of the response is 200 |
| 22 | + And the body of the response has the following structure |
| 23 | + """ |
| 24 | + { |
| 25 | + "servers": [ |
| 26 | + { |
| 27 | + "name": "mcp-oauth", |
| 28 | + "url": "http://mock-mcp:3001", |
| 29 | + "provider_id": "model-context-protocol", |
| 30 | + "source": "config" |
| 31 | + } |
| 32 | + ] |
| 33 | + } |
| 34 | + """ |
| 35 | + |
| 36 | + Scenario: Register duplicate MCP server returns 409 |
| 37 | + Given The system is in default state |
| 38 | + When I access REST API endpoint "mcp-servers" using HTTP POST method |
| 39 | + """ |
| 40 | + {"name": "mcp-oauth", "url": "http://mock-mcp:3001", "provider_id": "model-context-protocol"} |
| 41 | + """ |
| 42 | + Then The status code of the response is 409 |
| 43 | + And The body of the response contains already exists |
| 44 | + |
| 45 | + Scenario: Delete statically configured MCP server returns 403 |
| 46 | + Given The system is in default state |
| 47 | + When I access REST API endpoint "mcp-servers/mcp-oauth" using HTTP DELETE method |
| 48 | + Then The status code of the response is 403 |
| 49 | + And The body of the response contains statically configured |
| 50 | + |
| 51 | + Scenario: Delete non-existent MCP server returns 404 |
| 52 | + Given The system is in default state |
| 53 | + When I access REST API endpoint "mcp-servers/non-existent-server" using HTTP DELETE method |
| 54 | + Then The status code of the response is 404 |
| 55 | + |
| 56 | + Scenario: Register MCP server with invalid request body returns 422 |
| 57 | + Given The system is in default state |
| 58 | + When I access REST API endpoint "mcp-servers" using HTTP POST method |
| 59 | + """ |
| 60 | + {"url": "http://mock-mcp:3001"} |
| 61 | + """ |
| 62 | + Then The status code of the response is 422 |
| 63 | + |
| 64 | + Scenario: Register MCP server with invalid URL scheme returns 422 |
| 65 | + Given The system is in default state |
| 66 | + When I access REST API endpoint "mcp-servers" using HTTP POST method |
| 67 | + """ |
| 68 | + {"name": "bad-url-server", "url": "ftp://mock-mcp:3001"} |
| 69 | + """ |
| 70 | + Then The status code of the response is 422 |
| 71 | + |
| 72 | + @skip-in-library-mode |
| 73 | + Scenario: Register and delete MCP server lifecycle |
| 74 | + Given The system is in default state |
| 75 | + When I access REST API endpoint "mcp-servers" using HTTP POST method |
| 76 | + """ |
| 77 | + {"name": "e2e-lifecycle-server", "url": "http://mock-mcp:3001", "provider_id": "model-context-protocol"} |
| 78 | + """ |
| 79 | + Then The status code of the response is 201 |
| 80 | + And The body of the response contains e2e-lifecycle-server |
| 81 | + And The body of the response contains registered successfully |
| 82 | + When I access REST API endpoint "mcp-servers" using HTTP GET method |
| 83 | + Then The status code of the response is 200 |
| 84 | + And The body of the response contains e2e-lifecycle-server |
| 85 | + And The body of the response contains api |
| 86 | + When I access REST API endpoint "mcp-servers/e2e-lifecycle-server" using HTTP DELETE method |
| 87 | + Then The status code of the response is 200 |
| 88 | + And The body of the response contains unregistered successfully |
| 89 | + When I access REST API endpoint "mcp-servers" using HTTP GET method |
| 90 | + Then The status code of the response is 200 |
0 commit comments