Avinash-Venkatswamy/mcp-server-final
If you are the rightful owner of mcp-server-final and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to henry@mcphub.com.
The MCP Server is a standalone server providing HTTP REST API and WebSocket endpoints for Model Context Protocol operations, facilitating integrations with platforms like Jira and ServiceNow.
MCP Server
A standalone MCP (Model Context Protocol) server that provides HTTP REST API and WebSocket endpoints for MCP operations. This server can be used by any application to interact with MCP servers for Jira, ServiceNow, and other integrations.
Features
- REST API: HTTP endpoints for MCP server management and operations
- WebSocket API: Real-time communication for MCP operations
- Server Management: Start, stop, restart, and monitor MCP servers
- Tool Execution: Execute MCP tools and process natural language requests
- Configuration Management: Dynamic configuration updates
- Health Monitoring: Server health checks and status monitoring
Architecture
mcp-server/
āāā 01_server/ # Core server components
ā āāā 01_core/ # Core MCP functionality
ā āāā 02_api/ # REST and WebSocket APIs
ā āāā 03_config/ # Configuration management
ā āāā 04_utils/ # Utility functions
āāā 02_mcp_servers/ # MCP server configurations
ā āāā 01_jira_mcp/ # Jira MCP server
ā āāā 02_servicenow_mcp/ # ServiceNow MCP server
ā āāā 03_common/ # Common MCP components
āāā 03_communication/ # Communication libraries
āāā 04_documentation/ # Documentation
āāā 05_tests/ # Test suites
āāā 06_deployment/ # Deployment scripts
Quick Start
Prerequisites
- Python 3.8 or higher
- Virtual environment (recommended)
Installation
-
Clone the repository
git clone <repository-url> cd mcp-server
-
Create virtual environment
python -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate
-
Install dependencies
pip install -r requirements.txt
-
Configure environment
cp env.example .env # Edit .env with your configuration
-
Start the server
python main.py
The server will start on http://localhost:8001
API Endpoints
REST API
Server Management
GET /api/v1/status
- Get overall system statusPOST /api/v1/servers/start
- Start an MCP serverPOST /api/v1/servers/stop
- Stop an MCP serverPOST /api/v1/servers/restart
- Restart an MCP server
MCP Operations
GET /api/v1/mcp/tools
- Get available tools from an MCP serverPOST /api/v1/mcp/process_request
- Process a natural language requestPOST /api/v1/mcp/call_tool
- Call a specific MCP tool
Configuration
GET /api/v1/config
- Get current configurationPUT /api/v1/config
- Update configurationPOST /api/v1/config/reload
- Reload configuration
WebSocket API
Connect to ws://localhost:8001/ws
for real-time communication.
Message Types
ping
- Health checksubscribe
- Subscribe to eventsmcp_request
- MCP operation requestserver_action
- Server management action
Events
mcp_server_status
- Server status updatesmcp_tool_execution
- Tool execution resultsmcp_error
- Error notificationsserver_health_update
- Health updates
Usage Examples
REST API Examples
Start a Jira MCP Server
curl -X POST "http://localhost:8001/api/v1/servers/start" \
-H "Content-Type: application/json" \
-d '{"server_name": "jira-mcp", "action": "start"}'
Process a Natural Language Request
curl -X POST "http://localhost:8001/api/v1/mcp/process_request" \
-H "Content-Type: application/json" \
-d '{
"request": "Get all active users from Jira",
"system": "jira",
"provider": "openai",
"api_key": "your_api_key"
}'
Get Available Tools
curl "http://localhost:8001/api/v1/mcp/tools?server_name=jira-mcp"
WebSocket Examples
JavaScript Client
const ws = new WebSocket('ws://localhost:8001/ws');
ws.onopen = function() {
// Subscribe to events
ws.send(JSON.stringify({
type: 'subscribe',
events: ['mcp_server_status', 'mcp_tool_execution']
}));
// Send MCP request
ws.send(JSON.stringify({
type: 'mcp_request',
request_id: '123',
request: 'Get active users from Jira',
system: 'jira'
}));
};
ws.onmessage = function(event) {
const data = JSON.parse(event.data);
console.log('Received:', data);
};
Python Client
import websockets
import json
import asyncio
async def mcp_client():
uri = "ws://localhost:8001/ws"
async with websockets.connect(uri) as websocket:
# Subscribe to events
await websocket.send(json.dumps({
"type": "subscribe",
"events": ["mcp_server_status", "mcp_tool_execution"]
}))
# Send MCP request
await websocket.send(json.dumps({
"type": "mcp_request",
"request_id": "123",
"request": "Get active users from Jira",
"system": "jira"
}))
# Listen for responses
async for message in websocket:
data = json.loads(message)
print(f"Received: {data}")
asyncio.run(mcp_client())
Configuration
Environment Variables
Variable | Description | Default |
---|---|---|
MCP_SERVER_PORT | Server port | 8001 |
MCP_SERVER_HOST | Server host | 0.0.0.0 |
MCP_LOG_LEVEL | Logging level | INFO |
MCP_MAX_CONNECTIONS | Max WebSocket connections | 100 |
MCP_AUTH_TOKEN | Authentication token | - |
OPENAI_API_KEY | OpenAI API key | - |
ANTHROPIC_API_KEY | Anthropic API key | - |
MCP Server Configuration
MCP servers are configured in the 02_mcp_servers/
directory:
01_jira_mcp/01_config.json
- Jira MCP server configuration02_servicenow_mcp/01_config.json
- ServiceNow MCP server configuration
Development
Running Tests
# Run all tests
python -m pytest 05_tests/
# Run specific test categories
python -m pytest 05_tests/01_unit_tests/
python -m pytest 05_tests/02_integration_tests/
python -m pytest 05_tests/03_api_tests/
Code Structure
- Core Components: MCP server management, launcher, client integration
- API Layer: REST and WebSocket endpoints
- Configuration: Environment and server configuration management
- Utilities: Health checks, process management, security
Deployment
Docker Deployment
# Build image
docker build -t mcp-server .
# Run container
docker run -p 8001:8001 mcp-server
Production Deployment
- Set up environment variables
- Configure reverse proxy (nginx)
- Set up SSL certificates
- Configure monitoring and logging
- Set up process management (systemd, supervisor)
Troubleshooting
Common Issues
-
Port already in use
- Check if another service is using port 8001
- Change port in configuration
-
MCP server not starting
- Check MCP server configuration
- Verify dependencies are installed
- Check logs for errors
-
WebSocket connection issues
- Verify WebSocket endpoint is accessible
- Check firewall settings
- Ensure proper message format
Logs
Logs are written to mcp_server.log
by default. Set LOG_LEVEL
in environment for more detailed logging.
Contributing
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests
- Submit a pull request
License
[Add your license information here]
Support
For support and questions:
- Create an issue in the repository
- Check the documentation
- Review the troubleshooting section