Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -153,17 +153,17 @@ pnpm run dev
```
Once the server is running, you can utilize the MCP server within Visual Studio Code or other MCP client.

## Upgrading ArgoCD Types
### Upgrading ArgoCD Types

To update the TypeScript type definitions based on the latest Argo CD API specification:

1. Download the `swagger.json` file from the [ArgoCD release page](https://github.com/argoproj/argo-cd/releases), for example here is the [swagger.json link](https://github.com/argoproj/argo-cd/blob/v2.14.11/assets/swagger.json) for ArgoCD v2.14.11.
1. Download the `swagger.json` file from the [ArgoCD release page](https://github.com/argoproj/argo-cd/releases), for example here is the [swagger.json link](https://github.com/argoproj/argo-cd/blob/v2.14.11/assets/swagger.json) for ArgoCD v2.14.11.

2. Place the downloaded `swagger.json` file in the root directory of the `argocd-mcp` project.
2. Place the downloaded `swagger.json` file in the root directory of the `argocd-mcp` project.

3. Generate the TypeScript types from the Swagger definition by running the following command. This will create or overwrite the `src/types/argocd.d.ts` file:
3. Generate the TypeScript types from the Swagger definition by running the following command. This will create or overwrite the `src/types/argocd.d.ts` file:
```bash
pnpm run generate-types
```

4. Update the `src/types/argocd-types.ts` file to export the required types from the newly generated `src/types/argocd.d.ts`. This step often requires manual review to ensure only necessary types are exposed.
4. Update the `src/types/argocd-types.ts` file to export the required types from the newly generated `src/types/argocd.d.ts`. This step often requires manual review to ensure only necessary types are exposed.
7 changes: 6 additions & 1 deletion src/server/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,12 @@ export class Server extends McpServer {
'list_applications',
'list_applications returns list of applications',
{
search: z.string().nullish().describe('Search applications by name, optional')
search: z
.string()
.optional()
.describe(
'Search applications by name. This is a partial match on the application name and does not support glob patterns (e.g. "*"). Optional.'
)
},
async ({ search }) =>
await this.argocdClient.listApplications({ search: search ?? undefined })
Expand Down
15 changes: 13 additions & 2 deletions src/shared/models/schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,20 @@ export const ApplicationSchema = z.object({
})
}),
destination: z.object({
server: z.string(),
namespace: z.string(),
server: z.string().optional(),
namespace: z.string().optional(),
name: z.string().optional()
})
.refine(
data =>
(!data.server && !!data.name) || (!!data.server && !data.name),
{
message: "Only one of server or name must be specified in destination"
}
)
.describe(
`The destination of the application.
Only one of server or name must be specified.`
)
})
});