Skip to main content
Glama

Azure Revisor MCP Server

index.ts2.21 kB
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js"; import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js"; import { SSEServerTransport } from "@modelcontextprotocol/sdk/server/sse.js"; import express, { Request, Response } from "express"; import { z } from "zod"; import { getPullRequestDetails, getPullRequestDiff } from "./get-diff.js"; import { createThreadComment } from "./comment.js"; // Initialize the MCP server const server = new McpServer({ name: "AzureRevisorServer", version: "1.0.0", }); server.tool( "Get pull request diff", { pullRequestUrl: z.string().describe("The URL of the pull request"), }, async ({ pullRequestUrl }: { pullRequestUrl: string }) => { const diff = await getPullRequestDiff(pullRequestUrl); return { content: [{ type: "text", text: diff }], }; } ); server.tool( "Create thread comment", { pullRequestUrl: z.string().describe("The URL of the pull request"), filePath: z.string().describe("The path of the file to comment"), lineNumber: z.number().describe("The line number to comment"), commentContent: z.string().describe("The content of the comment"), }, async ({ pullRequestUrl, filePath, lineNumber, commentContent, }: { pullRequestUrl: string; filePath: string; lineNumber: number; commentContent: string; }) => { const prInfo = getPullRequestDetails(pullRequestUrl); await createThreadComment(prInfo, filePath, lineNumber, commentContent); return { content: [{ type: "text", text: "Comment created successfully" }], }; } ); // Function to start the server async function startServer() { const app = express(); let transport: SSEServerTransport | null = null; app.get("/sse", async (req: Request, res: Response) => { transport = new SSEServerTransport("/messages", res); await server.connect(transport); }); app.post("/messages", async (req: Request, res: Response) => { if (transport) { await transport.handlePostMessage(req, res); } }); app.listen(3000, () => { console.log("Server is running on port 3000"); }); } // Start the server startServer();

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/mikhael-abdallah/mcp-revisor-server'

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