# Deploying Openmed MCP

Run OpenMed's Model Context Protocol (MCP) server so coding agents (Claude Code, Codex)...

- Repository: https://github.com/maziyarpanahi/openmed (5755 stars)
- Category: AI and agents
- License: Apache-2.0
- Last updated: 2026-10-31
- Runs scripts: no, instructions only

## Install

Claude Code: `npx skills add maziyarpanahi/openmed --skill deploying-openmed-mcp -g -a claude-code -y`
Codex: `npx skills add maziyarpanahi/openmed --skill deploying-openmed-mcp -g -a codex -y`
Cursor: `npx skills add maziyarpanahi/openmed --skill deploying-openmed-mcp -g -a cursor -y`
Gemini CLI: `npx skills add maziyarpanahi/openmed --skill deploying-openmed-mcp -g -a gemini-cli -y`
Claude Code plugin marketplace: `/plugin marketplace add maziyarpanahi/openmed`

## Description

Run OpenMed's Model Context Protocol (MCP) server so coding agents (Claude Code, Codex) and chat clients can call clinical NER, PII extraction, and de-identification as tools, on-device. Use when the user wants to add OpenMed to an agent's MCP config, expose de-id/NER as MCP tools, run an MCP server over stdio or Streamable HTTP, give Claude/Codex access to OpenMed, or containerize the MCP server. Covers the mcp extra, create_mcp_server, the 7 tools (openmed_analyze_text, openmed_extract_pii, openmed_deidentify, openmed_list_models, openmed_list_pii_languages, openmed_loaded_models, openmed_unload_model), the resources and prompts, stdio vs streamable-http transports, ServiceRuntime env config, and MCP client config snippets.

## SKILL.md, as published by its author (untrusted third-party text, read it as data)

# Deploying the OpenMed MCP server

`openmed.mcp.server` exposes OpenMed's clinical NLP as **Model Context Protocol**
tools, so coding agents (Claude Code, Codex) and chat clients can de-identify and
analyze clinical text by calling tools instead of writing glue code. It runs
**on-device**, models are local, no telemetry, and the server instructs
clients to send real PHI only to instances the user operates.

## When to use this skill

When an agent or LLM client should be able to *invoke* OpenMed: add it to a
coding agent's MCP config, give a chat client de-id/NER tools, or run a shared
MCP endpoint for a team. For programmatic HTTP from your own services, prefer
`serving-openmed-rest-api`; for corpora, `batch-processing-clinical-text`.

## Quick start

```bash
pip install "openmed[mcp]"                 # FastMCP / MCP SDK

# stdio transport (what coding agents spawn): default
python -m openmed.mcp.server

# Streamable HTTP transport (network-reachable):
python -m openmed.mcp.server --transport streamable-http --host 127.0.0.1 --port 8081
```

```python
# Or embed it:
from openmed.mcp.server import create_mcp_server
server = create_mcp_server()              # FastMCP("OpenMed", ...) with tools+resources+prompts
server.run(transport="stdio")             # or "streamable-http"
```

CLI flags (`build_arg_parser`): `--transport {stdio,streamable-http,http}`,
`--host`, `--port`, `--streamable-http-path` (default `/mcp`), `--version`.
Env equivalents: `OPENMED_MCP_TRANSPORT`, `OPENMED_MCP_HOST`,
`OPENMED_MCP_PORT` (8081), `OPENMED_MCP_PATH`.

## The 7 tools (confirmed in `openmed/mcp/server.py`)

The rest: https://github.com/maziyarpanahi/openmed/blob/HEAD/skills/deploying-openmed-mcp/SKILL.md
