CaesarCipher MCP Server

CaesarCipher MCP Server

Provides a Caesar cipher encoding tool as a remote MCP server, enabling prompt agents to encode plaintext messages.

Category
访问服务器

README

CaesarCipher

CaesarCipher is a small Microsoft Foundry prompt-agent sample that uses an Azure Function app as a remote MCP tool.

The Foundry agent receives the user's request, calls the MCP tool exposed by the Function app, and returns the tool result. The Caesar transformation is owned by the Function app, not by the prompt agent.

[!WARNING] This is an experimental learning project and should not be considered production-ready.

What It Does

The agent handles requests such as:

  • "Please encode the message: Hello"
  • "Encode the following plaintext: Attack at dawn"

The prompt in prompt.md instructs the Foundry agent to call the MCP tool named caesar-cipher-function. The tool accepts a single plaintext argument and returns the encoded text.

Architecture

Foundry prompt agent
  -> remote MCP server connection
  -> Azure Functions MCP webhook
  -> caesar-cipher-function
  -> src/azure_functions/caesar_ciper.py

The Azure Functions MCP endpoint is:

https://{function-app-name}.azurewebsites.net/runtime/webhooks/mcp

Do not configure Foundry with only the Function App base URL. The base URL returns a normal web response, not MCP JSON-RPC messages.

Foundry Setup

Create and configure the agent in Microsoft Foundry:

  1. Create or open a Foundry project.
  2. Deploy a chat model in that project.
  3. Create a prompt agent named caesar-cipher.
  4. Paste the contents of prompt.md into the agent instructions.
  5. Add a remote MCP server tool connection.
  6. Set the remote MCP server endpoint to https://{function-app-name}.azurewebsites.net/runtime/webhooks/mcp.
  7. Set authentication to unauthenticated for early testing.
  8. Configure the allowed tool as caesar-cipher-function.
  9. Save and test the agent in Foundry Chat.

The tool call should appear in Foundry Chat as a call to caesar-cipher-function with a plaintext argument.

Azure Function App

The deployable Azure Function app files live in src/azure_functions/.

For zip deployment, zip the contents of this directory so these files are at the zip root:

function_app.py
caesar_ciper.py
host.json
requirements.txt

function_app.py uses the Azure Functions Python v2 programming model and the @app.mcp_tool_trigger decorator to expose caesar-cipher-function.

host.json configures the Azure Functions MCP extension and currently allows anonymous access to the MCP webhook for testing. Add authentication before using this pattern outside a learning environment.

Local MCP Smoke Test

After deploying the Function app, test the MCP server directly before testing through Foundry:

.\scripts\test-mcp-endpoint.ps1 -Endpoint "https://{function-app-name}.azurewebsites.net/runtime/webhooks/mcp" -Plaintext "Hello"

For the current sample deployment, the script defaults to the known MCP endpoint, so this is enough:

.\scripts\test-mcp-endpoint.ps1 -Plaintext "Hello"

A healthy endpoint lists caesar-cipher-function from tools/list and returns the encoded text from tools/call.

Local Setup

Create the virtual environment and install the project with development dependencies:

.\scripts\setup-dev.ps1

The setup script expects Python 3.11 at the path configured in scripts/setup-dev.ps1.

Foundry CLI

The repository also includes a small local CLI for calling the Foundry prompt agent after the agent is available:

.\.venv\Scripts\python.exe -m caesar_cipher "Please encode the message: Hello"

The command calls the live Foundry endpoint and may incur Azure or model usage costs.

The current local CLI is configured for:

agent name: caesar-cipher
agent version: 1

If the project endpoint, agent name, or agent version changes, update src/caesar_cipher/cli.py.

Development Checks

Run formatting, linting, type checking, and tests:

.\scripts\check.ps1

This runs:

  • ruff format .
  • ruff check .
  • pyright
  • pytest

Project Structure

src/azure_functions/
  function_app.py    Azure Functions MCP tool trigger
  caesar_ciper.py    Caesar transformation implementation
  host.json          Azure Functions host and MCP extension settings
  requirements.txt   Function app deployment dependencies

src/caesar_cipher/
  __main__.py        Package entry point for python -m caesar_cipher
  cli.py             Foundry client setup and command-line entry point

scripts/
  setup-dev.ps1
  check.ps1
  test-mcp-endpoint.ps1
  test_mcp_endpoint.py

tests/
  test_caesar_ciper.py
  test_function_app.py
  test_smoke.py

prompt.md           Prompt instructions pasted into the Foundry agent

Notes

This project is a Foundry learning exercise, not a production cryptography system. A Caesar cipher is a historical substitution cipher and is not secure for protecting sensitive information.

Do not include secrets or sensitive personal data in test prompts. The local CLI calls the remote Foundry agent and sends prompts to the configured Foundry project.

Third-Party Notices

This project has direct runtime dependencies on third-party Python packages, including azure-ai-projects, azure-functions, azure-identity, and httpx. See each package's PyPI license metadata for full license and notice terms.

License

GNU General Public License v3.0. See the LICENSE file for details.

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选