Self-MCP

Self-MCP

A Model Context Protocol (MCP) server that provides unified access to one's professional profile, including experience, publications, career timeline, and social media presence.

Category
Visit Server

README

Self-MCP

A Model Context Protocol (MCP) server that provides unified access to one's professional profile, including experience, publications, career timeline, and social media presence.

Self-MCP

Features

  • Profile Overview: Fetch comprehensive background information
  • Experience Data: Access detailed work experience and professional history
  • Publications: Retrieve scientific publications and conference presentations
  • Career Timeline: Get career progression and milestones
  • Social Media Integration: Access to LinkedIn, Instagram, Facebook, and YouTube profiles
  • Content Search: Search across all profile content
  • LLM Integration: Works with free LLM endpoints (Ollama, Hugging Face)

Installation

  1. Clone or download the code files

  2. Install dependencies:

pip install -r requirements.txt
  1. Optional: Install the package:
pip install -e .

Quick Start

Running the MCP Server

python haris_profile_server.py

The server runs using stdio transport and communicates via JSON-RPC messages.

Running the Client

python mcp_client.py

This will start an interactive chat interface where you can ask questions about Haris Gulzar's profile.

LLM Integration Options

The client supports multiple free LLM options:

1. Ollama (Recommended - Local)

Install Ollama locally:

# Install Ollama from https://ollama.ai/
ollama pull llama2  # or any other model

2. Hugging Face Inference API (Free Tier)

  • No setup required for basic usage
  • Optional: Get a free API token from https://huggingface.co/settings/tokens
  • Set the token in the client code if you want higher rate limits

3. Other Free LLM APIs

You can easily extend the client to work with other free LLM services:

  • Together AI
  • Groq
  • OpenRouter (free tier)
  • Local models via llama.cpp, oobabooga, etc.

Available Tools

The MCP server provides these tools:

  1. get_profile_overview: Professional overview and background
  2. get_experience: Work experience and professional history
  3. get_publications: Scientific publications and conferences
  4. get_career_timeline: Career progression and milestones
  5. get_social_links: Social media profiles and links
  6. search_profile_content: Search across all profile content

Usage Examples

Interactive Chat Examples

You: Tell me about Haris Gulzar's background
You: What is his work experience?
You: Show me his publications
You: What are his social media profiles?
You: Search for machine learning in his profile

Programmatic Usage

from mcp_client import HarisProfileClient

client = HarisProfileClient()
await client.connect_to_server()

# Get overview
overview = await client.call_tool("get_profile_overview")
print(overview)

# Search for specific content
results = await client.call_tool("search_profile_content", {"query": "research"})
print(results)

Deployment Options

1. Local Development

Run both server and client locally as shown above.

2. Docker Deployment

Create a Dockerfile:

FROM python:3.9-slim

WORKDIR /app
COPY requirements.txt .
RUN pip install -r requirements.txt

COPY . .

EXPOSE 8000
CMD ["python", "haris_profile_server.py"]

Build and run:

docker build -t haris-profile-mcp .
docker run -p 8000:8000 haris-profile-mcp

3. Cloud Deployment

The MCP server can be deployed to:

  • Heroku: Create a Procfile with worker: python haris_profile_server.py
  • Railway: Direct deployment from Git repository
  • Google Cloud Run: Use the Dockerfile above
  • AWS Lambda: Requires adaptation for serverless environment

Configuration

Environment Variables

Create a .env file:

# Optional LLM API keys
OPENAI_API_KEY=your_key_here
ANTHROPIC_API_KEY=your_key_here
HUGGINGFACE_API_KEY=your_key_here

# Server configuration
SERVER_PORT=8000
LOG_LEVEL=INFO

# Timeout settings
HTTP_TIMEOUT=30
MCP_TIMEOUT=60

Custom Configuration

You can customize the server by modifying the profile URLs and social media links in haris_profile_server.py:

# Profile data URLs
self.profile_urls = {
    "overview": "https://sites.google.com/view/haris-gulzar/home",
    "experience": "https://sites.google.com/view/haris-gulzar/experience", 
    "publications": "https://sites.google.com/view/haris-gulzar/publications",
    "career_timeline": "https://sites.google.com/view/haris-gulzar/career-timeline"
}

# Social media URLs
self.social_urls = {
    "linkedin": "https://www.linkedin.com/in/haris-gulzar/",
    "instagram": "https://www.instagram.com/japanviaharis/",
    "facebook": "https://www.facebook.com/mharisgulzar/",
    "youtube": "https://www.youtube.com/@japanviaharis"
}

Testing

Test the MCP Server

# Test server connectivity
python -c "
import asyncio
from mcp_client import HarisProfileClient

async def test():
    client = HarisProfileClient()
    connected = await client.connect_to_server()
    print('Connected:', connected)
    if connected:
        tools = await client.get_available_tools()
        print('Available tools:', len(tools))
        for tool in tools:
            print(f'  - {tool[\"name\"]}')

asyncio.run(test())
"

Test Individual Tools

python -c "
import asyncio
from mcp_client import HarisProfileClient

async def test_tool():
    client = HarisProfileClient()
    await client.connect_to_server()
    
    # Test overview tool
    result = await client.call_tool('get_profile_overview')
    print('Overview result length:', len(result))
    print('First 200 chars:', result[:200])

asyncio.run(test_tool())
"

Extending the Server

Adding New Tools

To add new tools, modify the _setup_handlers method in HarisProfileServer:

Tool(
    name="get_certifications",
    description="Fetch professional certifications",
    inputSchema={
        "type": "object",
        "properties": {
            "category": {
                "type": "string",
                "description": "Certification category"
            }
        },
        "required": []
    }
)

And add the corresponding handler:

