- Interactive script to create repo and push code - Comprehensive MCP setup guide for future automation - Instructions for connecting MCP servers to Claude Code 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
5.4 KiB
MCP Server Setup Guide
What is MCP?
Model Context Protocol (MCP) is a standard for connecting AI assistants like Claude to external tools and data sources. Your cluster has MCP servers that provide programmatic access to services like Gitea.
MCP Servers in Your Cluster
Currently running MCP servers:
kubectl get svc -n mcp
- mcp-ecosystem-gitea-mcp (10.43.80.98:3014)
- mcp-umbrella-gitea-mcp (10.43.241.50:3014)
How to Connect MCP to Claude Code
To make MCP tools available in Claude Code sessions, you need to configure the MCP server connection in your Claude Code settings.
Method 1: Claude Code Configuration File
Create or edit ~/.config/claude-code/mcp.json (or the appropriate config location):
{
"mcpServers": {
"gitea": {
"url": "http://10.43.241.50:3014",
"token": "your-mcp-token-here",
"description": "Gitea MCP server for repository management"
}
}
}
Method 2: Environment Variables
Set MCP server configuration via environment variables:
export MCP_GITEA_URL="http://10.43.241.50:3014"
export MCP_GITEA_TOKEN="your-mcp-token-here"
Method 3: Port Forward for Local Access
If Claude Code runs locally (not in the cluster):
# Forward the MCP server port to localhost
kubectl port-forward -n mcp svc/mcp-umbrella-gitea-mcp 3014:3014
# Then configure Claude Code to use localhost:3014
MCP Token Management
Where to Find MCP Tokens
-
Check Kubernetes Secrets:
kubectl get secrets -n mcp kubectl get secret -n mcp <secret-name> -o yaml -
Generate New Token: If your MCP server supports token generation, you can create new tokens via its API or management interface.
Token Security
- MCP tokens are sensitive credentials
- Store them securely (use Kubernetes secrets, not in code)
- Rotate tokens periodically
- Use different tokens for different environments
Available MCP Tools
Once connected, MCP tools will appear in Claude Code with the mcp__ prefix, such as:
mcp__gitea_create_repo- Create a new repositorymcp__gitea_list_repos- List repositoriesmcp__gitea_push- Push code to a repositorymcp__gitea_webhook- Manage webhooks
(Actual tool names depend on your MCP server implementation)
Using MCP in Future Deployments
When you have MCP properly configured, Claude Code can automatically:
- Create Gitea repositories without manual API calls
- Push code without entering credentials
- Trigger builds by calling webhooks
- Monitor deployment status
- Update configurations in the cluster
Example Workflow with MCP
User: "Deploy my new app to Kubernetes"
Claude will automatically:
1. Use mcp__gitea_create_repo to create the Git repository
2. Use mcp__gitea_push to push the code
3. Use mcp__kubectl_apply to create Kubernetes resources
4. Use mcp__flux_sync to trigger Flux reconciliation
5. Use mcp__kubectl_get to check deployment status
Troubleshooting MCP Connection
Check if MCP is Connected
In a Claude Code session, MCP tools should appear in the available functions list. They'll start with mcp__.
Connection Issues
-
MCP server not reachable:
curl http://10.43.241.50:3014/health -
Token invalid:
- Verify the token hasn't expired
- Check token permissions
- Generate a new token
-
Claude Code not detecting MCP:
- Restart Claude Code
- Check configuration file syntax
- Verify MCP server is running
Testing MCP Access
# Test MCP server is responding
curl -H "Authorization: Bearer YOUR_TOKEN" \
http://10.43.241.50:3014/api/tools
# Should return list of available MCP tools
Setting Up MCP for Other Services
The same pattern can be used for other services:
Harbor Registry MCP
{
"mcpServers": {
"harbor": {
"url": "http://harbor-mcp-service:3015",
"token": "harbor-mcp-token",
"description": "Harbor registry management"
}
}
}
Kubernetes MCP
{
"mcpServers": {
"kubernetes": {
"url": "http://k8s-mcp-service:3016",
"token": "k8s-mcp-token",
"description": "Kubernetes cluster management"
}
}
}
Benefits of MCP Integration
- Automation - No manual steps for common tasks
- Security - Credentials managed centrally
- Efficiency - Faster deployments
- Consistency - Standardized workflows
- Error Reduction - Less manual intervention
Future Enhancements
Consider adding MCP servers for:
- ArgoCD - GitOps deployments
- Prometheus - Metrics and monitoring
- Vault - Secrets management
- Grafana - Dashboard creation
- AlertManager - Alert configuration
Quick Reference
Current Setup (Without MCP)
# Manual steps required:
1. Create Gitea repo via web UI or API
2. Git push with credentials
3. kubectl apply manifests
4. Wait for Flux sync
With MCP Connected
# Automated via Claude Code:
User: "Deploy this app"
# Claude handles everything automatically
Resources
- MCP Specification
- Claude Code Documentation
- Your cluster's MCP server documentation
Note: The specific MCP tools and configuration format may vary based on your MCP server implementation. Check your MCP server's documentation for exact details.