-
Notifications
You must be signed in to change notification settings - Fork 5
feat: minimal mcp server #316
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| # Copy this file to .env and fill in your credentials. | ||
| # Obtain them from https://platform.mat3ra.com → Account Preferences → API Tokens | ||
|
|
||
| MAT3RA_ACCOUNT_ID=your_account_id_here | ||
| MAT3RA_AUTH_TOKEN=your_auth_token_here | ||
|
|
||
| # Optional – only needed when working with an organization account | ||
| # MAT3RA_ORGANIZATION_ID=your_org_id_here | ||
|
|
||
| # API connection settings – defaults are correct for the hosted platform | ||
| # MAT3RA_API_HOST=platform.mat3ra.com | ||
| # MAT3RA_API_PORT=443 | ||
| # MAT3RA_API_VERSION=2018-10-01 | ||
| # MAT3RA_API_SECURE=true |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,61 @@ | ||
| # Mat3ra MCP Server | ||
|
|
||
| Proof-of-concept [Model Context Protocol](https://modelcontextprotocol.io/) server | ||
| that exposes the Mat3ra REST API as MCP **tools**, allowing any compatible client | ||
| (Claude Desktop, Cursor, etc.) to interact with your Mat3ra account through natural language. | ||
|
|
||
| ## Available tools | ||
|
|
||
| | Tool | Description | | ||
| |---|---| | ||
| | `list_materials` | Search materials by formula or Mongo query | | ||
| | `get_material` | Fetch one material by ID | | ||
| | `create_material` | Upload a new material from a JSON config | | ||
| | `list_workflows` | List workflows | | ||
| | `list_jobs` | List jobs | | ||
| | `create_and_submit_job` | Create + submit a job (requires material + workflow IDs) | | ||
| | `get_job` | Fetch a job and its current status | | ||
|
|
||
| ## Setup | ||
|
|
||
| ```bash | ||
| # 1. Create a venv (Python 3.10+) | ||
| python3.11 -m venv .venv | ||
| source .venv/bin/activate | ||
|
|
||
| # 2. Install dependencies | ||
| pip install mcp mat3ra-api-client | ||
|
|
||
| # 3. Set your credentials | ||
| cp mcp_server/.env.example mcp_server/.env | ||
| # → edit .env with your ACCOUNT_ID and AUTH_TOKEN | ||
| # (get them from https://platform.mat3ra.com → Account Preferences → API Tokens) | ||
|
|
||
| # 4. Start the server (stdio transport) | ||
| export $(cat mcp_server/.env | grep -v '^#' | xargs) | ||
|
coderabbitai[bot] marked this conversation as resolved.
Outdated
|
||
| python mcp_server/server.py | ||
| ``` | ||
|
|
||
| ## Claude Desktop integration | ||
|
|
||
| Add to `~/Library/Application Support/Claude/claude_desktop_config.json`: | ||
|
|
||
| ```json | ||
| { | ||
| "mcpServers": { | ||
| "mat3ra": { | ||
| "command": "/path/to/.venv/bin/python", | ||
| "args": ["/path/to/api-examples/mcp_server/server.py"], | ||
| "env": { | ||
| "MAT3RA_ACCOUNT_ID": "your_account_id", | ||
| "MAT3RA_AUTH_TOKEN": "your_auth_token" | ||
| } | ||
| } | ||
| } | ||
| } | ||
| ``` | ||
|
|
||
| Then restart Claude Desktop. You can now ask things like: | ||
| - *"List my Si materials on Mat3ra"* | ||
| - *"Create an FCC Si material with lattice parameter 5.43 Å"* | ||
| - *"What is the status of job `abc123`?"* | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| [project] | ||
| name = "mat3ra-mcp-server" | ||
| version = "0.1.0" | ||
| description = "Proof-of-concept MCP server for the Mat3ra API" | ||
| requires-python = ">=3.10" | ||
| dependencies = [ | ||
| "mcp>=1.0", | ||
| "mat3ra-api-client", | ||
| ] | ||
|
|
||
| [project.scripts] | ||
| mat3ra-mcp = "mcp_server.server:main" | ||
|
|
||
|
Comment on lines
+27
to
+29
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chain🏁 Script executed: #!/bin/bash
# Verify entrypoint target and callable type in repo sources
rg -n '^\[project\.scripts\]|mat3ra-mcp\s*=|^async def main|^def cli' mcp_server/pyproject.toml mcp_server/server.pyRepository: Exabyte-io/api-examples Length of output: 224 🏁 Script executed: #!/bin/bash
# Search for any cli wrapper function and check full context around main
rg -A 5 -B 2 'def cli|def main' mcp_server/server.pyRepository: Exabyte-io/api-examples Length of output: 336 Console script points to an async function and won't run correctly.
Suggested change# mcp_server/server.py
+def cli() -> None:
+ import asyncio
+ asyncio.run(main())
# mcp_server/pyproject.toml
[project.scripts]
-mat3ra-mcp = "mcp_server.server:main"
+mat3ra-mcp = "mcp_server.server:cli"🤖 Prompt for AI Agents |
||
| [build-system] | ||
| requires = ["setuptools>=64", "wheel"] | ||
| build-backend = "setuptools.build_meta" | ||
Uh oh!
There was an error while loading. Please reload this page.