Skip to main content
Glama

CodeGraph CLI MCP Server

by Jakedismo
error.rs1.74 kB
use axum::{ http::StatusCode, response::{IntoResponse, Response}, Json, }; use codegraph_core::CodeGraphError; use serde_json::json; use thiserror::Error; #[derive(Error, Debug)] pub enum ApiError { #[error("CodeGraph error: {0}")] CodeGraph(#[from] CodeGraphError), #[error("Validation error: {0}")] Validation(String), #[error("Not found: {0}")] NotFound(String), #[error("Internal server error: {0}")] Internal(String), #[error("Bad request: {0}")] BadRequest(String), #[error("Service unavailable: {0}")] ServiceUnavailable(String), } impl IntoResponse for ApiError { fn into_response(self) -> Response { let (status, error_message) = match self { ApiError::CodeGraph(ref err) => match err { CodeGraphError::NodeNotFound(_) => (StatusCode::NOT_FOUND, self.to_string()), CodeGraphError::InvalidOperation(_) => (StatusCode::BAD_REQUEST, self.to_string()), _ => (StatusCode::INTERNAL_SERVER_ERROR, self.to_string()), }, ApiError::Validation(_) => (StatusCode::BAD_REQUEST, self.to_string()), ApiError::NotFound(_) => (StatusCode::NOT_FOUND, self.to_string()), ApiError::BadRequest(_) => (StatusCode::BAD_REQUEST, self.to_string()), ApiError::Internal(_) => (StatusCode::INTERNAL_SERVER_ERROR, self.to_string()), ApiError::ServiceUnavailable(_) => (StatusCode::SERVICE_UNAVAILABLE, self.to_string()), }; let body = Json(json!({ "error": error_message, "status": status.as_u16() })); (status, body).into_response() } } pub type ApiResult<T> = Result<T, ApiError>;

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/Jakedismo/codegraph-rust'

If you have feedback or need assistance with the MCP directory API, please join our Discord server