elif name == "get_certifications":
    category = arguments.get("category", "all") if arguments else "all"
    return await self._get_certifications(category)

Adding New Data Sources

  1. Add URL to profile_urls or create a new category
  2. Implement a fetching method
  3. Add the tool definition
  4. Update the prompt template

Custom Content Parsing

For better content extraction from specific sites, modify the _fetch_and_parse_content method:

async def _fetch_and_parse_content(self, url: str) -> str:
    """Enhanced content parsing for specific sites"""
    response = await self.client.get(url)
    soup = BeautifulSoup(response.text, 'html.parser')
    
    # Site-specific parsing logic
    if 'sites.google.com' in url:
        return self._parse_google_sites(soup)
    elif 'linkedin.com' in url:
        return self._parse_linkedin(soup)
    # Add more site-specific parsers
    
    return self._parse_generic(soup)

Integration with Other MCP Clients

This server works with any MCP-compatible client:

Claude Desktop Integration

Add to your claude_desktop_config.json:

{
  "mcpServers": {
    "haris-profile": {
      "command": "python",
      "args": ["/path/to/haris_profile_server.py"]
    }
  }
}

Custom MCP Client

from mcp import ClientSession
from mcp.client.stdio import stdio_client

async def custom_client():
    session = await stdio_client(StdioServerParameters(
        command="python",
        args=["haris_profile_server.py"]
    ))
    
    # List available tools
    tools = await session.list_tools()
    
    # Call a tool
    result = await session.call_tool("get_profile_overview")
    
    return result

Monitoring and Logging

Enable Detailed Logging

import logging
logging.basicConfig(
    level=logging.DEBUG,
    format='%(asctime)s - %(name)s - %(levelname)s - %(message)s',
    handlers=[
        logging.FileHandler('haris_profile_server.log'),
        logging.StreamHandler()
    ]
)

Health Check Endpoint

For production deployments, consider adding a health check:

from fastapi import FastAPI
import uvicorn

app = FastAPI()

@app.get("/health")
async def health_check():
    return {"status": "healthy", "server": "haris-profile-mcp"}

# Run alongside MCP server
if __name__ == "__main__":
    # Start FastAPI in background
    import threading
    threading.Thread(
        target=lambda: uvicorn.run(app, host="0.0.0.0", port=8001)
    ).start()
    
    # Start MCP server
    asyncio.run(main())

Troubleshooting

Common Issues

  1. Server won't start:

    • Check Python version (3.8+ required)
    • Verify all dependencies are installed
    • Check for port conflicts
  2. Content fetching fails:

    • Verify URLs are accessible
    • Check network connectivity
    • Review timeout settings
  3. LLM integration not working:

    • For Ollama: Ensure service is running (ollama serve)
    • For HuggingFace: Check API limits and token
    • Verify network access to API endpoints
  4. Memory issues with large profiles:

    • Implement content chunking
    • Add caching mechanisms
    • Limit content size in parsers

Debug Mode

Run with debug logging:

PYTHONPATH=. python -c "
import logging
logging.basicConfig(level=logging.DEBUG)
import asyncio
from haris_profile_server import main
asyncio.run(main())
"

Performance Optimization

Caching

Add caching to reduce repeated requests:

import asyncio
from functools import lru_cache
from datetime import datetime, timedelta

class CachedContent:
    def __init__(self, content: str, timestamp: datetime):
        self.content = content
        self.timestamp = timestamp
    
    def is_expired(self, ttl_minutes: int = 60) -> bool:
        return datetime.now() - self.timestamp > timedelta(minutes=ttl_minutes)

# Add to HarisProfileServer class
self.content_cache = {}

async def _fetch_and_parse_content_cached(self, url: str) -> str:
    if url in self.content_cache and not self.content_cache[url].is_expired():
        return self.content_cache[url].content
    
    content = await self._fetch_and_parse_content(url)
    self.content_cache[url] = CachedContent(content, datetime.now())
    return content

Async Optimization

Fetch multiple sources concurrently:

async def _get_all_profile_data(self) -> Dict[str, str]:
    """Fetch all profile data concurrently"""
    tasks = [
        self._fetch_and_parse_content(url) 
        for url in self.profile_urls.values()
    ]
    
    results = await asyncio.gather(*tasks, return_exceptions=True)
    
    return {
        section: result if isinstance(result, str) else f"Error: {result}"
        for section, result in zip(self.profile_urls.keys(), results)
    }

Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Add your improvements
  4. Test thoroughly
  5. Submit a pull request

Development Setup

# Clone repository
git clone <repository-url>
cd haris-profile-mcp-server

# Install development dependencies
pip install -r requirements.txt
pip install -e .

# Run tests
python -m pytest tests/

# Format code
black *.py

License

This project is licensed under the MIT License. See LICENSE file for details.

Support

For questions or issues:

  • Create an issue in the repository
  • Contact: harisgulzar@outlook.com
  • Documentation: See README and code comments

This MCP server provides a foundation for integrating personal/professional profile data with AI assistants. Extend and customize it based on your specific needs.

Recommended Servers

playwright-mcp

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.

Official
Featured
TypeScript
Magic Component Platform (MCP)

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.

Official
Featured
Local
TypeScript
Audiense Insights MCP Server

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.

Official
Featured
Local
TypeScript
VeyraX MCP

VeyraX MCP

Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.

Official
Featured
Local
graphlit-mcp-server

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.

Official
Featured
TypeScript
Kagi MCP Server

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.

Official
Featured
Python
E2B

E2B

Using MCP to run code via e2b.

Official
Featured
Neon Database

Neon Database

MCP server for interacting with Neon Management API and databases

Official
Featured
Exa Search

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.

Official
Featured
Qdrant Server

Qdrant Server

This repository is an example of how to create a MCP server for Qdrant, a vector search engine.

Official
Featured