{"id":10213,"library":"scim2-server","title":"SCIM2 Server Prototype","description":"scim2-server is a lightweight prototype implementation of a SCIM2 (System for Cross-domain Identity Management) server using FastAPI. It provides basic in-memory reference implementations for SCIM2 user and group management, primarily intended as a starting point or demonstration rather than a production-ready server. The current version is 0.1.9, with an irregular release cadence as a 'prototype'.","status":"active","version":"0.1.9","language":"en","source_language":"en","source_url":"https://github.com/melvin-t/scim2-server","tags":["SCIM","SCIM2","server","API","identity","prototype","FastAPI"],"install":[{"cmd":"pip install scim2-server","lang":"bash","label":"Install core library"},{"cmd":"pip install uvicorn","lang":"bash","label":"Install ASGI server for running"}],"dependencies":[{"reason":"Core web framework for the server implementation.","package":"fastapi"},{"reason":"ASGI server for running the FastAPI application.","package":"uvicorn","optional":true},{"reason":"Used for data validation and serialization of SCIM2 models.","package":"pydantic"}],"imports":[{"note":"The package name is 'scim2-server' (with a hyphen), but the importable module name is 'scim2_server' (with an underscore).","wrong":"from scim2-server import SCIM2Server","symbol":"SCIM2Server","correct":"from scim2_server import SCIM2Server"},{"note":"SCIM2User and SCIM2Group are directly available at the top-level module.","wrong":"from scim2server.models import SCIM2User","symbol":"SCIM2User","correct":"from scim2_server import SCIM2User"},{"note":"Directly available from the main module.","symbol":"SCIM2Group","correct":"from scim2_server import SCIM2Group"}],"quickstart":{"code":"import uvicorn\nfrom fastapi import FastAPI\nfrom scim2_server import SCIM2Server, SCIM2User, SCIM2Group\n\n# Initialize SCIM2 server with in-memory storage\nscim_server = SCIM2Server()\n\n# Optional: Add some initial data\nscim_server.users.create(SCIM2User(id='user1', userName='john.doe', emails=[{'value': 'john.doe@example.com', 'primary': True}]))\nscim_server.groups.create(SCIM2Group(id='group1', displayName='Developers'))\n\n# Create a FastAPI app and include the SCIM2 router\napp = FastAPI(title=\"SCIM2 Prototype API\")\napp.include_router(scim_server.router, prefix=\"/scim/v2\")\n\n@app.get(\"/\")\nasync def root():\n    return {\"message\": \"SCIM2 server is running! Access /scim/v2\"}\n\n# To run this: save as main.py and execute 'uvicorn main:app --reload'\n# The example below demonstrates running programmatically for convenience,\n# but 'uvicorn main:app' is the typical way.\nif __name__ == '__main__':\n    # Note: For production, typically run with `uvicorn main:app` from terminal.\n    # This programmatic run is for quick demonstration.\n    print(\"\\n--- Running SCIM2 Server Prototype ---\")\n    print(\"Access SCIM endpoints at: http://127.0.0.1:8000/scim/v2\")\n    print(\"Try: http://127.0.0.1:8000/scim/v2/Users\")\n    uvicorn.run(app, host=\"127.0.0.1\", port=8000)\n","lang":"python","description":"This quickstart sets up a basic FastAPI application embedding the `scim2-server` router. It initializes an in-memory SCIM2 server, adds a sample user and group, and then runs the FastAPI app using Uvicorn. Access SCIM endpoints at `/scim/v2`."},"warnings":[{"fix":"Understand its limitations. Consider it a starting point for a custom SCIM server implementation, not a ready-to-deploy solution. You will need to replace its in-memory storage with a proper database.","message":"This library is explicitly a 'prototype' and 'in-memory reference implementation'. It is not designed for production use without significant modification for persistence, scalability, and security.","severity":"gotcha","affected_versions":"All versions < 1.0"},{"fix":"Always use `from scim2_server import ...` in your Python code, never `from scim2-server import ...`.","message":"The package name for installation is `scim2-server` (with a hyphen), but the Python module name for imports is `scim2_server` (with an underscore).","severity":"gotcha","affected_versions":"All versions"},{"fix":"Ensure `uvicorn` is installed (`pip install uvicorn`) and you use the correct command to run your FastAPI application, typically `uvicorn main:app --reload` (replace `main:app` with your module and app instance).","message":"Running the SCIM2 server requires FastAPI and an ASGI server like Uvicorn. While FastAPI is a direct dependency, Uvicorn (though listed) requires explicit installation and knowledge of how to start a FastAPI app.","severity":"gotcha","affected_versions":"All versions"}],"env_vars":null,"last_verified":"2026-04-17T00:00:00.000Z","next_check":"2026-07-16T00:00:00.000Z","problems":[{"fix":"Change your import statement from `from scim2-server import ...` to `from scim2_server import ...`.","cause":"Attempted to import using the package name (`scim2-server` with a hyphen) instead of the correct module name (`scim2_server` with an underscore).","error":"ModuleNotFoundError: No module named 'scim2-server'"},{"fix":"First, ensure `uvicorn` is installed (`pip install uvicorn`). Then, make sure your startup command correctly points to your FastAPI app, e.g., if your app is named `app` in `main.py`, run `uvicorn main:app --reload`.","cause":"Uvicorn was either not installed, or the command to start the server was incorrect, preventing it from finding the FastAPI application instance.","error":"uvicorn.run(): No application object specified. Ensure your run command points to your FastAPI app."},{"fix":"Refer to the SCIM2 specification and the library's Pydantic models (e.g., `SCIM2User` definition) to ensure all required attributes are provided with valid data types upon instantiation.","cause":"When creating `SCIM2User` or `SCIM2Group` objects, a required field (like `userName` for users or `displayName` for groups) was omitted or provided with an invalid type.","error":"PydanticValidationError: 1 validation error for SCIM2User\nuserName\n  field required (type=value_error.missing)"}]}