Skip to main content

MCP server for Teamcenter Knowledge Base with Azure AD and cookie authentication

Project description

CodeSentinel MCP Server

A Model Context Protocol (MCP) server that connects AI coding assistants to Siemens Teamcenter Knowledge Base.

Quick Start

1. Install Dependencies

# Using UV (recommended)
uv sync

# Or using pip
pip install -r requirements.txt

2. Get Authentication

Choose one method:

Option A: Web Cookie (Easiest)

  1. Go to https://codesentinel.azurewebsites.net
  2. Login with your Siemens credentials
  3. Open DevTools (F12) → Application → Cookies
  4. Copy the codesess cookie value

Option B: Azure AD Token

# Set your Azure AD config (get from admin)
export AZURE_CLIENT_ID="your-client-id"
export AZURE_TENANT_ID="your-tenant-id"

# Get token
uv run python auth_helper.py

3. Test the Connection

# Test with cookie
export CODESESS_COOKIE="your-cookie-value"
uv run pytest tests/test_mcp_integration.py -v -k "test_with_codesess_cookie"

# Test with Azure token
export AZURE_BEARER_TOKEN="your-token"
uv run pytest tests/test_mcp_integration.py -v -k "test_real_api"

4. Configure VS Code / Continue.dev

Add to ~/.continue/config.json:

{
  "tools": [
    {
      "type": "mcp",
      "title": "Teamcenter KB",
      "transport": {
        "type": "stdio",
        "command": "uv",
        "args": ["run", "python", "/path/to/auth_mcp_stdio_v2.py"],
        "env": {
          "TEAMCENTER_API_HOST": "https://codesentinel.azurewebsites.net",
          "AZURE_CLIENT_ID": "your-client-id",
          "AZURE_TENANT_ID": "your-tenant-id"
        }
      }
    }
  ]
}

Testing

Run All Tests

# Test against mock API (no auth needed)
uv run pytest tests/

# Test against real API (requires auth)
export CODESESS_COOKIE="your-cookie"
uv run pytest tests/test_mcp_integration.py

Example Query

# Direct test of a specific query
export CODESESS_COOKIE="your-cookie"
uv run python -c "
import asyncio
from auth_mcp_stdio_v2 import search
asyncio.run(search.fn('What file processes JSON requests?', 5))
"

Architecture

  • auth_mcp_stdio_v2.py - Main MCP server with Azure AD support
  • main.py - Mock API server for local testing
  • tests/ - Comprehensive test suite

Security

  • NO credentials in code
  • All secrets via environment variables
  • Secure cookie/token handling
  • See SETUP_SECURE.md for details

Troubleshooting

"Connection refused"

  • For mock: Run uv run uvicorn main:app
  • For real API: Check your network/proxy

"Authentication failed"

  • Cookie expired: Get a fresh one from the web app
  • Token expired: Run auth_helper.py again

"Import too slow"

  • Normal on WSL2 with Windows mounts (13s vs 4s native)
  • VS Code timeout is 10s but usually works anyway

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

teamcenter_mcp_server-0.2.0-py3-none-any.whl (13.1 kB view details)

Uploaded Python 3

File details

Details for the file teamcenter_mcp_server-0.2.0-py3-none-any.whl.

File metadata

File hashes

Hashes for teamcenter_mcp_server-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 fcba4c48bf79495fe16b9a341a52d6082de342d2896c182c1af542b13e670c9d
MD5 1d3b6473256f88beec054210405fce3b
BLAKE2b-256 b672046bf75cc36639bd61bbf96b6fe4e7ed121be635c94a8bff3161ddcb106a

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page