ServiceNow Cowork Automation API
MCP-compatible backend that automates ServiceNow incident handling via Microsoft 365 Copilot, offering tools for incident analysis, automation, and job status retrieval.
README
ServiceNow Cowork Automation API
FastAPI + MCP-compatible backend for Microsoft 365 Copilot Cowork ServiceNow incident automation.
What this backend does
- Receives ServiceNow new-incident webhooks.
- Deduplicates automation jobs.
- Queues jobs to Azure Service Bus when enabled.
- Exposes controlled
/api/cowork/*APIs for Cowork plugin/MCP use. - Exposes a remote MCP-compatible
/mcpJSON-RPC endpoint. - Applies backend policy checks before ServiceNow or Microsoft Graph actions.
- Searches/classifies ServiceNow KB articles.
- Performs eligible Microsoft Entra ID password reset/profile update through Graph.
- Writes job, policy, KB, and audit records.
- Never returns or logs temporary passwords.
Local setup
python -m venv .venv
.\.venv\Scripts\activate
pip install -e ".[dev]"
copy .env.example .env
uvicorn app.main:app --reload
Test
pytest -q
pytest --cov=app
Required environment variables
See .env.example.
For local/dev, keep:
SERVICE_BUS_ENABLED=false
GRAPH_ENABLED=false
DATABASE_URL=sqlite+aiosqlite:///./cowork.db
For Azure, set DATABASE_URL, ServiceNow credentials, Graph settings, and Service Bus settings in App Service/Function App configuration or Key Vault references.
REST examples
Health:
curl http://localhost:8000/health
Webhook:
curl -X POST http://localhost:8000/api/servicenow/webhook/incidents ^
-H "Content-Type: application/json" ^
-H "x-api-key: local-test-key" ^
-d "{\"sys_id\":\"inc-1\",\"number\":\"INC0010001\",\"state\":\"New\",\"category\":\"access\",\"priority\":\"3\",\"short_description\":\"forgot password\"}"
Analyze:
curl -X POST http://localhost:8000/api/cowork/incidents/analyze ^
-H "Content-Type: application/json" ^
-H "x-api-key: local-test-key" ^
-d "{\"incident_sys_id\":\"inc-1\",\"authenticated_user_upn\":\"user@contoso.com\"}"
MCP initialize:
curl -X POST http://localhost:8000/mcp ^
-H "Content-Type: application/json" ^
-d "{\"jsonrpc\":\"2.0\",\"id\":1,\"method\":\"initialize\",\"params\":{}}"
List MCP tools:
curl -X POST http://localhost:8000/mcp ^
-H "Content-Type: application/json" ^
-d "{\"jsonrpc\":\"2.0\",\"id\":2,\"method\":\"tools/list\",\"params\":{}}"
Safety model
Cowork should mainly call:
analyze_incidentrun_incident_automationget_automation_job_status
The backend remains the final trust boundary for identity, policy, VIP/admin/security exclusions, KB safety classification, and Graph actions.
Recommended Servers
playwright-mcp
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
Magic Component Platform (MCP)
An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.
Audiense Insights MCP Server
Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
graphlit-mcp-server
The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.
Kagi MCP Server
An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.
E2B
Using MCP to run code via e2b.
Neon Database
MCP server for interacting with Neon Management API and databases
Exa Search
A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.