@legionai/mcp
v2.0.0
Published
Legion MCP Server - OAuth app management and Railway logs access for AI agents
Maintainers
Readme
Legion MCP Server
MCP server for AI agent integration — manage OAuth apps and access deployment logs from Claude Code, Cursor, or Windsurf.
For CLI commands (login, app management, log sources), install @legionai/cli.
Installation
npm install -g @legionai/mcpLogin (requires @legionai/cli)
npm install -g @legionai/cli
legion loginConfiguration
Add to your MCP config (e.g., ~/.config/claude/mcp.json):
{
"mcpServers": {
"legion": {
"command": "legion-mcp",
"env": {
"LEGION_AUTH_SERVER_URL": "https://auth.legion-ai.org",
"LEGION_ACCESS_TOKEN": "<your_token>"
}
}
}
}Available Tools
OAuth App Management (8 tools)
| Tool | Description |
|------|-------------|
| legion_list_oauth_apps | List all OAuth apps on your account |
| legion_get_oauth_app | Get details of an OAuth app by client ID |
| legion_create_oauth_app | Create a new OAuth app |
| legion_update_oauth_app | Update OAuth app name or redirect URIs |
| legion_delete_oauth_app | Delete an OAuth app (revokes all connections) |
| legion_rotate_app_secret | Rotate an OAuth app's client secret |
| legion_get_oauth_app_stats | Get usage stats (users, tokens, earnings) |
| legion_get_oauth_app_transactions | Get transaction history (prompts, costs) |
API Documentation (1 tool)
| Tool | Description |
|------|-------------|
| legion_get_api_docs | Get full API docs (request format, models, errors) |
Deployment Logs (5 tools)
| Tool | Description |
|------|-------------|
| legion_list_railway_sources | List connected Railway log sources |
| legion_connect_railway_source | Connect a Railway deployment as a log source |
| legion_get_deployment_logs | Fetch deployment logs with filters |
| legion_get_deployment_errors | Fetch error-level deployment logs only |
| legion_disconnect_railway_source | Remove a Railway log source connection |
Usage Example
Once configured, ask your AI agent:
- "List my OAuth apps and their stats"
- "Create a new OAuth app called my-saas with redirect URI https://myapp.com/callback"
- "Check my deployment logs for errors"
- "Connect my Railway deployment for debugging"
Security
- All access is authenticated via your Legion account
- You can only access logs for Railway deployments you've connected
- Tokens are encrypted at rest
- Access is rate-limited (30 requests/minute)
